1 --- a/scripts/Makefile.lib
2 +++ b/scripts/Makefile.lib
4 quiet_cmd_gzip = GZIP $@
5 cmd_gzip = gzip -f -9 < $< > $@
10 +quiet_cmd_lzma = LZMA $@
11 +cmd_lzma = bash -e scripts/lzma_kern $< $@ -lc7 -lp0 -pb0
13 +# cmd_lzma = lzmacomp $< 700 > $@
15 +++ b/scripts/lzma_kern
17 +get-size() { echo "$5" ;}
18 +printf -v len '%.8x' "$(get-size $(ls -l "$1"))"
20 +echo -ne "\x$(echo $len | cut -c 7,8)\x$(echo $len | cut -c 5,6)\x$(echo $len | cut -c 3,4)\x$(echo $len | cut -c 1,2)" >> "$2"
21 --- a/arch/x86/boot/compressed/Makefile
22 +++ b/arch/x86/boot/compressed/Makefile
24 # create a compressed vmlinux image from the original vmlinux
27 -targets := vmlinux vmlinux.bin vmlinux.bin.gz head_$(BITS).o misc.o piggy.o
28 +targets := vmlinux vmlinux.bin vmlinux.bin.lzma head_$(BITS).o lzma_misc.o piggy.o
30 KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
31 KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
33 LDFLAGS := -m elf_$(UTS_MACHINE)
36 -$(obj)/vmlinux: $(src)/vmlinux_$(BITS).lds $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/piggy.o FORCE
37 +$(obj)/vmlinux: $(src)/vmlinux_$(BITS).lds $(obj)/head_$(BITS).o $(obj)/lzma_misc.o $(obj)/piggy.o FORCE
42 $(call if_changed,relocbin)
44 ifdef CONFIG_RELOCATABLE
45 -$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE
46 - $(call if_changed,gzip)
47 +$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin.all FORCE
48 + $(call if_changed,lzma)
50 -$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
51 - $(call if_changed,gzip)
52 +$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
53 + $(call if_changed,lzma)
55 LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T
61 -$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
62 +$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.lzma FORCE