I have:
- A Raspberry Pi 4
- A broken µSD card
- Backups of the
/and/bootfilesystems - A new µSD card
I want:
- A bootable µSD card with a restore of my backup
/boot seems to be the first partition and contains a kernel image and a bunch of other stuff which I guess is to do with the boot chain.
Also an issue.txt mentioning pi-gen.
These come from 03-set-partuuid/00-run.sh which picks them out of the raw image.
It takes 4 bytes at offset 440 (0x01B8), which Master boot record documents as a 32-bit disk signature.
The resulting 8-digit hex value need to be patched into /etc/fstab and /boot/cmdline.txt.
This is done in export-image/prerun.sh:
- The disk uses MBR partitioning
/bootand/are aligned on 4MB boundaries, and are both primary partitions./bootis 256MB FAT32, nameboot/is ext4 and has features^huge_file,metadata_csum,64bit.
As far as I can see neither are marked bootable.
- Use your favorite tool to to create partitions. I had to manually patch in a disk signature.
DEV=/dev/sdXmkdosfs -n boot -F 32 -v ${DEV}1mkfs.ext4 -L rootfs -O '^huge_file,metadata_csum,64bit' ${DEV}2mount ${DEV}2 /mntcp -a /path/to/root/. /mnt/.mount ${DEV}1 /mnt/bootcp -a /path/to/boot/. /mnt/boot/.dd status=none if=/dev/sde skip=440 bs=1 count=4 | xxd -e |cut -f 2 -d' 'to find the disk signatureemacs /mnt/boot/cmdline.txt /mnt/etc/fstaband adjust the UUIDsumount /mnt/bootumount /mnt