From: Luca Ceresoli <luca@lucaceresoli.net>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 2/2] freescale/imx6-sabresd: document how to create a bootable SD
Date: Tue, 26 Aug 2014 09:50:30 +0200 [thread overview]
Message-ID: <53FC3C46.3020008@lucaceresoli.net> (raw)
In-Reply-To: <1408019813-17702-2-git-send-email-luca@lucaceresoli.net>
Hi,
I noticed a little annoyance with this version of the script when it
processes an SD that it had already processed before. This may happen
for example after the user has activated more target packages, rebuilt
and wants to recreate SD with the new root filesystem.
See below for a description of what happens.
Luca Ceresoli wrote:
> diff --git a/board/freescale/imx6sabresd/create-boot-sd.sh b/board/freescale/imx6sabresd/create-boot-sd.sh
> new file mode 100755
> index 0000000..f82f7b3
> --- /dev/null
> +++ b/board/freescale/imx6sabresd/create-boot-sd.sh
[...]
> +# Unmount the partitions if mounted
> +umount ${PART1} || true
> +umount ${PART2} || true
> +
> +# First, clear the card
> +dd if=/dev/zero of=${DEV} bs=1M count=2
This erases the first 2 MB of the SD, which include the partition table,
the bootloader and the beginning of the FAT partition. It does not
touch the ext2 partition.
> +
> +sync
> +
> +# Partition the card.
> +# SD layout for i.MX6 boot:
> +# - Bootloader at offset 1024
> +# - FAT partition starting at 1MB offset, containing uImage and *.dtb
> +# - ext2/3 partition formatted as ext2 or ext3, containing the root filesystem.
> +sfdisk ${DEV} <<EOF
> +32,480,b
> +512,,L
> +EOF
Here the host system detects the newly created partitions. Since the
ext2 has not been touched it contains valid data, and a
desktop-oriented automounter "might" want to mount it right away (mine
does of course).
Waiting some time and then umounting it just-in-case is an option, but I
preferred to just change the 'dd' command above to erase 20 MB, not 2,
so it also invalidates the ext2 partition.
I'll resubmit with this change.
--
Luca
next prev parent reply other threads:[~2014-08-26 7:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-14 12:36 [Buildroot] [PATCH v2 1/2] configs/freescale_imx6dlsabresd: add defconfig for iMX6DL SabreSD Luca Ceresoli
2014-08-14 12:36 ` [Buildroot] [PATCH v2 2/2] freescale/imx6-sabresd: document how to create a bootable SD Luca Ceresoli
2014-08-14 14:43 ` Vincent Stehlé
2014-08-26 7:50 ` Luca Ceresoli [this message]
2014-08-26 4:19 ` [Buildroot] [PATCH v2 1/2] configs/freescale_imx6dlsabresd: add defconfig for iMX6DL SabreSD Gary Bisson
2014-08-26 7:36 ` Luca Ceresoli
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=53FC3C46.3020008@lucaceresoli.net \
--to=luca@lucaceresoli.net \
--cc=buildroot@busybox.net \
/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