| 8 Apr 2024 |
Pratham Patel (you can mention me) | cnx: ^^^ | 07:53:26 |
cnx | i'm not familiar with u-boot (process), does it not load the kernel but efi? | 08:24:47 |
Pratham Patel (you can mention me) | You can do both | 08:25:37 |
Alex | In reply to @cnx:loang.net i'm not familiar with u-boot (process), does it not load the kernel but efi? The boot partition contains the systemd-boot loader, the kernel, and the initrd. | 08:25:48 |
Alex | Or was it GRUB? | 08:26:05 |
Pratham Patel (you can mention me) | but if you want a non-ext for rootfs, it's best to boot into a bootloader (grub/systemd-boto) from uboot and then load kernel | 08:26:20 |
cnx | thanks! | 08:27:05 |
Alex | Anyway, here's the full boot chain typically used on the JH7110-based SBCs:
ZSBL (ROM) -> OpenSBI and u-boot (usually flash) -> GRUB/systemd-boot (boot partition) -> kernel (boot partition) -> initrd, AKA NixOS stage 1 (boot partition) -> root system, AKA NixOS stage 2 | 08:29:19 |
cnx | how is opensbi and u-boot loaded? | 08:30:04 |
cnx | i mean where are they loaded from a storage in case of sdio? | 08:30:25 |
cnx | the beginning of the drive? | 08:30:32 |
Alex | Nope, the ZSBL looks for a partition with a specific type in the GPT. | 08:30:56 |
cnx | i see, so say i can have a partition for them on the emmc and use the rest for boot partition and os? | 08:31:59 |
Alex | Yes, but you can also keep them in flash and have the entire disk for yourself. | 08:32:21 |
cnx | i'm reluctant to override the stock flash, is it possible to back it up? | 08:32:58 |
Alex | Presumably, though I don't know how you'd do that. | 08:33:14 |
Alex | You probably should be updating it because the vendor has significantly improved it over the past year. | 08:33:42 |
Pratham Patel (you can mention me) | ZSBL is in SoC's ROM. That has an offset to look for, where OpenSBI is stored. OpenSBI either has a hardcoded offset that it looks for, to load U-Boot, or you can specify one at build-time (IIRC, the later is done for the VF2) and then U-Boot scans storage mediums in the given order and scans for EFI partitions and loads from the first match. | 08:34:01 |
Alex | Up to you I guess. | 08:34:03 |
Pratham Patel (you can mention me) | In reply to @cnx:loang.net i'm reluctant to override the stock flash, is it possible to back it up? even if you f it up | 08:34:26 |
Pratham Patel (you can mention me) | it's easy to override it | 08:34:32 |
Pratham Patel (you can mention me) | using the vendor's recovery tool | 08:34:40 |
Alex |
That has an offset to look for, where OpenSBI is stored.
I've been playing around with booting custom binaries on the SBC before, and it definitely won't load it if the partition type ID doesn't match.
Now I haven't tried whether or not it supports having that partition at a different location, so you could still be right... | 08:35:52 |
Pratham Patel (you can mention me) | best not to try it, and remain sane :) | 08:36:38 |
Alex | In reply to @thefossguy:matrix.org using the vendor's recovery tool To elaborate: as long as you have access to UART, you can't brick your system because the ZSBL is also capable of loading the next stage directly over UART. | 08:37:21 |
cnx | thanks, that's good to know | 08:37:44 |
Alex | In reply to @thefossguy:matrix.org best not to try it, and remain sane :) Well I've already reverse engineered some of the ZSBL code, so I'm not sure what sanity I have left... | 08:38:10 |
cnx | In reply to @thefossguy:matrix.org ZSBL is in SoC's ROM. That has an offset to look for, where OpenSBI is stored. OpenSBI either has a hardcoded offset that it looks for, to load U-Boot, or you can specify one at build-time (IIRC, the later is done for the VF2) and then U-Boot scans storage mediums in the given order and scans for EFI partitions and loads from the first match. if the opensbi offset is fixed does it mean you need to flash the partition table along with it? | 08:40:14 |
Pratham Patel (you can mention me) | In reply to @cnx:loang.net if the opensbi offset is fixed does it mean you need to flash the partition table along with it? this is selected at compile-time for the VF2 | 08:40:44 |
cnx | I meant the offset to find opensbi | 08:41:04 |