Fix RPI boot by copying the first 8k of existing image

This commit is contained in:
Kienan Stewart 2021-12-19 21:17:33 -05:00
parent 192f4ecb6b
commit 830b0f4870
1 changed files with 7 additions and 7 deletions

View File

@ -2,17 +2,17 @@
dd if=/dev/zero of=build/rpi.img bs=1M count=4096 dd if=/dev/zero of=build/rpi.img bs=1M count=4096
# Copy the first 8k from the original rpi.img, which seems to have # Copy the first 8k from the original rpi.img, which seems to have
# non-zeroed content # non-zeroed content. Without this, the Pi doesn't seem to boot.
#dd if=rpi.img of=build/rpi.img bs=8192 count=1 conv=notrunc # It could be that there is the binary boot blob for the GPU
# in that section?
dd if=rpi.img of=build/rpi.img bs=8192 count=1 conv=notrunc
sudo losetup -Pf build/rpi.img sudo losetup -Pf build/rpi.img
# Partition: # Partition:
# start: 8192, size 256M typ W95 FAT32 # start: 8192, size 256M typ W95 FAT32
DEVICE=$(losetup -j build/rpi.img | cut -d ':' -f 1) DEVICE=$(losetup -j build/rpi.img | cut -d ':' -f 1)
mkfs.msdos "${DEVICE}" parted --script "${DEVICE}" \
sfdisk "${DEVICE}" <<EOF rm 2 \
8192,256M,c mkpart primary ext4 272629760B 4022337536B
,3.5G,83
EOF
mkfs.vfat "${DEVICE}p1" mkfs.vfat "${DEVICE}p1"
mkfs.ext4 "${DEVICE}p2" mkfs.ext4 "${DEVICE}p2"
TMP=$(mktemp -d) TMP=$(mktemp -d)