View previous topic :: View next topic |
Author |
Message |
Daytona n00b
Joined: 01 Aug 2005 Posts: 55 Location: EN51vt
|
Posted: Tue Aug 11, 2020 11:41 pm Post subject: Setting up PPC G4 disk on amd64 [solved] |
|
|
Hi all PPC lovers,
Roughly 14 years ago, I got a Powerbook G3 and set up gentoo on it from my PC by getting a bigger drive, dd'ing the old drive to the new, then adding partitions for gentoo and putting stage3 on. Then cross-compiling a kernel. I thought somehow I chrooted, wouldn't I have had to in order to set the root password? Memory has faded on this. I doubt I used qemu or the like, as I still haven't quite figured that out!
Here we are in the present day, I was given a 12" G4 Powerbook with a busted CD drive. I see this can boot gentoo directly, yay! I've tried to boot it from a USB stick and a USB CDROM, no go. Apparently this model isn't capable. Unless the internets was wrong, which I know can't happen.
I've pulled the disk and set up the disk and have stage3 on it. Of course, I can't chroot into it because amd64 does not speak ppc. I did manage to build a kernel using ARCH="powerpc" CROSS_COMPILE="powerpc-unknown-linux-gnu-" make pmac_defconfig, then tweaking it a bit afterwards and put that kernel onto the disk. Now I'm stuck, because I obviously can't emerge yaboot.
Anyone have ideas on how to proceed? Can I go into openfirmware and manually point it to my kernel and boot that way? Maybe once I get a kernel started, I could then get it to recognize and load a external CDROM, boot that, then chroot in. Convoluted, I know, but nothing I do is easy . The easy way out would be to get another internal drive, but I really have no motivation to spend any money on this thing- this is mainly for edutainment, and maybe I'll get some use out of it.
Appreciate anybody's thoughts!
(now that I think about it, since the G3 boots into OS9 then BootX takes over, probably all I needed was a kernel. But again, passwd? Maybe I did boot the CD.... I swore I did the bulk of the work from the PC though, I remember having to yank the drive out, tweak/rebuild the kernel, and put it back in a few times!)
Last edited by Daytona on Fri Aug 21, 2020 3:52 am; edited 1 time in total |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22602
|
Posted: Wed Aug 12, 2020 1:51 am Post subject: |
|
|
If you can find a way to make the system boot your chosen kernel, you can have the kernel boot into an on-disk filesystem containing PPC user software, and use that to install a cleaner boot setup. More generally, assuming adequate cross-compilation support, you can have the amd64 system cross-compile everything and install it all onto the drive for the PPC system. There is no need to involve external optical media at all.
As for making it boot the first time, unless configuring the boot properly requires interacting with the firmware, there should be some way to configure that from the amd64 system too. |
|
Back to top |
|
|
Daytona n00b
Joined: 01 Aug 2005 Posts: 55 Location: EN51vt
|
Posted: Thu Aug 13, 2020 2:35 am Post subject: |
|
|
Made some progress. After staring at man emerge, and finding https://wiki.gentoo.org/wiki/Embedded_Handbook/General/Cross-compiling_with_Portage, I came up with Code: | powerpc-unknown-linux-gnu-emerge --root=/mnt/gentoo --sysroot=/mnt/gentoo --config-root=/mnt/gentoo --root-deps -av yaboot
* IMPORTANT: 8 news items need reading for repository 'gentoo'.
* Use eselect news read to view new items.
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild N ] sys-fs/mac-fdisk-0.1_p18::gentoo to /mnt/gentoo/ 0 KiB
[ebuild N ] sys-apps/powerpc-utils-1.1.3.18-r3::gentoo to /mnt/gentoo/ 59 KiB
[ebuild R ] sys-fs/e2fsprogs-1.45.5::gentoo to /mnt/gentoo/ USE="nls (split-usr) static-libs* -cron -fuse" 0 KiB
[ebuild N ] sys-boot/yaboot-1.3.17-r2::gentoo to /mnt/gentoo/ USE="(-ibm)" 220 KiB
|
There is still something weird going on, e2fsprogs fails to compile due to missing libuuid. Thing is, it is passed --disable-libuuid, but somehow it end up enabled. That is a topic for a different thread (in a different subforum), though.
I also found https://wiki.gentoo.org/wiki/Cross_build_environment, which involves qemu. Might try that out if I can't solve the aforementioned problem. |
|
Back to top |
|
|
Daytona n00b
Joined: 01 Aug 2005 Posts: 55 Location: EN51vt
|
Posted: Fri Aug 14, 2020 6:05 pm Post subject: |
|
|
Another update, in case someone else ever tries this insanity:
Following the instructions at https://wiki.gentoo.org/wiki/Cross_build_environment has proved to be the way to go.
Cross-compiling using powerpc-unknown-linux-gnu-emerge works for some, but not all, packages. I'm no expert at debugging configure scripts, but either (a) it was finding things on my PC instead of the PPC stage 3, or (b) it was attempting to run a PPC program on my PC which obviously failes and gave erroneous results to configure. Either way, running in a qemu chroot per the article was successful.
My problem now is yaboot. I have built yaboot-static (yaboot [dynamic] has some problems which apparently have never been solved at this time), but it wants to access OF to write some values which of course it can't to on my PC. I need to see if I can have it only update the bootstrap partition, then figure out what I need to do in OF to replicate what yaboot would do.
The saga continues... |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22602
|
Posted: Fri Aug 14, 2020 8:00 pm Post subject: |
|
|
Cross-compilation failures like that are unfortunate and undesirable, but not unexpected. Some packages are not written to handle cross-compilation correctly, and it's sadly quite rare that anyone does extensive testing for cross-compile compatibility. Both (a) and (b) are common cross-compile bugs. |
|
Back to top |
|
|
Daytona n00b
Joined: 01 Aug 2005 Posts: 55 Location: EN51vt
|
Posted: Mon Aug 17, 2020 3:38 pm Post subject: |
|
|
Interesting. Appreciate the input! As I said, I'm no expert on configure or makefile scripts. As long as the environment is correct, I would expect it to "just work", but at the same time I know better than that. Now that I do know that, I will remember that when the time comes that I maintain a project with such scripts. |
|
Back to top |
|
|
Daytona n00b
Joined: 01 Aug 2005 Posts: 55 Location: EN51vt
|
Posted: Mon Aug 17, 2020 3:55 pm Post subject: |
|
|
Another status update:
I had to put the drive back in the G4, then start up in openfirmare (option-apple-o-f on startup) to find the OF device path for the drive, and place that in yaboot.conf. I also had to specify the same in ofboot=<path> in yaboot.conf, even though that line was missing from the example file.
After that, it was back to the PC and the qemu chroot. I was able to run mkofboot and ybin to initialize the bootstrap partition and install yaboot.
Drive back in the G4, power up, and it still does not find anything to boot. Restarted in OF, and entered and yaboot loaded.
Now, no matter what I pas to yaboot, it does not find my kernel. After some reading, I thought it was due to using jfs instead of ext4 (what documentation exists for yaboot only mentions ext2), so I rsync'd the whole root partition off, reformatted as ext4, then put it back on, but still nothing. This is a topic for another thread. |
|
Back to top |
|
|
Daytona n00b
Joined: 01 Aug 2005 Posts: 55 Location: EN51vt
|
Posted: Fri Aug 21, 2020 3:51 am Post subject: |
|
|
The conclusion:
After reading several other posts regarding yaboot, I gave up and installed grub per this post.
This did not go fully without incident. First, I kept getting invalid instruction exceptions from qemu. Not for the main grub executable but from some ancillary programs. I adjusted USE to build as little as needed and even tried to cut the offending binaries out of the makefile, but was unsuccessful. Then I remembered my G3. Why not build the package there and quickpkg it up, then install it on the G4? I'd have to adjust -mcpu, no big deal. Probably better to just use a generic powerpc target. Then I thought, maybe it's -mcpu=7450 target causing problems, why not change to -mcpu=powerpc in the chroot first? So I did, and it worked. Obviously, OF variables weren't set, but I had figured out how to boot from OF already, no big deal. GRUB happily told me what it needed to do (but couldn't), so I wrote that down. Followed the rest of the directions to set up the bootstrap partition, and put the drive into the G4.
Powered on the G4, and got the "No" screen. Not completely unexpected. Restarted into OF, entered boot hd:2,\\:tbxi , and was greeted with GRUB. Having never actually used GRUB, had to figure that out, but the kernel did boot and was greeted with a login prompt. Success! I"ve since built a new kernel, installed some packages, set the OF vars and rebooted- machine now boots into Gentoo on its' own. Another machine going from useless to usable. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|