From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from moutng.kundenserver.de ([212.227.126.186]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1SHZlr-0000TV-Ks for ptxdist@pengutronix.de; Tue, 10 Apr 2012 14:02:05 +0200 Message-ID: <4F842135.1050108@corscience.de> Date: Tue, 10 Apr 2012 14:01:57 +0200 From: =?ISO-8859-1?Q?Andreas_Bie=DFmann?= MIME-Version: 1.0 References: <1332763274-17969-1-git-send-email-bernhard@bwalle.de> <1332763274-17969-2-git-send-email-bernhard@bwalle.de> In-Reply-To: <1332763274-17969-2-git-send-email-bernhard@bwalle.de> Subject: Re: [ptxdist] [PATCH 2/2] Allow creation of bootable SD card for OMAP CPUs Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de Cc: Bernhard Walle , Bernhard Walle Hi, On 26.03.2012 14:01, Bernhard Walle wrote: > With the new option IMAGE_OMAPSD it's possible to create an image for > OMAP-bootable SD cards. Tested with a devkit8000 and a virtual beagle > board (qemu). > = > See the comment in platforms/image_omapsd.in for more information. > = > Signed-off-by: Bernhard Walle > --- > platforms/image_omapsd.in | 48 +++++++++++++ > rules/post/image_omapsd.make | 32 +++++++++ > scripts/genomapsdimg | 160 ++++++++++++++++++++++++++++++++++++= ++++++ > 3 files changed, 240 insertions(+) > create mode 100644 platforms/image_omapsd.in > create mode 100644 rules/post/image_omapsd.make > create mode 100755 scripts/genomapsdimg > = > diff --git a/scripts/genomapsdimg b/scripts/genomapsdimg > new file mode 100755 > index 0000000..9c87e45 > --- /dev/null > +++ b/scripts/genomapsdimg > @@ -0,0 +1,160 @@ > +#!/bin/bash > + > +# Creates a OMAP bootable SD card. > +# The image has a PC-style partition table with two partitions: > +# > +# 1) a FAT partition with MLO, bootloader and a Linux kernel > +# 2) a ext3 partition with the root file system. > +# > +# That's a bit tricky because the OMAP needs a special partition table > +# (therefore, genpart cannot be used). > +# > +# Parts of the script have been copied from 'debian-cd' (post-boot-armel= ). > + > +# exit on error > +set -e > + > +usage() { > +cat <<-EOF > + > +Usage: `basename "$0"` OPTIONS > + > + -h this help > + -m path to the MLO file (SPL) > + -b path to the bootloader > + -k path to the linux kernel > + -a additional file that should be included in the FAT p= artition > + (e.g. a FTD or an initramfs). Multiple files can be = specified > + using whitespace separation. Don't forget to quote. > + -f the (ext3) file system image for the second partition > + -o the output file that should be written > + > +EOF > +} > + > +file_length() > +{ > + stat -c %s "$1" > +} > + > +create_partitions() > +{ > + local boot_size=3D"$((72 * 1024 * 1024))" # 72 MB for the partition > + local image_size=3D"$(file_length "${FILESYSTEM}")" > + local img_size_blocks=3D"$(((${boot_size} + ${image_size} + 512 - 1) / = 512))" > + > + dd if=3D/dev/zero of=3D"${OUTPUT}" bs=3D512 count=3D0 seek=3D"${img_siz= e_blocks}" >/dev/null 2>&1 > + > + local trg_size=3D"$(file_length "${OUTPUT}")" > + local cylinders=3D$(echo ${trg_size}/255/63/512 | bc) avoid bc here, drop trg_size: local cylinders=3D$(( $(file_length "${OUTPUT}")/255/63/512 )) rest looks good to me beside already mentioned error handling for used tools (provide proper messages). best regards Andreas Bie=DFmann -- = ptxdist mailing list ptxdist@pengutronix.de