From 1cd7300e1029967ead17d5681dbd8352e4c620e1 Mon Sep 17 00:00:00 2001 From: "Baeuerle, Florian" Date: Mon, 30 Jul 2018 12:50:36 +0000 Subject: image-root-squashfs: add rules for generic squashfs image This adds rules for generating a squashfs image from the root filesystem via genimage. --- config/images/squashfs.config | 8 +++++ platforms/image-root-squashfs.in | 72 ++++++++++++++++++++++++++++++++++++++++ rules/image-root-squashfs.make | 39 ++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 config/images/squashfs.config create mode 100644 platforms/image-root-squashfs.in create mode 100644 rules/image-root-squashfs.make diff --git a/config/images/squashfs.config b/config/images/squashfs.config new file mode 100644 index 000000000..605fcb7a5 --- /dev/null +++ b/config/images/squashfs.config @@ -0,0 +1,8 @@ +image @IMAGE@ { + squashfs { + extraargs = "@EXTRA_ARGS@" + compression = @COMPRESSION_MODE@ + block-size = @BLOCK_SIZE@ + } + name = "root" +} diff --git a/platforms/image-root-squashfs.in b/platforms/image-root-squashfs.in new file mode 100644 index 000000000..4020c50eb --- /dev/null +++ b/platforms/image-root-squashfs.in @@ -0,0 +1,72 @@ +## SECTION=image + +menuconfig IMAGE_ROOT_SQUASHFS + tristate + select HOST_GENIMAGE + select HOST_SQUASHFS_TOOLS + select IMAGE_ROOT_TGZ + prompt "Generate images/root.squashfs " + help + Build squashfs images of the root filesystem. This image can be stored + linearly into target's flash device at the start of the desired + partition. You should erase the whole partition first if the image + is smaller than partition's size. If not, garbage data in the remaining + space could confuse the filesystem driver. + +if IMAGE_ROOT_SQUASHFS + +choice + prompt "squashfs compression mode" + help + Select your prefered compression mode. + + config IMAGE_ROOT_SQUASHFS_COMPRESSION_MODE_GZIP + bool "gzip" + help + Select your prefered compression mode. + + config IMAGE_ROOT_SQUASHFS_COMPRESSION_MODE_LZMA + bool "lzma" + help + Select your prefered compression mode. + + config IMAGE_ROOT_SQUASHFS_COMPRESSION_MODE_LZO + bool "lzo" + help + Select your prefered compression mode. + + config IMAGE_ROOT_SQUASHFS_COMPRESSION_MODE_LZ4 + bool "lz4" + help + Select your prefered compression mode. + + config IMAGE_ROOT_SQUASHFS_COMPRESSION_MODE_XZ + bool "xz" + help + Select your prefered compression mode. + +endchoice + +config IMAGE_ROOT_SQUASHFS_COMPRESSION_MODE + string + default "gzip" if IMAGE_ROOT_SQUASHFS_COMPRESSION_MODE_GZIP + default "lzma" if IMAGE_ROOT_SQUASHFS_COMPRESSION_MODE_LZMA + default "lzo" if IMAGE_ROOT_SQUASHFS_COMPRESSION_MODE_LZO + default "lz4" if IMAGE_ROOT_SQUASHFS_COMPRESSION_MODE_LZ4 + default "xz" if IMAGE_ROOT_SQUASHFS_COMPRESSION_MODE_XZ + +config IMAGE_ROOT_SQUASHFS_BLOCK_SIZE + string + default "128k" + prompt "Block size" + help + This allows the compression data block size to be selected, both "K" and "M" + postfixes are supported. + +config IMAGE_ROOT_SQUASHFS_EXTRA_ARGS + string + prompt "extra arguments passed to mksquashfs" + help + You can add extra arguments for mksquashfs here + +endif diff --git a/rules/image-root-squashfs.make b/rules/image-root-squashfs.make new file mode 100644 index 000000000..204e5434f --- /dev/null +++ b/rules/image-root-squashfs.make @@ -0,0 +1,39 @@ +# -*-makefile-*- +# +# Copyright (C) 2018 by Florian Bäuerle +# +# 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_SQUASHFS) += image-root-squashfs + +# +# Paths and names +# +IMAGE_ROOT_SQUASHFS := image-root-squashfs +IMAGE_ROOT_SQUASHFS_DIR := $(BUILDDIR)/$(IMAGE_ROOT_SQUASHFS) +IMAGE_ROOT_SQUASHFS_IMAGE := $(IMAGEDIR)/root.squashfs +IMAGE_ROOT_SQUASHFS_FILES := $(IMAGEDIR)/root.tgz +IMAGE_ROOT_SQUASHFS_CONFIG := squashfs.config + +# ---------------------------------------------------------------------------- +# Image +# ---------------------------------------------------------------------------- + +IMAGE_ROOT_SQUASHFS_ENV := \ + EXTRA_ARGS=$(PTXCONF_IMAGE_ROOT_SQUASHFS_EXTRA_ARGS) \ + COMPRESSION_MODE=$(PTXCONF_IMAGE_ROOT_SQUASHFS_COMPRESSION_MODE) \ + BLOCK_SIZE=$(PTXCONF_IMAGE_ROOT_SQUASHFS_BLOCK_SIZE) + +$(IMAGE_ROOT_SQUASHFS_IMAGE): + @$(call targetinfo) + @$(call image/genimage, IMAGE_ROOT_SQUASHFS) + @$(call finish) + +# vim: syntax=make -- cgit v1.2.3