~martijnbraam/bootinfo

ARM bootloader debugging utilities
Change heading hierarchy
463dc12e — Paskal Stoyanov 14 days ago
Install instructions
Fix long_description for pypi

clone

read-only
https://git.sr.ht/~martijnbraam/bootinfo
read/write
git@git.sr.ht:~martijnbraam/bootinfo

You can also use your local clone with git send-email.

#Bootinfo

This tool detects valid boot signatures on storage devices or debugging boot issues on ARM boards.

#Supported platforms

  • Allwinner A64 (PinePhone, PineTab, etc...)
  • Rockchip RK3399 (Pinebook Pro, PinePhone Pro, Rockpro64)
  • Generic Amlogic (Should work on all meson platforms)

#The bootinfo command

$ sudo bootinfo
Found 'Sunxi/Allwinner eGON header' on /dev/mmcblk0 offset 8192B
Found 'Sunxi/Allwinner eGON header far' on /dev/mmcblk2 offset 131072B
Found 'Sunxi/Allwinner eGON header mmcboot' on /dev/mmcblk2boot0 offset 0B
    /dev/mmcblk2boot0 is not marked bootable!

Detected a bootloader on the SD, one on the eMMC which is on another offset because GPT and a bootloader on the mmc boot hardware partition. The boot0 partition is not marked bootable which on Allwinner platforms will ignore the boot signature.

#The wipeboot command

The wipeboot command is designed to have a similar interface to wipefs and allows quickly checking for a bootloader on a specific block device and also to wipe it.

$ sudo wipeboot /dev/mmcblk2
Found 'Sunxi/Allwinner eGON header far' on /dev/mmcblk2 offset 131072B

To clear the bootloader add the -a argument. This will zero out the first few bytes of the bootloader without touching any of the surrounding partition tables etc.

$ sudo wipeboot -a /dev/mmcblk2
Found 'Sunxi/Allwinner eGON header far' on /dev/mmcblk2 offset 131072B
Do you want to clean the 1 sectors containing boot signatures?
Enter to continue, ctrl+c to abort

If you want to temporarily disable the bootloader there's also the -i flag, this will invert all the bits of the bootloader signature, which will make it undetectable to the actual hardware but is a nice and reversible operation.

$ sudo wipeboot --all --invert /dev/mmcblk2
Found 'Sunxi/Allwinner eGON header far' on /dev/mmcblk2 offset 131072B
Do you want to clean the 1 sectors containing boot signatures?
Enter to continue, ctrl+c to abort

Inverted 8192 (Sunxi/Allwinner eGON header)

$ sudo wipeboot /dev/mmcblk2
Found 'Sunxi/Allwinner eGON header' on /dev/mmcblk2 offset 8192B (inverted)

$ sudo wipeboot --all --invert /dev/mmcblk2
... the same operation restores the bootloader

$ sudo wipeboot /dev/mmcblk2
Found 'Sunxi/Allwinner eGON header' on /dev/mmcblk2 offset 8192B

#Installing

#Install via package manager

On Alpine and postmarketOS you can install Bootinfo through the package manager:

$ apk add bootinfo

#Install locally

You can build and install package locally. This is the preferred method if Bootinfo is not available in your distribution repositories.

$ git clone https://git.sr.ht/~martijnbraam/bootinfo
$ cd bootinfo
$ sudo python setup.py install

Note: The package has to be installed as root user to be able to function as expected.

#Install via pip

You can install Bootinfo via pip. While this method is very approachable, installing python packages as root user through pip is generally not recommended and should be avoided if possible:

$ sudo pip3 install bootinfo