* [PATCH] mkefidisk.sh: Allow using a loopback mounted file
@ 2013-09-26 22:34 Jason Wessel
2013-09-26 22:45 ` Darren Hart
0 siblings, 1 reply; 3+ messages in thread
From: Jason Wessel @ 2013-09-26 22:34 UTC (permalink / raw)
To: Openembedded-core
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
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
scripts/contrib/mkefidisk.sh | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh
index af06b4b..224a146 100755
--- a/scripts/contrib/mkefidisk.sh
+++ b/scripts/contrib/mkefidisk.sh
@@ -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"
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mkefidisk.sh: Allow using a loopback mounted file
2013-09-26 22:34 [PATCH] mkefidisk.sh: Allow using a loopback mounted file Jason Wessel
@ 2013-09-26 22:45 ` Darren Hart
2013-09-26 22:59 ` Jason Wessel
0 siblings, 1 reply; 3+ messages in thread
From: Darren Hart @ 2013-09-26 22:45 UTC (permalink / raw)
To: Jason Wessel; +Cc: Openembedded-core
On Thu, 2013-09-26 at 17:34 -0500, Jason Wessel wrote:
> There is no reason not allow writing of direct boot disk images for
Nit: ^ to
> 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.
> 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
>
> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
> ---
> scripts/contrib/mkefidisk.sh | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh
> index af06b4b..224a146 100755
> --- a/scripts/contrib/mkefidisk.sh
> +++ b/scripts/contrib/mkefidisk.sh
> @@ -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
> 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"
--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mkefidisk.sh: Allow using a loopback mounted file
2013-09-26 22:45 ` Darren Hart
@ 2013-09-26 22:59 ` Jason Wessel
0 siblings, 0 replies; 3+ messages in thread
From: Jason Wessel @ 2013-09-26 22:59 UTC (permalink / raw)
To: Darren Hart; +Cc: Openembedded-core
On 09/26/2013 05:45 PM, Darren Hart wrote:
> On Thu, 2013-09-26 at 17:34 -0500, Jason Wessel wrote:
>> There is no reason not allow writing of direct boot disk images for
> Nit: ^ to
>
>> 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.
>
>> 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
>>
>> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
>> ---
>> scripts/contrib/mkefidisk.sh | 9 +++++++--
>> 1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh
>> index af06b4b..224a146 100755
>> --- a/scripts/contrib/mkefidisk.sh
>> +++ b/scripts/contrib/mkefidisk.sh
>> @@ -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?
Right you are. It worked by accident eh?
I'll send another patch.
Jason.
>
> --
> Darren
>
>> 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"
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-09-26 22:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-26 22:34 [PATCH] mkefidisk.sh: Allow using a loopback mounted file Jason Wessel
2013-09-26 22:45 ` Darren Hart
2013-09-26 22:59 ` Jason Wessel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox