mirror of https://github.com/CIRCL/Circlean
add a bunch of script to boot the rpi in qemu, and get a root shell
parent
66133808a8
commit
e5cd809325
|
@ -1,2 +1,8 @@
|
|||
filesystem/opt/groomer/pdfbox-app-*.jar
|
||||
filesystem/etc
|
||||
tests/content*
|
||||
tests/*vfat
|
||||
deb/
|
||||
|
||||
*img
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Path to the mounted image needed."
|
||||
exit
|
||||
fi
|
||||
|
||||
CHROOT_PATH=${1}
|
||||
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo "This script must be run as root" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# prepare fs archive
|
||||
tar -cvpzf backup.tar.gz -C fs_shell/ .
|
||||
tar -xzf backup.tar.gz -C ${CHROOT_PATH}/
|
|
@ -0,0 +1,5 @@
|
|||
proc /proc proc defaults 0 0
|
||||
/dev/mmcblk0p1 /boot vfat rw,defaults 0 0
|
||||
/dev/mmcblk0p2 / ext4 rw,defaults,noatime 0 0
|
||||
tmpfs /tmp tmpfs rw,size=64M,noexec,nodev,nosuid,mode=1777 0 0
|
||||
# a swapfile is not a swap partition, so no using swapon|off from here on, use dphys-swapfile swap[on|off] for that
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cleanup(){
|
||||
apt-get autoremove -y
|
||||
apt-get autoclean -y
|
||||
apt-get clean -y
|
||||
|
||||
/sbin/shutdown -h now
|
||||
}
|
||||
|
||||
|
||||
trap TERM EXIT
|
||||
|
||||
apt-get update -y
|
||||
apt-get dist-upgrade
|
||||
|
||||
|
||||
/bin/bash
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
|
||||
# http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/
|
||||
|
||||
IMAGE='2014-01-07-wheezy-raspbian.img'
|
||||
OFFSET_ROOTFS=$((122880 * 512))
|
||||
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo "This script must be run as root" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
./mount_image.sh ./copy_force_shell.sh
|
||||
|
||||
SETUP_DIR="setup"
|
||||
|
||||
clean(){
|
||||
mount -o loop,offset=${OFFSET_ROOTFS} ${IMAGE} ${SETUP_DIR}
|
||||
mv ${SETUP_DIR}/etc/ld.so.preload_bkp ${SETUP_DIR}/etc/ld.so.preload
|
||||
umount ${SETUP_DIR}
|
||||
rm -rf ${SETUP_DIR}
|
||||
./mount_image.sh ./copy_to_final.sh
|
||||
}
|
||||
|
||||
trap clean EXIT TERM INT
|
||||
|
||||
mkdir -p ${SETUP_DIR}
|
||||
|
||||
# make the CIRCLean image compatible with qemu
|
||||
mount -o loop,offset=${OFFSET_ROOTFS} ${IMAGE} ${SETUP_DIR}
|
||||
mv ${SETUP_DIR}/etc/ld.so.preload ${SETUP_DIR}/etc/ld.so.preload_bkp
|
||||
umount ${SETUP_DIR}
|
||||
|
||||
qemu-system-arm -kernel tests/kernel-qemu -cpu arm1176 -m 256 -M versatilepb \
|
||||
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw console=ttyAMA0 console=ttyS0" \
|
||||
-drive file=${IMAGE},index=0,media=disk \
|
||||
-nographic
|
||||
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
set -e
|
||||
|
||||
./update_scripts.sh
|
||||
./mount_image.sh ./copy_to_final.sh
|
||||
|
||||
pushd tests/
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
./mount_image.sh ./copy_to_final.sh
|
Loading…
Reference in New Issue