Skip to contentSkip to conversation

State of the art for creating an image that you can dd to an SD card

DISCUSSION Philip Balister 8 participants 21 messages Jun 24, 2014 – Jul 5, 2014

lore
Share & tools
lore
#0 lore raw

What's the best available solution for creating an image you can dd to an SD card? It seems like this wheel has been invented several times and I am wondering if people are converging on one approach.

Bonus points for resizing the linux partition.

How are people doing this today?

Philip

#1 lore raw
Quoted 3 lines · [[oe] State of the art for creating an image that you can dd to an SD card] On…

What's the best available solution for creating an image you can dd to an SD card? It seems like this wheel has been invented several times and I am wondering if people are converging on one approach.

I don't know about that, but I always resort to the same methodology a friend of mine used to call "stone axes and hammers" (that is, simple, basic tools that are efficient if not elegant).

dd if=/dev/zero of=rootfs.img bs=1M count=<however_many_meg_I_need> mke2fs -j rootfs.img
mount -o loop rootfs.img /mnt
tar -C /mnt -[jJz]xf <path_to_image>
umount /mnt

Quoted 1 line

Bonus points for resizing the linux partition.

Half marks for solving half the problem? :-)

dd if=/dev/zero >> rootfs.img
e2fsck -f junk.img
resize2fs rootfs.img

It would probably work to shrink it by doing something like resize2fs -M then doing a dd with if=junk.img of=smaller-junk.img, but I don't ever recall needing to shrink and image where I didn't just go create a smaller image and use something like pax or rsync to copy the data from one to the other.

Quoted 4 lines

How are people doing this today?

Philip

Signature · 2 lines
-Joe MacDonald.
:wq
#2 lore raw
In reply to Philip Balister
Quoted 7 lines · On Tuesday 24 June 2014 16:14:58 Philip Balister wrote:

What's the best available solution for creating an image you can dd to an SD card? It seems like this wheel has been invented several times and I am wondering if people are converging on one approach.

Bonus points for resizing the linux partition.

How are people doing this today?

I think wic has seen some uptake and enhancement since its introduction a couple of releases ago. It has certainly worked for me in writing SD cards for Galileo. We seem to be a bit short on documentation for it though...

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#3 lore raw
Quoted 5 lines · Paul Eggleton
Quoted 4 lines · On Tuesday 24 June 2014 16:14:58 Philip Balister wrote:

What's the best available solution for creating an image you can dd to an SD card? It seems like this wheel has been invented several times and I am wondering if people are converging on one approach.

Quoted 7 lines
Quoted 3 lines

Bonus points for resizing the linux partition.

How are people doing this today?

I think wic has seen some uptake and enhancement since its introduction a couple of releases ago. It has certainly worked for me in writing SD cards for Galileo. We seem to be a bit short on documentation for it though...

Googling for "wic sd" doesn't help. I've seen some commits, so I'll take a look in the meta data.

Philip

Quoted 4 lines

Cheers,
Paul

#4 lore raw
Quoted 8 lines · Philip Balister
Quoted 7 lines · Paul Eggleton
Quoted 6 lines · On Tuesday 24 June 2014 16:14:58 Philip Balister wrote:

What's the best available solution for creating an image you can dd to an SD card? It seems like this wheel has been invented several times and I am wondering if people are converging on one approach.

Bonus points for resizing the linux partition.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

How are people doing this today?

I think wic has seen some uptake and enhancement since its introduction a couple of releases ago. It has certainly worked for me in writing SD cards for Galileo. We seem to be a bit short on documentation for it though...

Googling for "wic sd" doesn't help. I've seen some commits, so I'll take a look in the meta data.

http://cgit.openembedded.org/openembedded-core/tree/scripts/wic

But indeed, better documentation would be most appreciated.

Signature · 1 line
Denys
#18 lore raw
In reply to Philip Balister
Quoted 10 lines · Philip Balister
Quoted 9 lines · Paul Eggleton
Quoted 7 lines · On Tuesday 24 June 2014 16:14:58 Philip Balister wrote:

What's the best available solution for creating an image you can dd to an SD card? It seems like this wheel has been invented several times and I am wondering if people are converging on one approach.

Bonus points for resizing the linux partition.

How are people doing this today?

Quoted 8 lines
Quoted 3 lines

I think wic has seen some uptake and enhancement since its introduction a couple of releases ago. It has certainly worked for me in writing SD cards for Galileo. We seem to be a bit short on documentation for it though...

Googling for "wic sd" doesn't help. I've seen some commits, so I'll take a look in the meta data.

Philip

I think he's talking about:
http://patchwork.openembedded.org/patch/59059/
https://bugzilla.yoctoproject.org/show_bug.cgi?id=3847

B

#5 lore raw
In reply to Denys Dmytriyenko

Hi Denys,

Quoted 3 lines · Denys Dmytriyenko

http://cgit.openembedded.org/openembedded-core/tree/scripts/wic

But indeed, better documentation would be most appreciated.

I didn't have a chance to take a look and test wic tool.
Do you know if it can be used to generate sdcard images for TI's Sitara SoCs?
The _problem_ for creating a sdcard image for Sitara is the configuration of Heads, Sectors and Cylinders that should be passed to sfdisk and needs to be done as root.

Regards,

--
*dS
Diego Sueiro

Administrador do Embarcados
www.embarcados.com.br
<http://www.embarcados.com.br/?utm_source=assinatura_diego&utm_medium=e-mail&utm_campaign=Assinatura%20Email%20Diego>

/*long live rock 'n roll*/

#6 lore raw
Quoted 9 lines · Diego Sueiro

Hi Denys,

Quoted 3 lines · Denys Dmytriyenko

http://cgit.openembedded.org/openembedded-core/tree/scripts/wic

But indeed, better documentation would be most appreciated.

Quoted 6 lines

I didn't have a chance to take a look and test wic tool.
Do you know if it can be used to generate sdcard images for TI's Sitara SoCs?
The _problem_ for creating a sdcard image for Sitara is the configuration of Heads, Sectors and Cylinders that should be passed to sfdisk and needs to be done as root.

This isn't true.

https://groups.google.com/forum/#!topic/beagleboard/ro5k5r4Cuq4

I've avoided the CHS business for ages and haven't had trouble booting.

Philip

Quoted 14 lines

Regards,

--
*dS
Diego Sueiro

Administrador do Embarcados
www.embarcados.com.br
<http://www.embarcados.com.br/?utm_source=assinatura_diego&utm_medium=e-mail&utm_campaign=Assinatura%20Email%20Diego>

/*long live rock 'n roll*/

#7 lore raw

Hi Philip,

Quoted 18 lines · Philip Balister
Quoted 3 lines · Diego Sueiro

Hi Denys,

On Wed, Jun 25, 2014 at 3:55 PM, Denys Dmytriyenko <[email protected]>

Quoted 6 lines · wrote:
Quoted 4 lines

http://cgit.openembedded.org/openembedded-core/tree/scripts/wic

But indeed, better documentation would be most appreciated.

Quoted 6 lines

I didn't have a chance to take a look and test wic tool.
Do you know if it can be used to generate sdcard images for TI's Sitara SoCs?
The _problem_ for creating a sdcard image for Sitara is the configuration of Heads, Sectors and Cylinders that should be passed to sfdisk and needs to be done as root.

Quoted 5 lines

This isn't true.

https://groups.google.com/forum/#!topic/beagleboard/ro5k5r4Cuq4

I've avoided the CHS business for ages and haven't had trouble booting

Thanks for the link.

About 3 yeas ago I have issues with this using an industrial 2GB uSD from Delkin Devices with am3517. And as far as I remember I just got it working with CHS configuration.

I'm going to test it again with a Sandisk uSD and am3359 to see if it remains. But I don't have a Delkin uSD and am3517 anymore :(

Regards,

--
*dS
Diego Sueiro

Administrador do Embarcados
www.embarcados.com.br
<http://www.embarcados.com.br/?utm_source=assinatura_diego&utm_medium=e-mail&utm_campaign=Assinatura%20Email%20Diego>

/*long live rock 'n roll*/

#19 lore raw
In reply to Brian Hutchinson
Quoted 15 lines · Brian Hutchinson
Quoted 14 lines · Philip Balister
Quoted 12 lines · Paul Eggleton
Quoted 7 lines · On Tuesday 24 June 2014 16:14:58 Philip Balister wrote:

What's the best available solution for creating an image you can dd to an SD card? It seems like this wheel has been invented several times and I am wondering if people are converging on one approach.

Bonus points for resizing the linux partition.

How are people doing this today?

I think wic has seen some uptake and enhancement since its introduction a couple of releases ago. It has certainly worked for me in writing SD cards for Galileo. We seem to be a bit short on documentation for it though...

Quoted 8 lines
Quoted 4 lines

Googling for "wic sd" doesn't help. I've seen some commits, so I'll take a look in the meta data.

Philip

I think he's talking about:
http://patchwork.openembedded.org/patch/59059/
https://bugzilla.yoctoproject.org/show_bug.cgi?id=3847

A lot of good info is hidden in those 2 obscure places! :) How about copying all that to a Wiki page for starters?

Signature · 1 line
Denys
#8 lore raw
In reply to Diego Sueiro
Quoted 30 lines · Diego Sueiro

Hi Philip,

Quoted 18 lines · Philip Balister
Quoted 3 lines · Diego Sueiro

Hi Denys,

On Wed, Jun 25, 2014 at 3:55 PM, Denys Dmytriyenko <[email protected]>

Quoted 6 lines · wrote:
Quoted 4 lines

http://cgit.openembedded.org/openembedded-core/tree/scripts/wic

But indeed, better documentation would be most appreciated.

Quoted 6 lines

I didn't have a chance to take a look and test wic tool.
Do you know if it can be used to generate sdcard images for TI's Sitara SoCs?
The _problem_ for creating a sdcard image for Sitara is the configuration of Heads, Sectors and Cylinders that should be passed to sfdisk and needs to be done as root.

Quoted 5 lines

This isn't true.

https://groups.google.com/forum/#!topic/beagleboard/ro5k5r4Cuq4

I've avoided the CHS business for ages and haven't had trouble booting

Quoted 8 lines

Thanks for the link.

About 3 yeas ago I have issues with this using an industrial 2GB uSD from Delkin Devices with am3517. And as far as I remember I just got it working with CHS configuration.

I'm going to test it again with a Sandisk uSD and am3359 to see if it remains. But I don't have a Delkin uSD and am3517 anymore :(

"CHS business", as Philip called it, was only partially required in the early days of OMAP3 SoCs few years ago, due to some "specific" FAT implementation of the BootROM. These days it's not required on modern Sitara SoCs.

Signature · 1 line
Denys
#9 lore raw
Quoted 3 lines · Denys Dmytriyenko

"CHS business", as Philip called it, was only partially required in the early days of OMAP3 SoCs few years ago, due to some "specific" FAT implementation of the BootROM. These days it's not required on modern Sitara SoCs.

Which OMAP3 SOCs need the CHS business?

--Ash

#10 lore raw
Quoted 5 lines · Ash Charles
Quoted 3 lines · Denys Dmytriyenko

"CHS business", as Philip called it, was only partially required in the early days of OMAP3 SoCs few years ago, due to some "specific" FAT implementation of the BootROM. These days it's not required on modern Sitara SoCs.

Which OMAP3 SOCs need the CHS business?

Ones with a really ancient MLO, I think. Hopefully, all of those binaries are gone from the Internet now.

Philip

Quoted 3 lines

--Ash

#11 lore raw
Quoted 4 lines · Philip Balister

Ones with a really ancient MLO, I think. Hopefully, all of those binaries are gone from the Internet now.

Philip

Excellent---thanks. I had assumed this was boot ROM dependent, not MLO dependent!
--Ash

#17 lore raw
In reply to Denys Dmytriyenko

Denys,

Quoted 6 lines · Denys Dmytriyenko

"CHS business", as Philip called it, was only partially required in the early
days of OMAP3 SoCs few years ago, due to some "specific" FAT implementation of
the BootROM. These days it's not required on modern Sitara SoCs.

So it could be true for am3517 of 3 years ago.

Regards,

--
*dS
Diego Sueiro

Administrador do Embarcados
www.embarcados.com.br
<http://www.embarcados.com.br/?utm_source=assinatura_diego&utm_medium=e-mail&utm_campaign=Assinatura%20Email%20Diego>

/*long live rock 'n roll*/

#12 lore raw
In reply to Ash Charles
Quoted 8 lines · Ash Charles
Quoted 4 lines · Philip Balister

Ones with a really ancient MLO, I think. Hopefully, all of those binaries are gone from the Internet now.

Philip

Excellent---thanks. I had assumed this was boot ROM dependent, not MLO dependent!

It is BootROM, not MLO...

Signature · 1 line
Denys
#13 lore raw
Quoted 5 lines · Denys Dmytriyenko
Quoted 4 lines · Ash Charles
Quoted 3 lines · Philip Balister

Ones with a really ancient MLO, I think. Hopefully, all of those binaries are gone from the Internet now.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Philip

Excellent---thanks. I had assumed this was boot ROM dependent, not MLO dependent!

It is BootROM, not MLO...

How old are these parts? I'm assuming they are not easily found in the wild anymore.

Philip

#15 lore raw
In reply to Ash Charles
Quoted 5 lines · Ash Charles
Quoted 3 lines · Denys Dmytriyenko

"CHS business", as Philip called it, was only partially required in the early days of OMAP3 SoCs few years ago, due to some "specific" FAT implementation of the BootROM. These days it's not required on modern Sitara SoCs.

Which OMAP3 SOCs need the CHS business?

Definitely OMAP34xx/35xx family. I'm not very sure if OMAP36xx/37xx had a fixed BootROM already, but probably it had, as Beagleboard xM was much more forgiving to SD card format, IIRC...

Signature · 1 line
Denys
#16 lore raw
Quoted 3 lines · Denys Dmytriyenko

Definitely OMAP34xx/35xx family. I'm not very sure if OMAP36xx/37xx had a fixed BootROM already, but probably it had, as Beagleboard xM was much more forgiving to SD card format, IIRC...

This matches my experience. Unfortunately, we still have a lot of customers using OM35xx parts so I'd better not take the CHS stuff out of our instructions just yet.
--Ash

#14 lore raw
In reply to Philip Balister
Quoted 8 lines · Philip Balister
Quoted 7 lines · Denys Dmytriyenko
Quoted 6 lines · Ash Charles
Quoted 4 lines · Philip Balister

Ones with a really ancient MLO, I think. Hopefully, all of those binaries are gone from the Internet now.

Philip

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Excellent---thanks. I had assumed this was boot ROM dependent, not MLO dependent!

It is BootROM, not MLO...

How old are these parts? I'm assuming they are not easily found in the wild anymore.

OMAP35xx (3503/3530) was released in 2008, which was a respin of mobile OMAP34xx, and was used in Classic BeagleBoard...

http://en.wikipedia.org/wiki/BeagleBoard

Signature · 1 line
Denys
#20 lore raw
In reply to Philip Balister

Hello Philip,

Quoted 7 lines · Philip Balister

What's the best available solution for creating an image you can dd to an SD card? It seems like this wheel has been invented several times and I am wondering if people are converging on one approach.

Bonus points for resizing the linux partition.

How are people doing this today?

Sorry for the late reply.

First I'd like to support that 'wic' is the longterm solution for it but it lacks good docs and has limited support for non-x86 based archs. We've been doing it in meta-fsl-arm for a while[1].

1. http://git.yoctoproject.org/cgit/cgit.cgi/meta-fsl-arm/tree/classes/image_types_fsl.bbclass

Different of TI's code it does not need root to run.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750