Skip to content

Instantly share code, notes, and snippets.

@micahyoung
Last active October 12, 2015 03:01
Show Gist options
  • Save micahyoung/fa335612e0f00de8b23d to your computer and use it in GitHub Desktop.
Save micahyoung/fa335612e0f00de8b23d to your computer and use it in GitHub Desktop.
Chroot update for RasPi for ArchLinux
  1. Mount the .img file
fdisk -lu ArchLinuxARM-rpi.img | grep -E "img1|img5"
# ArchLinuxARM-rpi.img1            2048      186367       92160    c  W95 FAT32 (LBA)
# ArchLinuxARM-rpi.img5          188416     3667967     1739776   83  Linux
echo "2048 * 512" | bc
# 1048576
echo "188416 * 512" | bc
# 96468992
losetup -o 96468992 /dev/loop0 ArchLinuxARM-rpi.img
losetup -o 1048576  /dev/loop1 ArchLinuxARM-rpi.img
mkdir /tmp/mnt
mount /dev/loop0 /tmp/mnt
mount /dev/loop1 /tmp/mnt/boot
  1. Chroot using qemu-user-static
mount -o bind /proc /tmp/mnt/proc
mount -o bind /dev /tmp/mnt/dev
cp /usr/bin/qemu-arm-static /tmp/mnt/usr/bin
chroot /tmp/mnt
  1. Cleanup
umount /tmp/mnt/{dev,proc,boot,}
losetup -d /dev/loop1
losetup -d /dev/loop0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment