From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mediacenter.hi.pengutronix.de ([2001:6f8:1178:2::65]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1SlP9H-0008UU-Os for ptxdist@pengutronix.de; Sun, 01 Jul 2012 20:45:31 +0200 Received: from mol by mediacenter.hi.pengutronix.de with local (Exim 4.72) (envelope-from ) id 1SlP9H-0001do-Nq for ptxdist@pengutronix.de; Sun, 01 Jul 2012 20:45:31 +0200 Date: Sun, 1 Jul 2012 20:45:31 +0200 From: Michael Olbrich Message-ID: <20120701184531.GA4959@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ReaqsoxgOBHFXBhH" Content-Disposition: inline Subject: [ptxdist] Image Generation in PTXdist Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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-". Like host- or cross- packages it has a special meaning: - It has one target, IMAGE__IMAGE that is built with 'ptxdist images' when selected. - It depends on any packages listed in MAGE__PKGS and all files in MAGE__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__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 | --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="image-root-ext.in" ## 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 --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="image-root-tgz.in" ## SECTION=image config IMAGE_ROOT_TGZ tristate prompt "Generate images/root.tgz" help FIXME --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="image-root-ext.make" # -*-makefile-*- # # Copyright (C) 2012 by Michael Olbrich # # 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 --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="image-root-tgz.make" # -*-makefile-*- # # Copyright (C) 2012 by Michael Olbrich # # 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 --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ext.config" image @IMAGE@ { @EXT_TYPE@ {} size = @SIZE@ mountpoint = "/" } --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- ptxdist mailing list ptxdist@pengutronix.de --ReaqsoxgOBHFXBhH--