ChangeSet 1.1125, 2003/03/07 16:46:13-08:00, greg@kroah.com

kbuild: handle any failures of the gen_init_cpio or initramfs image to stop the build.

This also shows how to add files to the initramfs build, but is 
commented out.

Patch originally done by Kai.


 usr/Makefile |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)


diff -Nru a/usr/Makefile b/usr/Makefile
--- a/usr/Makefile	Fri Mar  7 16:48:16 2003
+++ b/usr/Makefile	Fri Mar  7 16:48:16 2003
@@ -1,16 +1,34 @@
 
 obj-y := initramfs_data.o
 
-host-progs := gen_init_cpio
+host-progs  := gen_init_cpio
 
 clean-files := initramfs_data.cpio.gz
 
 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)
 
-$(obj)/initramfs_data.cpio.gz: $(obj)/gen_init_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.
 
+# Commented out for now
+# initramfs-y := $(obj)/root/hello
+
+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
 
