patch-2.0.8 linux/arch/i386/boot/compressed/Makefile

Next file: linux/arch/i386/kernel/entry.S
Previous file: linux/arch/i386/boot/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.7/linux/arch/i386/boot/compressed/Makefile linux/arch/i386/boot/compressed/Makefile
@@ -46,12 +46,21 @@
 # You cannot compress a file and have the kernel uncompress it, it must
 # be stdin
 piggy.o:	$(SYSTEM)
-	tmppiggy=/tmp/$$$$.piggy; \
-	rm -f $$tmppiggy $$tmppiggy.gz; \
-	$(OBJDUMP) $(OBJDUMP_FLAGS) -o $(IMAGE_OFFSET) $(SYSTEM) > $$tmppiggy; \
+	tmppiggy=/tmp/$$$$piggy; \
+	rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
+	if hash $(ENCAPS) 2> /dev/null; then \
+	  $(OBJDUMP) $(OBJDUMP_FLAGS) -o $(IMAGE_OFFSET) $(SYSTEM) > $$tmppiggy; \
+	else \
+	  $(OBJCOPY) $(SYSTEM) $$tmppiggy; \
+	fi; \
 	gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
-	$(ENCAPS) $(TARGET) piggy.o $$tmppiggy.gz $(INPUT_DATA) $(INPUT_LEN); \
-	rm -f $$tmppiggy $$tmppiggy.gz
+	if hash $(ENCAPS) 2> /dev/null; then \
+	  $(ENCAPS) $(TARGET) piggy.o $$tmppiggy.gz $(INPUT_DATA) $(INPUT_LEN); \
+	else \
+	  echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \
+	  ld -m elf_i386 -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \
+	fi; \
+	rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk
 else
 
 piggy.o:	$(SYSTEM) xtract piggyback

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov