fs/cpio: new option to use dracut tool
Adds an option to invoke the dracut host tool, providing a configuration file, instead of having a full cpio archive of the whole target directory. A default configuration file is provided. It assumes busybox init. ideally, a different default should be used in case of systemd init, but that's left for future work. Signed-off-by: Thierry Bultel <thierry.bultel@linatsea.fr> [arnout@mind.be: many changes] Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> [yann.morin.1998@free.fr: some additional fixups] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
parent
87f4900826
commit
d8f0ec7a46
@ -7,6 +7,41 @@ config BR2_TARGET_ROOTFS_CPIO
|
|||||||
|
|
||||||
if BR2_TARGET_ROOTFS_CPIO
|
if BR2_TARGET_ROOTFS_CPIO
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "cpio type"
|
||||||
|
default BR2_TARGET_ROOTFS_CPIO_FULL
|
||||||
|
|
||||||
|
config BR2_TARGET_ROOTFS_CPIO_FULL
|
||||||
|
bool "cpio the whole root filesystem"
|
||||||
|
help
|
||||||
|
Build a cpio archive containing the whole the root filesystem.
|
||||||
|
|
||||||
|
config BR2_TARGET_ROOTFS_CPIO_DRACUT
|
||||||
|
bool "Invoke dracut to make a partial initramfs"
|
||||||
|
select BR2_PACKAGE_HOST_DRACUT
|
||||||
|
help
|
||||||
|
Build an additional initramfs using dracut. This only contains
|
||||||
|
a subset of the rootfs, as determined by the configuration
|
||||||
|
file.
|
||||||
|
This can be useful to create a recovery system, for instance.
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
if BR2_TARGET_ROOTFS_CPIO_DRACUT
|
||||||
|
|
||||||
|
config BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE
|
||||||
|
string "dracut configuration file"
|
||||||
|
default "fs/cpio/dracut.conf"
|
||||||
|
help
|
||||||
|
Dracut configuration file. It determines which parts of the
|
||||||
|
rootfs get included in the cpio image. See dracut.conf(5) or
|
||||||
|
https://github.com/dracutdevs/dracut/blob/master/man/dracut.conf.5.asc
|
||||||
|
|
||||||
|
The default configuration file is suitable for busybox init.
|
||||||
|
It doesn't, however, pivot_root into a full rootfs.
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Compression method"
|
prompt "Compression method"
|
||||||
default BR2_TARGET_ROOTFS_CPIO_NONE
|
default BR2_TARGET_ROOTFS_CPIO_NONE
|
||||||
|
@ -36,6 +36,8 @@ ROOTFS_CPIO_DEPENDENCIES += host-cpio
|
|||||||
ROOTFS_CPIO_OPTS += --reproducible
|
ROOTFS_CPIO_OPTS += --reproducible
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(BR2_TARGET_ROOTFS_CPIO_FULL),y)
|
||||||
|
|
||||||
define ROOTFS_CPIO_CMD
|
define ROOTFS_CPIO_CMD
|
||||||
cd $(TARGET_DIR) && \
|
cd $(TARGET_DIR) && \
|
||||||
find . \
|
find . \
|
||||||
@ -44,6 +46,37 @@ define ROOTFS_CPIO_CMD
|
|||||||
> $@
|
> $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
else ifeq ($(BR2_TARGET_ROOTFS_CPIO_DRACUT),y)
|
||||||
|
|
||||||
|
ROOTFS_CPIO_DEPENDENCIES += host-dracut
|
||||||
|
|
||||||
|
ROOTFS_CPIO_DRACUT_CONF_FILE = $(call qstrip,$(BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE))
|
||||||
|
ifeq ($(BR_BUILDING):$(ROOTFS_CPIO_DRACUT_CONF_FILE),y:)
|
||||||
|
$(error No dracut config file name specified, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE setting)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(BR2_LINUX_KERNEL),y)
|
||||||
|
ROOTFS_CPIO_DEPENDENCIES += linux
|
||||||
|
ROOTFS_CPIO_OPTS += --kver $(LINUX_VERSION_PROBED)
|
||||||
|
else
|
||||||
|
ROOTFS_CPIO_OPTS += --no-kernel
|
||||||
|
endif
|
||||||
|
|
||||||
|
define ROOTFS_CPIO_CMD
|
||||||
|
mkdir -p $(ROOTFS_CPIO_DIR)/tmp
|
||||||
|
$(HOST_DIR)/bin/dracut \
|
||||||
|
$(ROOTFS_CPIO_OPTS) \
|
||||||
|
-c $(ROOTFS_CPIO_DRACUT_CONF_FILE) \
|
||||||
|
--sysroot $(TARGET_DIR) \
|
||||||
|
--tmpdir $(ROOTFS_CPIO_DIR)/tmp \
|
||||||
|
-M \
|
||||||
|
--force \
|
||||||
|
--no-compress \
|
||||||
|
$@
|
||||||
|
endef
|
||||||
|
|
||||||
|
endif #BR2_TARGET_ROOTFS_CPIO_DRACUT
|
||||||
|
|
||||||
ifeq ($(BR2_TARGET_ROOTFS_CPIO_UIMAGE),y)
|
ifeq ($(BR2_TARGET_ROOTFS_CPIO_UIMAGE),y)
|
||||||
ROOTFS_CPIO_DEPENDENCIES += host-uboot-tools
|
ROOTFS_CPIO_DEPENDENCIES += host-uboot-tools
|
||||||
define ROOTFS_CPIO_UBOOT_MKIMAGE
|
define ROOTFS_CPIO_UBOOT_MKIMAGE
|
||||||
|
92
fs/cpio/dracut.conf
Normal file
92
fs/cpio/dracut.conf
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
#Simple dracut config for a system without systemd
|
||||||
|
|
||||||
|
#Dracut configuration
|
||||||
|
|
||||||
|
show_modules=yes
|
||||||
|
i18n_install_all=no
|
||||||
|
lvmconf=no
|
||||||
|
mdadmconf=no
|
||||||
|
early_microcode=no
|
||||||
|
hostonly=no
|
||||||
|
hostonly_cmdline=no
|
||||||
|
use_fstab=no
|
||||||
|
kernel_cmdline="rd.break=initqueue"
|
||||||
|
do_strip=no
|
||||||
|
|
||||||
|
# Dracut modules needed
|
||||||
|
add_dracutmodules+=" \
|
||||||
|
busybox-init
|
||||||
|
"
|
||||||
|
|
||||||
|
# Modules to ignore
|
||||||
|
omit_dracutmodules+=" \
|
||||||
|
bash \
|
||||||
|
biosdevname \
|
||||||
|
btrfs \
|
||||||
|
bluetooth \
|
||||||
|
busybox \
|
||||||
|
caps \
|
||||||
|
cifs \
|
||||||
|
crypt \
|
||||||
|
crypt-gpg \
|
||||||
|
dash \
|
||||||
|
dbus-broker \
|
||||||
|
dbus-daemon \
|
||||||
|
dm \
|
||||||
|
dmraid \
|
||||||
|
dmsquash-live-ntfs \
|
||||||
|
dracut-systemd \
|
||||||
|
fcoe \
|
||||||
|
fcoe-uefi \
|
||||||
|
fs-lib \
|
||||||
|
iscsi \
|
||||||
|
i18n \
|
||||||
|
lvmmerge \
|
||||||
|
lvm \
|
||||||
|
lunmask \
|
||||||
|
mdraid \
|
||||||
|
memstrack \
|
||||||
|
mksh \
|
||||||
|
modsign \
|
||||||
|
mount-root \
|
||||||
|
multipath \
|
||||||
|
nbd \
|
||||||
|
network-legacy \
|
||||||
|
network-wicked \
|
||||||
|
nfs \
|
||||||
|
nvdimm \
|
||||||
|
nvmf \
|
||||||
|
parse-lunmask \
|
||||||
|
qemu \
|
||||||
|
qemu-net \
|
||||||
|
resume \
|
||||||
|
rootfs-block \
|
||||||
|
rngd \
|
||||||
|
systemd \
|
||||||
|
systemd-udevd \
|
||||||
|
systemd-coredump \
|
||||||
|
systemd-ask-password \
|
||||||
|
systemd-timedated \
|
||||||
|
systemd-rfkill \
|
||||||
|
systemd-resolved \
|
||||||
|
systemd-hostnamed \
|
||||||
|
systemd-initrd \
|
||||||
|
systemd-journald \
|
||||||
|
systemd-ldconfig \
|
||||||
|
systemd-networkd \
|
||||||
|
systemd-timesyncd \
|
||||||
|
systemd-veritysetup \
|
||||||
|
systemd-modules-load \
|
||||||
|
systemd-sysctl \
|
||||||
|
systemd-repart \
|
||||||
|
systemd-sysext \
|
||||||
|
systemd-sysusers \
|
||||||
|
systemd-tmpfiles \
|
||||||
|
squash \
|
||||||
|
ssh-client \
|
||||||
|
stratis \
|
||||||
|
tpm2-tss \
|
||||||
|
udev-rules \
|
||||||
|
url-lib \
|
||||||
|
usrmount \
|
||||||
|
"
|
Loading…
Reference in New Issue
Block a user