-
-
Save bilson/5dcd925949627ebf7b6d253bea41196d to your computer and use it in GitHub Desktop.
Chroot to pi sd card
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # mount partition | |
| mount -o rw ${1}2 /mnt/raspbian | |
| mount -o rw ${1}1 /mnt/raspbian/boot | |
| # mount binds | |
| mount --bind /dev /mnt/raspbian/dev/ | |
| mount --bind /sys /mnt/raspbian/sys/ | |
| mount --bind /proc /mnt/raspbian/proc/ | |
| mount --bind /dev/pts /mnt/raspbian/dev/pts | |
| # ld.so.preload fix | |
| sed -i 's/^/#/g' /mnt/raspbian/etc/ld.so.preload | |
| # copy qemu binary | |
| cp /usr/bin/qemu-arm-static /mnt/raspbian/usr/bin/ | |
| # chroot to raspbian | |
| chroot /mnt/raspbian /bin/bash | |
| # revert ld.so.preload fix | |
| sed -i 's/^#//g' /mnt/raspbian/etc/ld.so.preload | |
| # unmount everything | |
| umount /mnt/raspbian/{dev/pts,dev,sys,proc,boot,} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment