mirror of https://github.com/CIRCL/Circlean
update chroot script, use the image directly
parent
8dda6d7d97
commit
e7dc87023a
|
@ -3,13 +3,21 @@
|
||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
PARTITION='/dev/mmcblk0p2'
|
|
||||||
|
# If you use a partition...
|
||||||
|
PARTITION_ROOTFS='/dev/mmcblk0p2'
|
||||||
|
PARTITION_BOOT='/dev/mmcblk0p1'
|
||||||
|
# If you use the img
|
||||||
|
IMAGE='2013-02-09-wheezy-raspbian.img'
|
||||||
|
OFFSET_ROOTFS=$((122880 * 512))
|
||||||
|
OFFSET_BOOT=$((8192 * 512))
|
||||||
|
|
||||||
CHROOT_PATH='/mnt/arm_rPi'
|
CHROOT_PATH='/mnt/arm_rPi'
|
||||||
|
|
||||||
clean(){
|
clean(){
|
||||||
mv ${CHROOT_PATH}/etc/ld.so.preload_bkp ${CHROOT_PATH}/etc/ld.so.preload
|
mv ${CHROOT_PATH}/etc/ld.so.preload_bkp ${CHROOT_PATH}/etc/ld.so.preload
|
||||||
rm ${CHROOT_PATH}/etc/resolv.conf
|
rm ${CHROOT_PATH}/etc/resolv.conf
|
||||||
rm ${CHROOT_PATH}/usr/bin/qemu-static-arm*
|
rm ${CHROOT_PATH}/usr/bin/qemu*arm*
|
||||||
|
|
||||||
umount ${CHROOT_PATH}/dev/pts
|
umount ${CHROOT_PATH}/dev/pts
|
||||||
umount ${CHROOT_PATH}/dev/shm
|
umount ${CHROOT_PATH}/dev/shm
|
||||||
|
@ -17,6 +25,7 @@ clean(){
|
||||||
umount ${CHROOT_PATH}/proc
|
umount ${CHROOT_PATH}/proc
|
||||||
umount ${CHROOT_PATH}/sys
|
umount ${CHROOT_PATH}/sys
|
||||||
umount ${CHROOT_PATH}/tmp
|
umount ${CHROOT_PATH}/tmp
|
||||||
|
umount ${CHROOT_PATH}/boot
|
||||||
umount ${CHROOT_PATH}
|
umount ${CHROOT_PATH}
|
||||||
|
|
||||||
rm -rf ${CHROOT_PATH}
|
rm -rf ${CHROOT_PATH}
|
||||||
|
@ -25,9 +34,20 @@ clean(){
|
||||||
trap clean EXIT TERM INT
|
trap clean EXIT TERM INT
|
||||||
|
|
||||||
mkdir -p ${CHROOT_PATH}
|
mkdir -p ${CHROOT_PATH}
|
||||||
mount ${PARTITION} ${CHROOT_PATH}
|
|
||||||
|
|
||||||
cp /usr/bin/qemu-static-arm* ${CHROOT_PATH}/usr/bin/
|
if [ -a ${IMAGE} ]; then
|
||||||
|
mount -o loop,offset=${OFFSET_ROOTFS} ${IMAGE} ${CHROOT_PATH}
|
||||||
|
mount -o loop,offset=${OFFSET_BOOT} ${IMAGE} ${CHROOT_PATH}/boot
|
||||||
|
elif [ -a ${PARTITION_ROOTFS} ]; then
|
||||||
|
mount ${PARTITION_ROOTFS} ${CHROOT_PATH}
|
||||||
|
mount ${PARTITION_BOOT} ${CHROOT_PATH}/boot
|
||||||
|
else
|
||||||
|
print 'You need a SD card or an image'
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
cp /usr/bin/qemu*arm* ${CHROOT_PATH}/usr/bin/
|
||||||
|
|
||||||
mount -o bind /dev ${CHROOT_PATH}/dev
|
mount -o bind /dev ${CHROOT_PATH}/dev
|
||||||
mount -o bind /dev/pts ${CHROOT_PATH}/dev/pts
|
mount -o bind /dev/pts ${CHROOT_PATH}/dev/pts
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
dd if=/dev/zero bs=1024k count=2048 >> 2013-02-09-wheezy-raspbian.img
|
||||||
|
|
||||||
|
fdisk 2013-02-09-wheezy-raspbian.img
|
||||||
|
Command (m for help): m
|
||||||
|
Command action
|
||||||
|
a toggle a bootable flag
|
||||||
|
b edit bsd disklabel
|
||||||
|
c toggle the dos compatibility flag
|
||||||
|
d delete a partition
|
||||||
|
l list known partition types
|
||||||
|
m print this menu
|
||||||
|
n add a new partition
|
||||||
|
o create a new empty DOS partition table
|
||||||
|
p print the partition table
|
||||||
|
q quit without saving changes
|
||||||
|
s create a new empty Sun disklabel
|
||||||
|
t change a partition's system id
|
||||||
|
u change display/entry units
|
||||||
|
v verify the partition table
|
||||||
|
w write table to disk and exit
|
||||||
|
x extra functionality (experts only)
|
||||||
|
|
||||||
|
Command (m for help): p
|
||||||
|
|
||||||
|
Disk 2013-02-09-wheezy-raspbian.img: 4087 MB, 4087349248 bytes
|
||||||
|
255 heads, 63 sectors/track, 496 cylinders, total 7983104 sectors
|
||||||
|
Units = sectors of 1 * 512 = 512 bytes
|
||||||
|
Sector size (logical/physical): 512 bytes / 512 bytes
|
||||||
|
I/O size (minimum/optimal): 512 bytes / 512 bytes
|
||||||
|
Disk identifier: 0x00014d34
|
||||||
|
|
||||||
|
Device Boot Start End Blocks Id System
|
||||||
|
2013-02-09-wheezy-raspbian.img1 8192 122879 57344 c W95 FAT32 (LBA)
|
||||||
|
2013-02-09-wheezy-raspbian.img2 122880 3788799 1832960 83 Linux
|
||||||
|
|
||||||
|
Command (m for help): d
|
||||||
|
Partition number (1-4): 2
|
||||||
|
|
||||||
|
Command (m for help): n
|
||||||
|
Partition type:
|
||||||
|
p primary (1 primary, 0 extended, 3 free)
|
||||||
|
e extended
|
||||||
|
Select (default p): p
|
||||||
|
Partition number (1-4, default 2): 2
|
||||||
|
First sector (2048-7983103, default 2048): 122880
|
||||||
|
Last sector, +sectors or +size{K,M,G} (122880-7983103, default 7983103):
|
||||||
|
Using default value 7983103
|
||||||
|
|
||||||
|
Command (m for help): w
|
||||||
|
The partition table has been altered!
|
||||||
|
|
||||||
|
Syncing disks.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue