ChangeSet 1.914.157.9, 2003/02/15 23:33:21-06:00, kai@tp1.ruhr-uni-bochum.de klibc: Stop on error when building the CPIO gen_init_cpio still referenced hello in usr/hello_world, but I put it into usr/root. This is now corrected, however it also pointed out the common problem that the error code of gen_init_cpio is ignored since it's output is piped to gzip. To fix that, make the generation of the .cpio.gz a two step process. diff -Nru a/usr/Makefile b/usr/Makefile --- a/usr/Makefile Wed Feb 19 11:41:49 2003 +++ b/usr/Makefile Wed Feb 19 11:41:49 2003 @@ -10,22 +10,32 @@ LDFLAGS_initramfs_data.o := $(LDFLAGS_BLOB) -r -T -$(obj)/initramfs_data.o: $(src)/initramfs_data.scr $(obj)/initramfs_data.cpio.gz FORCE +$(obj)/initramfs_data.o: $(src)/initramfs_data.scr \ + $(obj)/initramfs_data.cpio.gz FORCE $(call if_changed,ld) -quiet_cmd_cpio = CPIO $@ - cmd_cpio = ./$< | gzip -9c > $@ - -# +# initramfs-y are the programs which will be copied into the CPIO +# archive. Currently, the filenames are hardcoded in gen_init_cpio, +# but we need the information for the build as well, so it's duplicated +# here. initramfs-y := $(obj)/root/hello -$(obj)/initramfs_data.cpio.gz: $(obj)/gen_init_cpio $(initramfs-y) FORCE +quiet_cmd_cpio = CPIO $@ + cmd_cpio = ./$< > $@ + +$(obj)/initramfs_data.cpio: $(obj)/gen_init_cpio $(initramfs-y) FORCE $(call if_changed,cpio) +targets += $(obj)/initramfs_data.cpio + +$(obj)/initramfs_data.cpio.gz: $(obj)/initramfs_data.cpio FORCE + $(call if_changed,gzip) + targets += $(obj)/initramfs_data.cpio.gz -# +# To build the initramfs programs, we need to descend into root/ +# Before doing so, we need to descend into lib/ to build klibc. $(initramfs-y): $(obj)/root ; diff -Nru a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c --- a/usr/gen_init_cpio.c Wed Feb 19 11:41:49 2003 +++ b/usr/gen_init_cpio.c Wed Feb 19 11:41:49 2003 @@ -215,7 +215,7 @@ cpio_mknod("/dev/console", 0600, 0, 0, 'c', 5, 1); cpio_mkdir("/root", 0700, 0, 0); cpio_mkdir("/sbin", 0700, 0, 0); - cpio_mkfile("usr/hello_world/hello", "/sbin/hotplug", 0700, 0, 0); + cpio_mkfile("usr/root/hello", "/sbin/hotplug", 0700, 0, 0); cpio_trailer(); exit(0);