mkefidisk.sh: Allow using a loopback mounted file
PATCH 1/1 mkefidisk.sh: Allow using a loopback mounted file
There is no reason not allow writing of direct boot disk images for testing with simulators. The easy way is to add loop back writing capabilities.
Example:
qemu-img create -f raw bigdisk 4G
dev=sudo losetup -f
sudo losetup $dev bigdisk
mkefidisk.sh $dev tmp-eglibc/deploy/images/qemux86/core-image-minimal-qemux86.hddimg /dev/sda sudo losetup -d $dev
--- scripts/contrib/mkefidisk.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
scripts/contrib/mkefidisk.sh +7 -2
@@ -142,7 +142,7 @@ SWAP_START=$((ROOTFS_END)) # MMC devices use a partition prefix character 'p' PART_PREFIX="" -if [ ! "${DEVICE#/dev/mmcblk}" = "${DEVICE}" ]; then +if [ ! "${DEVICE#/dev/mmcblk}" = "${DEVICE}" ] || [ ! "${TARGET_DEVICE#/dev/loop}" = "${DEVICE}" ]; then PART_PREFIX="p" fi BOOTFS=$DEVICE${PART_PREFIX}1
@@ -197,7 +197,12 @@ unmount_device # echo "" echo "Formatting $BOOTFS as vfat..." -mkfs.vfat $BOOTFS -n "efi" +if [ ! "${DEVICE#/dev/loop}" = "${DEVICE}" ]; then + mkfs.vfat -I $BOOTFS -n "efi" +else + mkfs.vfat $BOOTFS -n "efi" + +fi echo "Formatting $ROOTFS as ext3..." mkfs.ext3 $ROOTFS -L "root"
Signature · 1 line
1.7.9.5
Quoted 1 line · Jason Wessel
There is no reason not allow writing of direct boot disk images for
Nit: ^ to
Quoted 2 lines
testing with simulators. The easy way is to add loop back writing capabilities.
Just note here that the /dev/loop device has the same partition prefix as mmc devices and requires special mkfs arguments.
Quoted 17 lines
Example:
qemu-img create -f raw bigdisk 4G
dev=sudo losetup -f
sudo losetup $dev bigdisk
mkefidisk.sh$dev tmp-eglibc/deploy/images/qemux86/core-image-minimal-qemux86.hddimg/dev/sdasudo losetup -d $devSigned-off-by Jason Wessel <[email protected]>--- scripts/contrib/mkefidisk.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)scripts/contrib/mkefidisk.sh +0
-0
scripts/contrib/mkefidisk.sh SWAP_START=$((ROOTFS_END)) · line 145
Quoted 5 lines
scripts/contrib/mkefidisk.sh +1
-1@@ -142,7 +142,7 @@ SWAP_START=$((ROOTFS_END)) # MMC devices use a partition prefix character 'p' PART_PREFIX="" -if [ ! "${DEVICE#/dev/mmcblk}" = "${DEVICE}" ]; then +if [ ! "${DEVICE#/dev/mmcblk}" = "${DEVICE}" ] || [ ! "${TARGET_DEVICE#/dev/loop}" = "${DEVICE}" ]; then
I think you meant to use "${DEVICE#/dev/loop}" here? Not TARGET_DEVICE?
--
Darren
Quoted 17 lines
scripts/contrib/mkefidisk.sh +6
-1PART_PREFIX="p" fi BOOTFS=$DEVICE${PART_PREFIX}1@@ -197,7 +197,12 @@ unmount_device # echo "" echo "Formatting $BOOTFS as vfat..." -mkfs.vfat $BOOTFS -n "efi" +if [ ! "${DEVICE#/dev/loop}" = "${DEVICE}" ]; then + mkfs.vfat -I $BOOTFS -n "efi" +else + mkfs.vfat $BOOTFS -n "efi" + +fi echo "Formatting $ROOTFS as ext3..." mkfs.ext3 $ROOTFS -L "root"
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel
Quoted 28 lines · Darren Hart
Quoted 1 line · Jason Wessel
There is no reason not allow writing of direct boot disk images for
Nit: ^ to
Quoted 2 lines
testing with simulators. The easy way is to add loop back writing capabilities.
Just note here that the
/dev/loopdevice has the same partition prefix as mmc devices and requires special mkfs arguments.Quoted 18 lines
Example:
qemu-img create -f raw bigdisk 4G
dev=sudo losetup -f
sudo losetup $dev bigdisk
mkefidisk.sh$dev tmp-eglibc/deploy/images/qemux86/core-image-minimal-qemux86.hddimg/dev/sdasudo losetup -d $devSigned-off-by Jason Wessel <[email protected]>--- scripts/contrib/mkefidisk.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)scripts/contrib/mkefidisk.sh +0
-0@@ -142,7 +142,7 @@ SWAP_START=$((ROOTFS_END))
Quoted 5 lines
scripts/contrib/mkefidisk.sh SWAP_START=$((ROOTFS_END)) · line 145
Quoted 4 lines
scripts/contrib/mkefidisk.sh +1
-1# MMC devices use a partition prefix character 'p' PART_PREFIX="" -if [ ! "${DEVICE#/dev/mmcblk}" = "${DEVICE}" ]; then +if [ ! "${DEVICE#/dev/mmcblk}" = "${DEVICE}" ] || [ ! "${TARGET_DEVICE#/dev/loop}" = "${DEVICE}" ]; thenI think you meant to use "${DEVICE#/dev/loop}" here? Not
TARGET_DEVICE?
Right you are. It worked by accident eh?
I'll send another patch.
Jason.
Quoted 21 lines
--
DarrenQuoted 17 lines
scripts/contrib/mkefidisk.sh +6
-1PART_PREFIX="p" fi BOOTFS=$DEVICE${PART_PREFIX}1@@ -197,7 +197,12 @@ unmount_device # echo "" echo "Formatting $BOOTFS as vfat..." -mkfs.vfat $BOOTFS -n "efi" +if [ ! "${DEVICE#/dev/loop}" = "${DEVICE}" ]; then + mkfs.vfat -I $BOOTFS -n "efi" +else + mkfs.vfat $BOOTFS -n "efi" + +fi echo "Formatting $ROOTFS as ext3..." mkfs.ext3 $ROOTFS -L "root"