Status on 2020-03-30

Random notes

Raspberry PI 4 8G

* USB doesn't work with kernel 5.7 * Apparently, there's a fix in 5.8: https://lkml.org/lkml/2020/5/5/998

Other distros

Raspbian

Ubuntu

openSUSE

Debian

Upstream kernel

Boot methods

There are several ways to boot...

Directly load kernel and initramfs from RPI firmware

(That's what the Debian images currently do)

FIXME this doesn't work for the RPI4. I'm not sure why. Maybe because of one of the cmd line parameters passed to the kernel in that case?

RPI firmware loads u-boot, which loads kernel/initramfs

(That's what the Ubuntu images do, and is promising)

FIXME

# https://a-delacruz.github.io/ubuntu/rpi3-setup-64bit-uboot.html
# mkimage -A arm64 -O linux -T script -d boot.txt boot.scr
# vmlinuz and initrd must be converted. See https://linux-sunxi.org/Initial_Ramdisk or https://andrei.gherzan.ro/linux/uboot-on-rpi/
#   mkimage -A arm64 -T ramdisk -C none -n uInitrd -d initrd.img uInitrd
#   mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Linux kernel" -d vmlinuz uImage
#setenv bootargs earlyprintk console=ttyS0,115200 console=tty1 root=LABEL=writable rw
#fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs

RPI firmware loads u-boot, which loads grub using EFI, which loads kernel/initramfs

That's what OpenSUSE does. See https://www.suse.com/media/article/UEFI_on_Top_of_U-Boot.pdf

Network boot

Some info at http://lig-membres.imag.fr/duble/software/raspberry-pi-netboot/

Various technical tips

loop-mounting images

# fdisk -l 2020-02-13-raspbian-buster-lite.img
Disk 2020-02-13-raspbian-buster-lite.img: 1,7 GiB, 1849688064 bytes, 3612672 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x738a4d67

Device                               Boot  Start     End Sectors  Size Id Type
2020-02-13-raspbian-buster-lite.img1        8192  532479  524288  256M  c W95 FAT32 (LBA)
2020-02-13-raspbian-buster-lite.img2      532480 3612671 3080192  1,5G 83 Linux

# mount -o loop,offset=$((8192*512)) 2020-02-13-raspbian-buster-lite.img mountpoint

serial console

https://www.raspberrypi.org/documentation/usage/gpio/
Red: +5V.
Green: Tx.
White : Rx.
Black: GND.

=>
black on GND,
white on TXD (GPIO 14)
Green on RXD (GPIO 15)

add enable_uart=1 to /boot/config.txt

then screen /dev/ttyUSB0 115200

monitor DHCP traffic using tcpdump

tcpdump -i eth0 -pvn port 67 and port 68

Build a kernel

See BuildADebianKernelPackage

To disable DEBUG_INFO before build: scripts/config --disable DEBUG_INFO

https://stackoverflow.com/questions/7505164/how-do-you-non-interactively-turn-on-features-in-a-linux-kernel-config-file/39440863#39440863