[meta-freescale] Improving SD-Card images

maciej.borzecki at open-rnd.pl maciej.borzecki at open-rnd.pl
Mon Jul 21 02:51:30 PDT 2014


On 07/21 00:47, Jens Rehsack wrote:
>
> Am 20.07.2014 um 13:13 schrieb maciej.borzecki at open-rnd.pl:
>
> > > Dnia 19 lipiec 2014 o 16:50 Jens Rehsack <rehsack at gmail.com> napisał(a):
> > >
> > >
> > > Hi,
> > >
> > > the options of meta-fsl-arm/classes/image_types_fsl.bbclass to generate sdcards are somehow limited :)
> > >
> > > For the final release we'd like to have following partitions:
> > > 1) boot (ext2, fat?)
> > > 2) prod-root (squashfs)
> > > 3) recovery-root (squashfs)
> > > 4) volatile (ext[34]?)
> > > 5) changes (unionfs over 2)
> > >
> > > Looks as if image_types_fsl.bbclass would need rework to support >2 partition, but that's just coding.
> >
> > Have you considered wic? I've posted a patch that adds building of SD card image for BBB:
> > http://article.gmane.org/gmane.linux.embedded.yocto.meta-ti/4171 also meta-ti have already dumped their
> > sdimg bbclass in favor of wic. Not saying that meta-fsl should do the same, just pointing out that there may
> > be some room for unification.
> >
> > Effectively your list in terms of wic translates to a couple of *.wks files that cover most common
> > partition layouts and source plugins for boot image and recovery partition contents.
> >
> > wic shares a lot of similarity to mic and *.wks is basically kickstart, so it should be pretty familiar to anyone
> > with prior mic/anaconda experience
>
> Hi Maciej,
>
> looks cool - but how do I define an image (call it foo) shall contain
> foo-rootfs, foo-recoveryfs, foo-tmp and foo-data.

You'd start with writing a *.wks that defines the partitions, labels,
alignment, etc. Example that I used for BeagleBone Black with a single
boot and single rootfs partition:

part /boot --source bootimg --ondisk mmcblk0 --fstype=vfat --label boot --active --align 1024 --size 10
part / --source rootfs --ondisk mmcblk0 --fstype=ext3 --label root --align 1024

Basically defines a first partition with a vague id /boot, label boot,
10MB in size, possibly on mmcblk0 device. Followed by a second partition
that contains a rootfs, using ext3, sized to fit the contents.

For recovery and data you may come up with additional entries like:

part /recovery --source recovery --ondisk mmcblk0 ..
part /data --source data --ondisk mmcblk0 ..

What's interesting is the --source definition. These correspond to
plugins located source tree (either poky/scripts/lib/mic/plugins/source/
or ${layer}/scripts/lib/mic/plugins/source/) that define how the content
if the partition is generated. For now, there are only 3 plugins defined
in poky master:
- bootimg-efi - a GPT disk with efi boot partition
- bootimg-pcbios - MBR disk with syslinux in MBR
- rootfs

The current code of rootfs plugin basically takes contents of
$IMAGE_ROOTFS and writes that to a partition.

The beaglebonebootimg source plugin effectively copies over boot files
needed by BBB (MLO and u-boot.img from DEPLOY_DIR_IMAGE). Since the
files are cherry picked, I decided to write a plugin.

It's all Python code, should be quite easy to extend. Effectively one
could write a plugins that:

- take contents of any directory and writes that to partition (a kind
  of general purpose 'dump this dir here' plugin)
- picks up a specific directory based on bitbake environment vars, while
  recipes generate proper content to that locations (like a recipe for
  recovery image, with special kernel version, busybox or whatever)

There's definitely more functionality missing than available. Direct
bas/parted/mkfs/mcopy wrangling will be faster at this stage. I'm trying
to get wic to build SD images for our project on BBB, with the intention
that I'd be able to use to extend this to other platforms that we use (rpi,
wandboard, nitrogen6x).

The documentation for wic that was published along with 1.5 is here:

https://www.yoctoproject.org/docs/1.5.2/dev-manual/dev-manual.html#creating-partitioned-images

I believe Tom Zanussi (he's the original author of wic) is working on
getting this updated for current and he'd definitely be more
knowledgeable about wic than me.


> And beside I can enumerate some partitions, how can I get yocto to
> build rootfs+recoveryfs after my will (or at least what I'm able to
> express).
>





--
Maciej Borzęcki
Senior Software Developer at Open-RnD Sp. z o.o., Poland
www.open-rnd.pl
mobile: +48 889 117 365, fax: +48 42 657 9079


Niniejsza wiadomość wraz z załącznikami może
zawierać chronione prawem lub poufne informacje i została
wysłana wyłącznie do wiadomości i użytku osób, do których
została zaadresowana. Jeśli wiadomość została otrzymana
przypadkowo zabrania się jej kopiowania lub rozsyłania do osób
trzecich. W takim przypadku uprasza się o natychmiastowe
zniszczenie wiadomości oraz poinformowanie nadawcy o
zaistniałej sytuacji za pomocą wiadomości zwrotnej.
Dziękujemy.

This message, including any attachments hereto,
may contain privileged or confidential information and is sent
solely for the attention and use of the intended addressee(s).
If you are not an intended addressee, you may neither use this
message nor copy or deliver it to anyone. In such case, you
should immediately destroy this message and kindly notify the
sender by reply email. Thank you.


More information about the meta-freescale mailing list