BOOTBOOT Loader - Raspberry Pi Forums


dear fellow raspberry pi 3 hobby os developers

share nice little boot loader raspberry pi 3 you. offers easy way boot ramdisk image gpt disk. sets 32 bit framebuffer , maps kernel in higher half of memory. open source , free software, licensed under public domain. targets micro-kernels, , supports elf64 , pe32+ executable formats. comes without warranty in hope useful.

rst helping me out mmu on aarch64.

edit: documentation available in pdf.

how use

1. first of all, you'll need higher half linked kernel binary. example, see sample mykernel.aarch64.elf. loader focuses on micro-kernels, should small, , should fit in 2m memory block. can use sample's source starter own kernel.

2. along other files, put micro-kernel binary in archive file. can use tar or cpio (hpodc, newc or crc variant) or other format like. if choose format loader not understand, make sure first executable in kernel. can optionally compress archive gzip, although not recommended uncompression considerably slower reading sd card.

3. sdhc card. create gpt partitioning scheme small (~8mb-16mb) efi system partition on it. optionally create other partitions os. format esp fat16, it's small fat32.

4. tricky part, raspberry pi 3 firmware not understand gpt, 1 have map esp in mbr. easiest way using small mkboot utility provided loader.

5. copy broadcom's bootcode.bin (~50k), start.elf (~3m) , loader's kernel8.img (~24k) on sd card.

6. create bootboot directory on boot partition , copy archive file bootboot\initrd into.

7. place sd card raspberry pi 3 , plug-in power cord.

8. see elf or pe binary booted , running within blink of eye! reference, sample kernel show this on screen.

configuration

may want create configuration file bootboot\config, holds newline separated "key=value" pairs. c style comments allowed in it. can request specific screen resolution "screen=widthxheight". in lack of this, native resolution used. if choose tar or cpio archive, can specify name of executable "kernel=filename". mentioned before, without key first executable inside archive used. other keys unspecified , reserved kernel. configuration file mapped in memory, , accessible kernel 0 terminated utf-8 string.

kernel receive bootboot struct information (where's initrd, framebuffer dimension, memory map etc.).

troubleshooting

repository's readme.md has detailed description , nice troubleshooting section.

debugging

loader's code single c source file. on top, there different debug defines. set them , recompile make. debug messages outputted mini-uart (aux or uart1).

sample commands

have sd card reader @ /dev/sdc, change configuration accordingly.

code: select all

# fdisk /dev/sdc  welcome fdisk (util-linux 2.30.2). changes remain in memory only, until decide write them. careful before using write command.  device not contain recognized partition table. created new dos disklabel disk identifier 0xfa00b86e.  command (m help): g created new gpt disklabel (guid: e6b4945a-8308-448b-9aca-0e656854cf66).  command (m help): n p partition number (1-128, default 1): 1 first sector (2048-262110, default 2048):  last sector, +sectors or +size{k,m,g,t,p} (2048-262110, default 262110): +8m  created new partition 1 of type 'linux filesystem' , of size 8 mib.  command (m help): t 1 selected partition 1 partition type (type l list types): 1 changed type of partition 'linux filesystem' 'efi system'.  command (m help): w partition table has been altered. syncing disks. # mkfs.vfat -f 16 -n "efi system" /dev/sdc1 mkfs.fat 4.1 (2017-01-24) mkfs.fat: warning - lowercase labels might not work dos or windows # mkboot /dev/sdc mkboot: gpt esp mapped mbr # 
cheers,
bzt

dear all,

because had questions public domain, i've re-licensed loader under mit licence. i've changed copyright notice everywhere :-)

i've added support raspbootin, can load initial ramdisk image on serial computer running raspbootcom utility. i've provided slightly modified version, easier compile on linux, , handles payload file optional.

cheers,
bzt


raspberrypi



Comments

Popular posts from this blog

Error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode - Raspberry Pi Forums

class MPU6050 has no member named begin

missing filename after '-o'