Topic: Installing Gentoo
...was actually fairly straightforward. The trickiest part, since I have a custom setup, was setting up the initramfs, with the rest being a few changes to U-Boot. Below are the changes to U-Boot's include/configs/novena.h:
- "initrd_addr_r=-\0" \
+ "initrd_addr_r=0x15000000\0" \
Since I'm using an 'initramfs', I need to have U-Boot load it to a location in memory. This location was arbitrarily chosen with no knowledge of the memory layout whatsoever, so it may actually be an awful choice.
- "bootargs=init=/lib/systemd/systemd rootwait rw\0" \
+ "bootargs=init=/sbin/init rootwait rw\0" \
We need to boot from the regular init program, not systemd. This actually works on Debian, since /sbin/init is just a symlink to systemderp.
"if sleep 2 ; then true; else exit ; fi ; " \
"echo Entering recovery mode... ; " \
"setenv rec .recovery ; " \
- "setenv bootargs ${bootargs} recovery ; " \
+ "setenv bootargs init=/lib/systemd/systemd rootwait rw recovery ; " \
+ "setenv initrd_addr_r - ; " \
"setenv rootdev PARTUUID=4e6f764d-03 ; " /* NovM */ \
"else ; " \
"echo Hold recovery button to boot to " \
"recovery, or to enter U-Boot shell. ; " \
+ "setenv rootdev /dev/disk/by-id/ata-SSD_840_EVO_250GB ; " \
A quick hack that resets boot values to ones appropriate for either the recovery partition or the SSD (Note that the disk ID is different that what you'll see at runtime). You should set the appropriate rootdev if you are running this code yourself.
"fatload ${bootsrc} ${bootdev} " \
"${fdt_addr_r} novena${rec}.dtb ; " \
+ "fatload ${bootsrc} ${bootdev} " \
+ "${initrd_addr_r} initramfs ; " \
"fdt addr ${fdt_addr_r} ; " \
Load the initramfs from the boot device into memory.
"setenv bootargs ${bootargs} " \
"root=${rootdev} " \
+ "initrd=initramfs " \
"console=${consdev} ; " \
Add the initramfs to kernel arguments.
...and I think that those were most of the U-boot changes that I made.
Most of the pain points involved creating static binaries. A couple of notes follow:
If you've updated the kernel, you may need to update the recovery partition as well:
cp zImage zImage.recovery
cp novena.dtb novena.recovery.dtb
bash is tricky to compile natively. I had to use both
--enable-static-link --without-bash-malloc
hdparm returns different data in the initramfs environment, possibly due to missing kernel modules in that environment.
Make sure that any crypto algorithms that you need in the kernel are built in or available as modules; Novena doesn't have Twofish, Serpent, or ripemd160 enabled by default.
Have a backup boot device (SD Card) before attempting to modify U-Boot.