Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Don't use ChatGPT. It's not smart. It can't do research or reasoning or logic or math with consistency. What it says in one statement will be contradicted in the next...

If you're posting output from ChatGPT then say so, so we can ignore it or at least not blame you for the incoherent ramblings of a chat bot.
I'm using Greptile, but I'm not sure it's really any smarter than ChatGPT, or that we can train it to be any smarter.


It's pretty cool tho and in time it may prove to be useful. It's free to use for one repository, and it is really good at scaring the code and looking for sections and explaining some basic functionality to someone like me that can't really code.

As far as the usefulness of the code it gives, I'm just not sure yet, but it seems to be broken code most of the time, so far.

It makes mistakes as you have seen, seems to make fundamental errors and then double down on them even when you have already tried to correct them. I asked it to help me write an xcoff loader and it completely forgot to tell me SLOF already has an xcoff loader.

If we correct it and it can learn from that and not double down on it's own mistakes it will in time become more useful, but it's already useful to me, even with it's errors because I'm actually learning a few things. I test and try, and I have you to tell me some things that are flawed, so thank you Joe, you are generous with your time and knowledge.

If nothing else it's very good at scanning large codebases like Apple's Xnu sources and finding specific things you ask it to find, like the parts of the code that need to be changed to support the Power9. So now I have some idea where to look and what needs to be done.
 
Greptile can't even seem to write a simple hello world in PowerPC assembly that will compile on Linux PPC or Leopard PPC.

It was a fun dream to think I'd get any help form it for this task, the more I use it, the worse it gets.

Code:
.section .text
.globl _start

_start:
    li      r0, 4             # syscall number for write
    li      r3, 1             # file descriptor for stdout
    lis     r4, message@ha    # high part of address of message
    addi    r4, r4, message@l # low part of address of message
    li      r5, 12            # length of message
    sc                        # system call

    li      r0, 1             # syscall number for exit
    li      r3, 0             # exit code
    sc                        # system call

.section .data
message:
    .asciz "Hello World\n"
 
I think I got that issue resolved and I built a hello_word.xcoff to test xcoff loading in SLOF, but I must be misunderstanding how it loads xcoffs or my file is bad.
 

Attachments

  • hello_world.xcoff.zip
    475 bytes · Views: 30
@joevt you warned my about AI, greptile will just make things up, and it didn't seem to know that it needed to tell the assembler (as) to compile PPC assembly as PPC.

Once we got over that, I'm really not any smarter than it is, we were able to at least compile the code, and we used objcopy to link it as an xcoff, tho it is a aixcoff, and I'm not sure it will run in SLOF or Apple's OF.

Baby steps, the code may or may not work, but I learned a few things myself, so one day that may prove to be useful.
 
At any rate, there is no code to load xcoff in SLOF, so I need to compile a simple hello_world xcoff that can run in Apple's OF just as a test. Then I can starting writing a xcoff loader for SLOF with simple code and know good results.


After I get that working I can work on BootX support.
 
I note the OF seem to have an aix-boot package.

Code:
/packages@0
FF8318B0:   /deblocker@0,0
FF832128:   /disk-label@0,0
FF832C18:   /obp-tftp@0,0
FF835640:   /mac-files@0,0
FF837998:   /mac-parts@0,0
FF838B80:   /aix-boot@0,0
FF839088:   /fat-files@0,0
FF83AA98:   /iso-9660-files@0,0
FF83B5A8:   /xcoff-loader@0,0
FF83BFE0:   /terminal-emulator@0,0
 
Before I chase my tail too much I figured I try to modify BootX to compile as an ELF format binary to see if SLOF could load that, and what the results would be...

Anywho, why not start a GitHub repository so others can play along, and maybe fix things I break;-).


This is for 10.4.11, later versions of BootX are for Leopard and they require a private hibernation header I've not been able to find the proper copy of and also a header named boot.h that I've not been able to find any copy of.

This version of BootX requires an RAID header file was was able to find and did include because it won't build without it. It's the Raid.h at the top level and you'll need to fix the path in the Raid.c to the file//***FIX ME***//

There is not a lot of info out there on building Apple's BootX, I maybe one of the only people to have ever modified it, as years ago I added some debug info that prints to the screen at each stage of the bootloading so if the system won't load you can see where it fails before BootX hands off control to the Kernel.

I'll include that debug info later at some point if I can find my notes on it.

If you just want to :tbxi of BootX with logging so you don't have to build anything PM me and I'll link it to my Google Drive as a download.
 
Isn't XPostFacto's BootX just Apple's BootX with some additions?
This is true, so it's a modded version of bootx too.

I'm not sure what version of bootx I used for logging, too long ago and I did not keep good notes, but it does boot 10.4.11, so it may have been 74.1.

Tho I don't remember having to find the raid boot header file, so it could have been older, there are a lot of things or at least a few things I don't remember.

I think they are somewhat forward and backward compatible, but older versions of XPF are required to boot >10.2 so that maybe why, too new of a version of bootx.
 
Looks like apple's ld doesn't support ELF, so I'm going to need GNU binutils, and I'm not sure what version.

I could likely use Tiger-Brew but I've never been able to get that to work, does it still work?

Or I could try MacPorts, but I haven't used that in years.

I'll just try an old version of binutils first with --target=powerpc-unknown-linux-gnu and install it somewhere it doesn't conflict with Apple's cctools to see if that works, then just try and point there.
 
I don't know it looks like some FCode is converted to C first when building BootX, I assume so BootX can do some stuff in Open Firmware to start it's first stage?

Then the main part of BootX seem like it maybe built as a Mach-0 binary, then this is converted to XCOFF.

So I would likely have to write something to covert Mach-0 to EFL and that is likely more work and much harder for me to do than just adding XCOFF support to SLOF.

I did find that Grub2 on the PC at one point could load OS X without the boot.efi, so there maybe some code in Grub2 to load a Mach-0 kernel but who knows how hard that would be to port to PPC.

I did learn a few things about BootX and that will likely come in handy if I can ever get some XCOFF loader code working in SLOF.
 
Isn't XPostFacto's BootX just Apple's BootX with some additions?

I have always wondered what happened to the chap who made XpostFacto, the work he did to keep the Beige Macs relevant was/is nothing short of amazing, I would love to see one last release of Xpostfacto, to fix the edge case issues of Xpostfacto 4 (like the fact that the BootX version included in Xpostfacto 4 is broken on AAPL,e826 and AAPL,e411 machines) and then also add support for Leopard for those with G4 upgraded beige macs

I of course have managed to boot 10.5.8 on my beige macs, based on the awesome work of @jimjamyaha but its very much a proof of concept thing and has a few issues here and there, for example it relies on rolling back the kernel to 10.5.5's kernel and if you go to graphics/displays in system profiler it kernel panics the system etc

I have been meaning to revisit the project see if I could get things cleaned up, especially now I have copies of all the Leopard Betas myself to work with :) (I would like to at least see if its possible to get it 10.5.8 booting with its own 10.5.8 kernel as well)
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.