News for hackers. Stuff that matters.
Re:Pinephone first steps by yjftsjthsd-h on Monday May 11, 2020 @10:44PM (#23150053)
That is extremely cool. One point of hopefully constructive feedback: It's not clear to me how I can use this, or even if I can use it without re-engineering my system (i.e. can this be applied to an existing postmarketOS/ubports/whatever image, or does it have to be integrated into the image build process?). I'm perfectly comfortable using dd to overwrite a boot sector (heck, that's the syslinux install process on x86), but then do I just poke through my boot partition and build a config file that points at my existing kernel+initrd?
Re:Pinephone first steps by megous on Wednesday May 13, 2020 @06:53AM (#23165585)
I'll add some tutorial file to the repository later on. Eventually yes, you'd also be able to use this the way you described if your boot partition will be a FAT partition.

ATM, p-boot uses its own filesystem format optimized for quick and simple loading of data from storage during boot.

So you'd have to either use some spare partition (for example if you have swap partition on eMMC) or replace the existing boot partition contents with this filesystem. (It must be a MBR style primary partition, not GPT)

Then it's just a question of writing p-boot.bin somewhere (preferably uSD card, so you can go back to your original bootloader easily) And writing a boot partition using the p-boot-conf command as is described in the README, with a single boot config file like (that you'd have to modify this to match your OS):

    no=0
    name=Arch Linux 5.7 (eMMC)
    atf=fw.bin
    linux=Image
    dtb=board.dtb
    bootargs=console=ttyS0,115200 console=tty1 root=/dev/mmcblk2p2 rootfstype=f2fs rootflags=fastboot rootwait rw panic=3 cma=256M
    initramfs=initramfs.img
Actually, p-boot will search for the boot partition also on the uSD card if it doesn't find it on eMMC, so if you have your OS on eMMC, you can try p-boot without touching your eMMC OS installation at all. You'd just place p-boot.bin and its custom boot partition on SD card. You'll lose some boot speed this way, since uSD card read speed is 24MiB/s but eMMC is typically 84-88MiB/s

So in short:

- find a space for p-boot boot filesystem partition

- figure out a config file for your system's boot configuration

- format the boot partition using p-boot-conf tool

- dd the p-boot.bin to the boot location on SD or eMMC (or both)

- (you can do all this with just a spare SD card, while the booted OS is on eMMC, and roll-back by just removing the SD card)