[adding] qemu emulation layout to test images with qemu
This commit is contained in:
parent
496e41575e
commit
26fcf59f3f
|
@ -66,6 +66,10 @@ The following environment variables are supported:
|
||||||
|
|
||||||
Output directory for target system images and NOOBS bundles.
|
Output directory for target system images and NOOBS bundles.
|
||||||
|
|
||||||
|
* `USE_QEMU` (Default: `"0"`)
|
||||||
|
|
||||||
|
This enable the Qemu mode and set filesystem and image suffix if set to 1.
|
||||||
|
|
||||||
|
|
||||||
A simple example for building Raspbian:
|
A simple example for building Raspbian:
|
||||||
|
|
||||||
|
|
12
build.sh
12
build.sh
|
@ -119,6 +119,7 @@ if [ "$(id -u)" != "0" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -f config ]; then
|
if [ -f config ]; then
|
||||||
source config
|
source config
|
||||||
fi
|
fi
|
||||||
|
@ -128,6 +129,7 @@ if [ -z "${IMG_NAME}" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export USE_QEMU=${USE_QEMU:-0}
|
||||||
export IMG_DATE=${IMG_DATE:-"$(date +%Y-%m-%d)"}
|
export IMG_DATE=${IMG_DATE:-"$(date +%Y-%m-%d)"}
|
||||||
|
|
||||||
export BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
export BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
@ -177,10 +179,12 @@ for EXPORT_DIR in ${EXPORT_DIRS}; do
|
||||||
source "${EXPORT_DIR}/EXPORT_IMAGE"
|
source "${EXPORT_DIR}/EXPORT_IMAGE"
|
||||||
EXPORT_ROOTFS_DIR=${WORK_DIR}/$(basename ${EXPORT_DIR})/rootfs
|
EXPORT_ROOTFS_DIR=${WORK_DIR}/$(basename ${EXPORT_DIR})/rootfs
|
||||||
run_stage
|
run_stage
|
||||||
if [ -e ${EXPORT_DIR}/EXPORT_NOOBS ]; then
|
if [ "${USE_QEMU}" != "1" ]; then
|
||||||
source ${EXPORT_DIR}/EXPORT_NOOBS
|
if [ -e ${EXPORT_DIR}/EXPORT_NOOBS ]; then
|
||||||
STAGE_DIR=${BASE_DIR}/export-noobs
|
source ${EXPORT_DIR}/EXPORT_NOOBS
|
||||||
run_stage
|
STAGE_DIR=${BASE_DIR}/export-noobs
|
||||||
|
run_stage
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,10 @@ fi
|
||||||
rm -f ${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache
|
rm -f ${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache
|
||||||
rm -f ${ROOTFS_DIR}/usr/sbin/policy-rc.d
|
rm -f ${ROOTFS_DIR}/usr/sbin/policy-rc.d
|
||||||
rm -f ${ROOTFS_DIR}/usr/bin/qemu-arm-static
|
rm -f ${ROOTFS_DIR}/usr/bin/qemu-arm-static
|
||||||
if [ -e ${ROOTFS_DIR}/etc/ld.so.preload.disabled ]; then
|
if [ "${USE_QEMU}" != "1" ]; then
|
||||||
mv ${ROOTFS_DIR}/etc/ld.so.preload.disabled ${ROOTFS_DIR}/etc/ld.so.preload
|
if [ -e ${ROOTFS_DIR}/etc/ld.so.preload.disabled ]; then
|
||||||
|
mv ${ROOTFS_DIR}/etc/ld.so.preload.disabled ${ROOTFS_DIR}/etc/ld.so.preload
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f ${ROOTFS_DIR}/etc/apt/sources.list~
|
rm -f ${ROOTFS_DIR}/etc/apt/sources.list~
|
||||||
|
|
|
@ -17,8 +17,28 @@ systemctl disable nfs-common
|
||||||
systemctl disable rpcbind
|
systemctl disable rpcbind
|
||||||
systemctl disable ssh
|
systemctl disable ssh
|
||||||
systemctl enable regenerate_ssh_host_keys
|
systemctl enable regenerate_ssh_host_keys
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "${USE_QEMU}" = "1" ]; then
|
||||||
|
echo "enter QEMU mode"
|
||||||
|
install -m 644 files/90-qemu.rules ${ROOTFS_DIR}/etc/udev/rules.d/
|
||||||
|
if [ -e ${ROOTFS_DIR}/etc/ld.so.preload.disabled ]; then
|
||||||
|
rm ${ROOTFS_DIR}/etc/ld.so.preload.disabled
|
||||||
|
touch ${ROOTFS_DIR}/etc/ld.so.preload.disabled
|
||||||
|
fi
|
||||||
|
if [ -e ${ROOTFS_DIR}/etc/ld.so.preload ]; then
|
||||||
|
rm ${ROOTFS_DIR}/etc/ld.so.preload
|
||||||
|
touch ${ROOTFS_DIR}/etc/ld.so.preload
|
||||||
|
fi
|
||||||
|
on_chroot << EOF
|
||||||
|
systemctl disable resize2fs_once
|
||||||
|
EOF
|
||||||
|
echo "leaving QEMU mode"
|
||||||
|
else
|
||||||
|
on_chroot << EOF
|
||||||
systemctl enable resize2fs_once
|
systemctl enable resize2fs_once
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
on_chroot << \EOF
|
on_chroot << \EOF
|
||||||
for GRP in input spi i2c gpio; do
|
for GRP in input spi i2c gpio; do
|
||||||
|
|
3
stage2/01-sys-tweaks/files/90-qemu.rules
Normal file
3
stage2/01-sys-tweaks/files/90-qemu.rules
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
KERNEL=="sda", SYMLINK+="mmcblk0"
|
||||||
|
KERNEL=="sda?", SYMLINK+="mmcblk0p%n"
|
||||||
|
KERNEL=="sda2", SYMLINK+="root"
|
|
@ -1 +1,4 @@
|
||||||
IMG_SUFFIX="-lite"
|
IMG_SUFFIX="-lite"
|
||||||
|
if [ "${USE_QEMU}" = "1" ]; then
|
||||||
|
export IMG_SUFFIX="${IMG_SUFFIX}-qemu"
|
||||||
|
fi
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
IMG_SUFFIX="-4GB"
|
IMG_SUFFIX="-4GB"
|
||||||
|
if [ "${USE_QEMU}" = "1" ]; then
|
||||||
|
export IMG_SUFFIX="${IMG_SUFFIX}-qemu"
|
||||||
|
fi
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
IMG_SUFFIX=""
|
IMG_SUFFIX=""
|
||||||
|
if [ "${USE_QEMU}" = "1" ]; then
|
||||||
|
export IMG_SUFFIX="${IMG_SUFFIX}-qemu"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user