mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] Image Generation in PTXdist
@ 2012-07-01 18:45 Michael Olbrich
  0 siblings, 0 replies; only message in thread
From: Michael Olbrich @ 2012-07-01 18:45 UTC (permalink / raw)
  To: ptxdist

[-- Attachment #1: Type: text/plain, Size: 3245 bytes --]

Hi,

If you're following the changes in git a bit more closely you might have
noticed some changes about image creation since the last release. This is
something that deserves a few words of explanation.

The mechanisms to create images that we've had so far have a lot of
shortcomings and I wanted something new for a long time. What I've
committed over the last weeks is far from finished, but I thinks it's a
good start.

So what's wrong with the old mechanism:
- It's not really integrated with the build process, but rather attached at
  the end. As a result dependencies don't work correctly.
- The way things work with the one working directory makes it almost
  impossible to fill an image with anything other than the rootfs.
- With the way these rules live in rules/post, overwriting them in a BSP is
  not really possible. Even adding new ones is not really nice.
- Kconfig is not good at describing the complex possibilities for creating
  images. As a result we have lot's of options most people don't need and
  still can't do everything we want.

So how do the new style images work:
First there is a new package type "image-<pkg>". Like host- or cross-
packages it has a special meaning:
- It has one target, IMAGE_<PKG>_IMAGE that is built with 'ptxdist images'
  when selected.
- It depends on any packages listed in MAGE_<PKG>_PKGS and all files in
  MAGE_<PKG>_FILES.

It's not yet used for any package, but there are the first templates. The
image-tgz template extracts all packages and creates a .tgz from this. With
$(PTX_PACKAGES_INSTALL) as packages list we get the root.tgz we currently
have. But it's now also possible to extract a different set of packages,
e.g. for a rescue system, etc. I have plans to use collectionconfigs for
this, but this is not yet implemented.

The next piece of the puzzle is a tool called genimage. It's basically a
wrapper for all the tools needed to create images. It uses libconfuse for
its config files. The idea is to do all the complex stuff in these config
files and add the basic variables from the platformconfig.
e.g. for an ext2 image we only define the type (ext2/ext3/ext4) and the
size in the platformconfig. If you need special genext2fs or tune2fs
options, the genimage config file can be overwritten in the BSP.
The content for the image is defined by setting MAGE_<PKG>_FILES to a
tarball. The mechanism described above can be used to create it.
The template image-genimage can be used to define such images.

I've attached the files for root.tgz and root.ext2 as an example:
platforms/image-root-tgz.in
rules/image-root-tgz.make
platforms/image-root-ext.in
rules/image-root-ext.make
config/images/ext.config

I've not yet committed these because I'm not sure if I want to immediately
replace the old rules, or have them side by side for some time. So this is
something for after the next release.

Please give it a try and tell me what you think.

Regards,
Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: image-root-ext.in --]
[-- Type: text/plain, Size: 717 bytes --]

## SECTION=image

menuconfig IMAGE_ROOT_EXT
	tristate
	select HOST_GENIMAGE
	select HOST_GENEXT2FS
	select HOST_E2FSPROGS
	select IMAGE_ROOT_TGZ
	prompt "Generate images/root.ext2     "
	help
	  FIXME

if IMAGE_ROOT_EXT

config IMAGE_ROOT_EXT_SIZE
	string
	default "20M"
	prompt "image size"
	help
	  The image size in bytes or with unit, e.g. 42M, 23G, etc.

choice
	prompt "ext2fs type          "

config IMAGE_ROOT_EXT_EXT2
	bool
	prompt "ext2"

config IMAGE_ROOT_EXT_EXT3
	bool
	prompt "ext3"

config IMAGE_ROOT_EXT_EXT4
	bool
	prompt "ext4"

endchoice

config IMAGE_ROOT_EXT_TYPE
	string
	default "ext2" if IMAGE_ROOT_EXT_EXT2
	default "ext3" if IMAGE_ROOT_EXT_EXT3
	default "ext4" if IMAGE_ROOT_EXT_EXT4

endif

[-- Attachment #3: image-root-tgz.in --]
[-- Type: text/plain, Size: 100 bytes --]

## SECTION=image

config IMAGE_ROOT_TGZ
	tristate
	prompt "Generate images/root.tgz"
	help
	  FIXME

[-- Attachment #4: image-root-ext.make --]
[-- Type: text/plain, Size: 1017 bytes --]

# -*-makefile-*-
#
# Copyright (C) 2012 by Michael Olbrich <m.olbrich@pengutronix.de>
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
IMAGE_PACKAGES-$(PTXCONF_IMAGE_ROOT_EXT) += image-root-ext

#
# Paths and names
#
IMAGE_ROOT_EXT		:= image-root-ext
IMAGE_ROOT_EXT_DIR	:= $(BUILDDIR)/$(IMAGE_ROOT_EXT)
IMAGE_ROOT_EXT_IMAGE	:= $(IMAGEDIR)/root.ext2
IMAGE_ROOT_EXT_FILES	:= $(IMAGEDIR)/root.tgz
IMAGE_ROOT_EXT_CONFIG	:= ext.config

# ----------------------------------------------------------------------------
# Image
# ----------------------------------------------------------------------------

IMAGE_ROOT_EXT_ENV := \
	SIZE=$(PTXCONF_IMAGE_ROOT_EXT_SIZE) \
	EXT_TYPE=$(PTXCONF_IMAGE_ROOT_EXT_TYPE)

ifdef PTXCONF_IMAGE_ROOT_EXT
$(IMAGE_ROOT_EXT_IMAGE):
	@$(call targetinfo)
	@$(call image/genimage, IMAGE_ROOT_EXT)
	@$(call finish)
endif

# vim: syntax=make

[-- Attachment #5: image-root-tgz.make --]
[-- Type: text/plain, Size: 875 bytes --]

# -*-makefile-*-
#
# Copyright (C) 2012 by Michael Olbrich <m.olbrich@pengutronix.de>
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
IMAGE_PACKAGES-$(PTXCONF_IMAGE_ROOT_TGZ) += image-root-tgz

#
# Paths and names
#
IMAGE_ROOT_TGZ		:= image-root-tgz
IMAGE_ROOT_TGZ_DIR	:= $(BUILDDIR)/$(IMAGE_ROOT_TGZ)
IMAGE_ROOT_TGZ_IMAGE	:= $(IMAGEDIR)/root.tgz
IMAGE_ROOT_TGZ_PKGS	= $(PTX_PACKAGES_INSTALL)

# ----------------------------------------------------------------------------
# Image
# ----------------------------------------------------------------------------

ifdef PTXCONF_IMAGE_ROOT_TGZ
$(IMAGE_ROOT_TGZ_IMAGE):
	@$(call targetinfo)
	@$(call image/archive, IMAGE_ROOT_TGZ)
	@$(call finish)
endif

# vim: syntax=make

[-- Attachment #6: ext.config --]
[-- Type: text/plain, Size: 68 bytes --]


image @IMAGE@ {
	@EXT_TYPE@ {}
	size = @SIZE@
	mountpoint = "/"
}


[-- Attachment #7: Type: text/plain, Size: 48 bytes --]

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-01 18:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-01 18:45 [ptxdist] Image Generation in PTXdist Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox