Browse Source

fs/cpio: don't fail systems without /dev/null

We pass all our dracut configuration files via a config dir, but dracut
insists with having one config file. Because we do not want to have to
chose which file we pass (which would then have to be excluded from the
config dir), we just used an arbitrary empty file, and /dev/null seemed
to be a good candidate.

However, some build environments do not have a complete /dev, and may be
missing entries otherwise taken for granted, like /dev/null. This is
especially the case in constrained environments like containers.

Switch away from using /dev/null, and do create an actual empty file
that we can use as the dracut config file.

Fixes:

  https://gitlab.com/buildroot.org/buildroot/-/jobs/3249828364

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Yann E. MORIN 2 years ago
parent
commit
d0b7e11b93
1 changed files with 2 additions and 1 deletions
  1. 2 1
      fs/cpio/cpio.mk

+ 2 - 1
fs/cpio/cpio.mk

@@ -69,12 +69,13 @@ endif
 
 
 define ROOTFS_CPIO_CMD
 define ROOTFS_CPIO_CMD
 	mkdir -p $(ROOTFS_CPIO_DIR)/tmp $(ROOTFS_CPIO_DIR)/confdir
 	mkdir -p $(ROOTFS_CPIO_DIR)/tmp $(ROOTFS_CPIO_DIR)/confdir
+	touch $(ROOTFS_CPIO_DIR)/empty-config
 	$(foreach cfg,$(ROOTFS_CPIO_DRACUT_CONF_FILES), \
 	$(foreach cfg,$(ROOTFS_CPIO_DRACUT_CONF_FILES), \
 		cp $(cfg) $(ROOTFS_CPIO_DIR)/confdir/$(notdir $(cfg))
 		cp $(cfg) $(ROOTFS_CPIO_DIR)/confdir/$(notdir $(cfg))
 	)
 	)
 	$(HOST_DIR)/bin/dracut \
 	$(HOST_DIR)/bin/dracut \
 		$(ROOTFS_CPIO_OPTS) \
 		$(ROOTFS_CPIO_OPTS) \
-		-c /dev/null \
+		-c $(ROOTFS_CPIO_DIR)/empty-config \
 		--confdir $(ROOTFS_CPIO_DIR)/confdir \
 		--confdir $(ROOTFS_CPIO_DIR)/confdir \
 		--sysroot $(TARGET_DIR) \
 		--sysroot $(TARGET_DIR) \
 		--tmpdir $(ROOTFS_CPIO_DIR)/tmp \
 		--tmpdir $(ROOTFS_CPIO_DIR)/tmp \