mirror of https://github.com/CIRCL/Circlean
testing scripts
parent
cecc2d8ce9
commit
bf17516386
|
@ -27,15 +27,16 @@ for f in $FS; do
|
|||
parted -s ${OUT_NAME_PART} mkpart primary 8192s 122879s
|
||||
parted -s ${OUT_NAME_PART} mkpart primary 122880s 201599s
|
||||
parted -s ${OUT_NAME_NORM} mkpart primary 8192s 201599s
|
||||
losetup -o$((8192 * 512)) /dev/loop0 ${OUT_NAME_PART}
|
||||
losetup -o$((122880 * 512)) /dev/loop1 ${OUT_NAME_PART}
|
||||
losetup -o$((8192 * 512)) /dev/loop2 ${OUT_NAME_NORM}
|
||||
mkfs.${f} /dev/loop0 57344
|
||||
mkfs.${f} /dev/loop1 39360
|
||||
mkfs.${f} /dev/loop2
|
||||
losetup -d /dev/loop0
|
||||
losetup -d /dev/loop1
|
||||
losetup -d /dev/loop2
|
||||
lo=`losetup -f`
|
||||
losetup -o$((8192 * 512)) ${lo} ${OUT_NAME_PART}
|
||||
mkfs.${f} ${lo} 57344
|
||||
losetup -d ${lo}
|
||||
losetup -o$((122880 * 512)) ${lo} ${OUT_NAME_PART}
|
||||
mkfs.${f} ${lo} 39360
|
||||
losetup -d ${lo}
|
||||
losetup -o$((8192 * 512)) ${lo} ${OUT_NAME_NORM}
|
||||
mkfs.${f} ${lo}
|
||||
losetup -d ${lo}
|
||||
elif [ $f = ${FS_NTFS} ]; then
|
||||
mk${f} -f -F ${OUT_NAME}
|
||||
else
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
#!/bin/bash
|
||||
|
||||
# http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/
|
||||
|
||||
IMAGE='../old/2013-12-09_CIRCLean.img'
|
||||
OFFSET_ROOTFS=$((122880 * 512))
|
||||
|
||||
IMAGE_VFAT_NORM="testcase.vfat"
|
||||
OFFSET_VFAT_NORM=$((8192 * 512))
|
||||
|
||||
IMAGE_VFAT_PART="testcase.part.vfat"
|
||||
OFFSET_VFAT_PART1=$((8192 * 512))
|
||||
OFFSET_VFAT_PART2=$((122880 * 512))
|
||||
|
||||
IMAGE_DEST="testcase_dest.vfat"
|
||||
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo "This script must be run as root" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
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}
|
||||
}
|
||||
|
||||
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}
|
||||
|
||||
# Prepare the test source key
|
||||
mount -o loop,offset=${OFFSET_VFAT_NORM} ${IMAGE_VFAT_NORM} ${SETUP_DIR}
|
||||
cp content_img_vfat_norm/* ${SETUP_DIR}
|
||||
umount ${SETUP_DIR}
|
||||
# Prepare the test source key (with partitions)
|
||||
mount -o loop,offset=${OFFSET_VFAT_PART1} ${IMAGE_VFAT_PART} ${SETUP_DIR}
|
||||
cp content_img_vfat_part1/* ${SETUP_DIR}
|
||||
umount ${SETUP_DIR}
|
||||
mount -o loop,offset=${OFFSET_VFAT_PART2} ${IMAGE_VFAT_PART} ${SETUP_DIR}
|
||||
cp content_img_vfat_part2/* ${SETUP_DIR}
|
||||
umount ${SETUP_DIR}
|
||||
|
||||
|
||||
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb \
|
||||
-watchdog i6300esb -watchdog-action poweroff \
|
||||
-serial stdio -append "root=/dev/sdc2 panic=1 rootfstype=ext4 rw" \
|
||||
-drive file=${IMAGE_VFAT_NORM},index=0,media=disk \
|
||||
-drive file=${IMAGE_DEST},index=1,media=disk \
|
||||
-vnc 0.0.0.0:1 -drive file=${IMAGE},index=2,media=disk
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue