diff mbox

[v2] board/freescale: switch create-boot-sd.sh to parted

Message ID 1445417826-9634-1-git-send-email-vincent.stehle@freescale.com
State Changes Requested
Headers show

Commit Message

Vincent Stehlé Oct. 21, 2015, 8:57 a.m. UTC
Starting with version 2.26, sfdisk defaults to a unit of 512 B sectors.
With those recent versions of sfdisk, the create-boot-sd.sh script ends
up creating a boot partition of 240 KB, which is too small to contain a
Linux kernel.

As it is difficult to address both pre and post v2.26 sfdisk versions in
a single command, we change the create-boot-sd.sh script to use parted
instead. While at it, we set the boot partition size to 64 MB, which
should be enough for everyone.

Signed-off-by: Vincent Stehlé <vincent.stehle@freescale.com>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Gary Bisson <gary.bisson@boundarydevices.com>

---


Hi,

This is a second proposal, using parted this time. Even with sfdisk
`--unit' parameter, I could not find an eleguant solution to support all
versions of sfdisk, sorry. Please let me know if you find switching to
parted acceptable.

This is tested on Sabre AI with an i.MX6 Quad.

Best regards,

V.


Changes in v2
-------------
- Switch to parted, as advised by Gary.
- Fix spelling in commit message, spotted by Luca.


 board/freescale/create-boot-sd.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Baruch Siach Oct. 21, 2015, 9:14 a.m. UTC | #1
Hi Vincent,

On Wed, Oct 21, 2015 at 10:57:06AM +0200, Vincent Stehlé wrote:
> Starting with version 2.26, sfdisk defaults to a unit of 512 B sectors.
> With those recent versions of sfdisk, the create-boot-sd.sh script ends
> up creating a boot partition of 240 KB, which is too small to contain a
> Linux kernel.
> 
> As it is difficult to address both pre and post v2.26 sfdisk versions in
> a single command, we change the create-boot-sd.sh script to use parted
> instead. While at it, we set the boot partition size to 64 MB, which
> should be enough for everyone.

You should mention in the relevant readme.txt files under board/freescale/ 
that parted needs to be installed on the host.

Alternatively, you can enable host-parted in the config files, and use that in 
create-boot-sd.sh.

> Signed-off-by: Vincent Stehlé <vincent.stehle@freescale.com>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
> Cc: Gary Bisson <gary.bisson@boundarydevices.com>

baruch
Arnout Vandecappelle Oct. 21, 2015, 6:37 p.m. UTC | #2
On 21-10-15 10:57, Vincent Stehlé wrote:
> Starting with version 2.26, sfdisk defaults to a unit of 512 B sectors.
> With those recent versions of sfdisk, the create-boot-sd.sh script ends
> up creating a boot partition of 240 KB, which is too small to contain a
> Linux kernel.
> 
> As it is difficult to address both pre and post v2.26 sfdisk versions in
> a single command, we change the create-boot-sd.sh script to use parted
> instead. While at it, we set the boot partition size to 64 MB, which
> should be enough for everyone.
> 
> Signed-off-by: Vincent Stehlé <vincent.stehle@freescale.com>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
> Cc: Gary Bisson <gary.bisson@boundarydevices.com>
> 
> ---
> 
> 
> Hi,
> 
> This is a second proposal, using parted this time. Even with sfdisk
> `--unit' parameter, I could not find an eleguant solution to support all
> versions of sfdisk, sorry. Please let me know if you find switching to
> parted acceptable.

 I really don't like that we would rely on a tool installed on the host.

 Is there any reason why genimage (cfr. wandboard) wouldn't work, like I
suggested earlier?

 Regards,
 Arnout

> 
> This is tested on Sabre AI with an i.MX6 Quad.
> 
> Best regards,
> 
> V.
> 
> 
> Changes in v2
> -------------
> - Switch to parted, as advised by Gary.
> - Fix spelling in commit message, spotted by Luca.
> 
> 
>  board/freescale/create-boot-sd.sh | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/board/freescale/create-boot-sd.sh b/board/freescale/create-boot-sd.sh
> index af45115..d80bd52 100755
> --- a/board/freescale/create-boot-sd.sh
> +++ b/board/freescale/create-boot-sd.sh
> @@ -59,10 +59,12 @@ sync
>  # - 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
> +parted --script "${DEV}" \
> +       mklabel msdos \
> +       unit MiB \
> +       mkpart primary fat16 1 64 \
> +       mkpart primary ext2 64 100% \
> +       print
>  
>  sync
>  
>
Vincent Stehlé Oct. 22, 2015, 10:08 a.m. UTC | #3
On 10/21/2015 08:37 PM, Arnout Vandecappelle wrote:
..
>  Is there any reason why genimage (cfr. wandboard) wouldn't work, like I
> suggested earlier?

Hi Arnout,

You are right, genimage seems like a nice solution. In fact I think I
prefer this SD card image generation approach over the direct SD card
modification method.

Thank you for this suggestion.

Best regards,

V.
diff mbox

Patch

diff --git a/board/freescale/create-boot-sd.sh b/board/freescale/create-boot-sd.sh
index af45115..d80bd52 100755
--- a/board/freescale/create-boot-sd.sh
+++ b/board/freescale/create-boot-sd.sh
@@ -59,10 +59,12 @@  sync
 # - 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
+parted --script "${DEV}" \
+       mklabel msdos \
+       unit MiB \
+       mkpart primary fat16 1 64 \
+       mkpart primary ext2 64 100% \
+       print
 
 sync