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
# Copy the first 8k from the original rpi.img, which seems to have
# non-zeroed content
#dd if=rpi.img of=build/rpi.img bs=8192 count=1 conv=notrunc
# non-zeroed content. Without this, the Pi doesn't seem to boot.
# 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
# Partition:
# start: 8192, size 256M typ W95 FAT32
DEVICE=$(losetup -j build/rpi.img | cut -d ':' -f 1)
mkfs.msdos "${DEVICE}"
sfdisk "${DEVICE}" <<EOF
8192,256M,c
,3.5G,83
EOF
parted --script "${DEVICE}" \
rm 2 \
mkpart primary ext4 272629760B 4022337536B
mkfs.vfat "${DEVICE}p1"
mkfs.ext4 "${DEVICE}p2"
TMP=$(mktemp -d)