mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "Andreas Bießmann" <biessmann@corscience.de>
To: ptxdist@pengutronix.de
Cc: Bernhard Walle <bernhard@bwalle.de>,
	Bernhard Walle <walle@corscience.de>
Subject: Re: [ptxdist] [PATCH 2/2] Allow creation of bootable SD card for OMAP CPUs
Date: Tue, 10 Apr 2012 14:01:57 +0200	[thread overview]
Message-ID: <4F842135.1050108@corscience.de> (raw)
In-Reply-To: <1332763274-17969-2-git-send-email-bernhard@bwalle.de>

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 <walle@corscience.de>
> ---
>  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
> 

<snip>

> 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 <mlo>        path to the MLO file (SPL)
> +    -b <bootloader> path to the bootloader
> +    -k <kernel>     path to the linux kernel
> +    -a <file>       additional file that should be included in the FAT partition
> +                    (e.g. a FTD or an initramfs). Multiple files can be specified
> +                    using whitespace separation. Don't forget to quote.
> +    -f <filesystem> the (ext3) file system image for the second partition
> +    -o <output>     the output file that should be written
> +
> +EOF
> +}
> +
> +file_length()
> +{
> +	stat -c %s "$1"
> +}
> +
> +create_partitions()
> +{
> +	local boot_size="$((72 * 1024 * 1024))" # 72 MB for the partition
> +	local image_size="$(file_length "${FILESYSTEM}")"
> +	local img_size_blocks="$(((${boot_size} + ${image_size} + 512 - 1) / 512))"
> +
> +	dd if=/dev/zero of="${OUTPUT}" bs=512 count=0 seek="${img_size_blocks}" >/dev/null 2>&1
> +
> +	local trg_size="$(file_length "${OUTPUT}")"
> +	local cylinders=$(echo ${trg_size}/255/63/512 | bc)

avoid bc here, drop trg_size:

local cylinders=$(( $(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ßmann

-- 
ptxdist mailing list
ptxdist@pengutronix.de

  parent reply	other threads:[~2012-04-10 12:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26 12:01 [ptxdist] [PATCH 1/2] Add host-parted Bernhard Walle
2012-03-26 12:01 ` [ptxdist] [PATCH 2/2] Allow creation of bootable SD card for OMAP CPUs Bernhard Walle
2012-04-10 11:32   ` Andreas Bießmann
2012-04-10 12:49     ` Bernhard Walle
2012-04-10 12:01   ` Andreas Bießmann [this message]
2012-04-10 12:54     ` Bernhard Walle
2012-04-10 15:03       ` [ptxdist] [PATCH v2 1/2] Add host-parted Bernhard Walle
2012-04-10 15:03         ` [ptxdist] [PATCH v2 2/2] Allow creation of bootable SD card for OMAP CPUs Bernhard Walle
2012-04-10 15:25           ` Bernhard Walle
2012-04-10 15:26       ` [ptxdist] [PATCH v3 1/2] Add host-parted Bernhard Walle
2012-04-10 15:26         ` [ptxdist] [PATCH v3 2/2] Allow creation of bootable SD card for OMAP CPUs Bernhard Walle
2012-03-27 14:22 ` [ptxdist] [PATCH 1/2] Add host-parted Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F842135.1050108@corscience.de \
    --to=biessmann@corscience.de \
    --cc=bernhard@bwalle.de \
    --cc=ptxdist@pengutronix.de \
    --cc=walle@corscience.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox