All of lore.kernel.org
 help / color / mirror / Atom feed
* RFC: mkzipimage.sh script
@ 2011-05-06 19:06 Darren Hart
  2011-05-06 20:24 ` Joshua Lock
  0 siblings, 1 reply; 2+ messages in thread
From: Darren Hart @ 2011-05-06 19:06 UTC (permalink / raw)
  To: poky

The process for creating the USBZIP format usb key images is tedious, so I threw
a script together. I suspect there might be demand for an integrated tool to do
this for the more onerous of the image making processes.

1) Any feedback on this particular script?
2) Should this go to scripts/contrib? 
3) Would an image burning tool (ala unetbootin) be of interest to 
   others?



#!/bin/bash

function usage {
	echo "Usage: $(basename $0) IMAGE DEVICE"
}

function check_device {
	if [ ! -b "$1" ] || [ ! -w "$1" ]; then
		echo "Error opening device '$1'."
		echo "Device should be a writable block device."
		exit 1
	fi
}

if [ $# -ne 2 ]; then
	usage
	exit 1
fi

IMAGE=$1
DEV=$2

if [ ! -f "$IMAGE" ]; then
	echo "Image '$IMAGE' does not exist."
	exit 1
fi

check_device $DEV

HS=$(fdisk -l $DEV | egrep ".*heads.*sectors.*cylinders")
HEADS=$(echo $HS | cut -d' ' -f1)
SECTORS=$(echo $HS | cut -d' ' -f3)

echo "Preparing $DEV, this may take several minutes."
mkdiskimage -4 $DEV 0 $HEADS $SECTORS
if [ $? -ne 0 ]; then
	echo "Error running mkdiskimage."
	exit 1
fi

echo -n "Remove and reinsert the device, then press Enter: "
read
echo -n "Enter the new device name [$DEV]: "
read NEWDEV
if [ -n "$NEWDEV" ]; then
	DEV=$NEWDEV
fi
check_device $DEV

echo -n "Mounting image and device..."
mkdir /tmp/image-$$
mount -o loop $IMAGE /tmp/image-$$
if [ $? -ne 0 ]; then
	echo -e "\nError mounting image."
	exit 1;
fi
mkdir /tmp/dev-$$
mount $DEV\4 /tmp/dev-$$
if [ $? -ne 0 ]; then
	echo -e "\nError mounting device."
	exit 1;
fi
echo "Done"

echo -n "Copying image..."
cp -rf /tmp/image-$$/* /tmp/dev-$$
sync
echo "Done"

echo -n "Installing syslinux..."
syslinux $DEV\4
echo "Done"

echo "Cleaning up..."
umount /tmp/image-$$
rmdir /tmp/image-$$
umount /tmp/dev-$$
rmdir /tmp/dev-$$
echo "Done"

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: RFC: mkzipimage.sh script
  2011-05-06 19:06 RFC: mkzipimage.sh script Darren Hart
@ 2011-05-06 20:24 ` Joshua Lock
  0 siblings, 0 replies; 2+ messages in thread
From: Joshua Lock @ 2011-05-06 20:24 UTC (permalink / raw)
  To: poky

On Fri, 2011-05-06 at 12:06 -0700, Darren Hart wrote:
> The process for creating the USBZIP format usb key images is tedious, so I threw
> a script together. I suspect there might be demand for an integrated tool to do
> this for the more onerous of the image making processes.
> 
> 1) Any feedback on this particular script?
> 2) Should this go to scripts/contrib? 
> 3) Would an image burning tool (ala unetbootin) be of interest to 
>    others?

I think so, it'd be nice to be able to integrate such a tool as a final
step in the image creator though it should definitely be as independent
as we can make it so that we can offer just the "burner" GUI to people
downloading pre-built images.

Cheers,
Joshua
-- 
Joshua Lock
        Yocto Build System Monkey
        Intel Open Source Technology Centre



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-06 20:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-06 19:06 RFC: mkzipimage.sh script Darren Hart
2011-05-06 20:24 ` Joshua Lock

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.