aboutsummaryrefslogtreecommitdiffstats
path: root/export-image
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-07-17 04:02:01 +0200
committerSven Gothel <[email protected]>2021-07-17 04:02:01 +0200
commit2b4a8503024e3c83ac4ed7380bddc371c8982619 (patch)
tree8b5a15f7b1d053954113be2ac46f47ac4f3a0f5c /export-image
parent5b08e3535f61ab7dde7c7651382b2095e25bc717 (diff)
multi-arch: Support vanilla Debian for 'amd64' and 'i386' architecture incl. loop_rootfs using grub (WIP)
- Generic packages: nn-packages[-RELEASE] (using the optional '-RELEASE' variant) - System packages: nn-packages-sys-(raspi|debian)[-RELEASE] (using the optional '-RELEASE' variant), allow to distinguish not only for the RELEASE but the actual underlying distribution. - On debian amd64, all required usb-storage etc modules are loaded for loop_rootfs/initrd - loop_rootfs works on Raspi (Proprietary Bootloader) as well as on Debian (Grub Bootloader) - loop_rootfs uses the first vfat block-device partition for /boot - /boot will be mounted by loop_rootfs and handed over to new root-mount-point, this avoids issues of using an undefined /boot partition (but the first) - rotatelog_init_rootfs: Rotates /boot/init_rootfs.log if having more than 500 lines - FIX export-image: Copy the rootfs.img to the exported full image, which allows testing the image directly via qemu .. etc.
Diffstat (limited to 'export-image')
-rwxr-xr-xexport-image/04-finalise/01-run.sh35
1 files changed, 24 insertions, 11 deletions
diff --git a/export-image/04-finalise/01-run.sh b/export-image/04-finalise/01-run.sh
index 24b2728..c7ffea6 100755
--- a/export-image/04-finalise/01-run.sh
+++ b/export-image/04-finalise/01-run.sh
@@ -14,9 +14,9 @@ IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"
INFO_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.info"
IMG_FILE_ROOT_EXT4="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.root-ext4.img"
-IMG_FILE_ROOT_SQFS_GZ="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.root-sqfs_gz.img"
+#IMG_FILE_ROOT_SQFS_GZ="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.root-sqfs_gz.img"
IMG_FILE_ROOT_SQFS_LZO="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.root-sqfs_lzo.img"
-IMG_FILE_ROOT_SQFS_ZSTD="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.root-sqfs_zstd10.img"
+#IMG_FILE_ROOT_SQFS_ZSTD="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.root-sqfs_zstd10.img"
INFO_FILE_ROOT="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.root.info"
on_chroot << EOF
@@ -107,11 +107,28 @@ make_bootable_image "${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.qcow2" \
if [ "${ROOTFS_RO}" = "1" ] ; then
mount -o ro "$IMG_FILE_ROOT_EXT4" "${ROOTFS_DIR}"
- mksquashfs "${ROOTFS_DIR}" "${IMG_FILE_ROOT_SQFS_GZ}" -comp gzip
+ #mksquashfs "${ROOTFS_DIR}" "${IMG_FILE_ROOT_SQFS_GZ}" -comp gzip
mksquashfs "${ROOTFS_DIR}" "${IMG_FILE_ROOT_SQFS_LZO}" -comp lzo
- mksquashfs "${ROOTFS_DIR}" "${IMG_FILE_ROOT_SQFS_ZSTD}" -comp zstd -Xcompression-level 10
+ #mksquashfs "${ROOTFS_DIR}" "${IMG_FILE_ROOT_SQFS_ZSTD}" -comp zstd -Xcompression-level 10
umount "${ROOTFS_DIR}"
- cp -a "$INFO_FILE_ROOT" "${DEPLOY_DIR2}/sdcard${IMG_SUFFIX}/sys_arm64_000/rootfs.inf"
+ cp -a "$INFO_FILE_ROOT" "${DEPLOY_DIR2}/sdcard${IMG_SUFFIX}/sys_${TARGET_ARCH}_000/rootfs.inf"
+
+ # cp -a "$IMG_FILE_ROOT_EXT4" "${DEPLOY_DIR2}/sdcard${IMG_SUFFIX}/sys_${TARGET_ARCH}_000/rootfs.img"
+ cp -a "$IMG_FILE_ROOT_SQFS_LZO" "${DEPLOY_DIR2}/sdcard${IMG_SUFFIX}/sys_${TARGET_ARCH}_000/rootfs.img"
+ # cp -a "$IMG_FILE_ROOT_SQFS_ZSTD" "${DEPLOY_DIR2}/sdcard${IMG_SUFFIX}/sys_${TARGET_ARCH}_000/rootfs.img"
+
+ echo "Mount image ${IMG_FILE}"
+ MOUNTROOT=${STAGE_WORK_DIR}/tmpimage
+ mkdir -p $MOUNTROOT
+ mount_rawimage "${IMG_FILE}" $MOUNTROOT
+ if [ ! -d "${MOUNTROOT}/root" ]; then
+ echo "Image damaged or not mounted. Exit."
+ exit 1
+ fi
+ cp "$IMG_FILE_ROOT_SQFS_LZO" "${MOUNTROOT}/boot/sys_${TARGET_ARCH}_000/rootfs.img"
+ echo "Umount image ${IMG_FILE}"
+ sync
+ umount_image $MOUNTROOT
fi
mv "$INFO_FILE" "$INFO_FILE_ROOT" "$DEPLOY_DIR2/"
@@ -127,16 +144,12 @@ fi
mv "$IMG_FILE" "$DEPLOY_DIR2/"
if [ "${ROOTFS_RO}" = "1" ] ; then
- # cp -a "$IMG_FILE_ROOT_EXT4" "${DEPLOY_DIR2}/sdcard${IMG_SUFFIX}/sys_arm64_000/rootfs.img"
- cp -a "$IMG_FILE_ROOT_SQFS_LZO" "${DEPLOY_DIR2}/sdcard${IMG_SUFFIX}/sys_arm64_000/rootfs.img"
- # cp -a "$IMG_FILE_ROOT_SQFS_ZSTD" "${DEPLOY_DIR2}/sdcard${IMG_SUFFIX}/sys_arm64_000/rootfs.img"
-
( cd "${DEPLOY_DIR2}/sdcard${IMG_SUFFIX}"; zip -r0 "../${IMG_FILENAME}${IMG_SUFFIX}.sdcard.zip" . )
mv "$IMG_FILE_ROOT_EXT4" "$DEPLOY_DIR2/"
- mv "$IMG_FILE_ROOT_SQFS_GZ" "$DEPLOY_DIR2/"
+ #mv "$IMG_FILE_ROOT_SQFS_GZ" "$DEPLOY_DIR2/"
mv "$IMG_FILE_ROOT_SQFS_LZO" "$DEPLOY_DIR2/"
- mv "$IMG_FILE_ROOT_SQFS_ZSTD" "$DEPLOY_DIR2/"
+ #mv "$IMG_FILE_ROOT_SQFS_ZSTD" "$DEPLOY_DIR2/"
fi
rm -f "${STAGE_WORK_DIR}/SHA256SUMS"