58 lines
2.0 KiB
Plaintext
58 lines
2.0 KiB
Plaintext
**NOTE** I haven't yet tested direct boot through Raspberry's
|
|
proprietary bootloader.
|
|
|
|
Booting Yggdrasil on Raspberry Pi 4B with u-boot:
|
|
|
|
1. Clone u-boot sources to some directory and checkout some
|
|
stable branch. I've used v2024.10.
|
|
2. Modify cmd/boot.c by replacing the do_go_exec function:
|
|
|
|
/* Allow ports to override the default behavior */
|
|
__attribute__((weak))
|
|
unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
|
|
char *const argv[])
|
|
{
|
|
void *entry_ptr = (void *) entry;
|
|
ulong fdt_addr_r = 0;
|
|
if (argc >= 2) {
|
|
fdt_addr_r = hextoul(argv[1], NULL);
|
|
}
|
|
void (*func)(ulong) = entry_ptr;
|
|
func(fdt_addr_r);
|
|
|
|
return 0;
|
|
}
|
|
|
|
3. make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 rpi_4_defconfig
|
|
4. make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 -j
|
|
5. Copy u-boot.bin into your Pi SD-card's boot partition.
|
|
**NOTE** I assume you have all the bootloader parts in the boot partition already.
|
|
If not, clone raspberry fw repo and copy the following files to the boot partition:
|
|
* bootcode.bin
|
|
* start4.elf
|
|
* all the .dtb files (a bcm2711-rpi-4-b.dtb should be enough though)
|
|
6. config.txt:
|
|
enable_uart=1
|
|
arm64_bit=1
|
|
kernel=u-boot.bin
|
|
|
|
7. Compile the OS with `cargo xtask --arch=aarch64 --board=raspi4b --release`
|
|
8. Copy the following files into some directory:
|
|
* target/aarch64-unknown-raspi4b/release/yggdrasil-kernel
|
|
* userspace/target/aarch64-unknown-yggdrasil/release/initrd.tar
|
|
9. cd into that directory and start a TFTP server of your choice. I used `uftpd`.
|
|
|
|
10. Connect an ethernet and serial to the Pi and run the following commands in u-boot shell:
|
|
|
|
tftpboot 0x04000000 <YOUR IP>:initrd.tar
|
|
tftpboot ${loadaddr} <YOUR IP>:yggdrasil-kernel
|
|
load mmc 0:1 ${fdt_addr_r} bcm2711-rpi-4-b.dtb
|
|
fdt addr ${fdt_addr_r}
|
|
fdt resize
|
|
fdt memory 0x0 0x3C000000
|
|
fdt chosen 0x04000000 <WHATEVER SIZE WAS PRINTED WHEN RUNNING THE FIRST COMMAND>
|
|
bootelf -p
|
|
go ${kernel_addr_r} ${fdt_addr_r}
|
|
|
|
11. Yggdrasil OS should start!
|