1 --- a/scripts/Makefile.lib
2 +++ b/scripts/Makefile.lib
3 @@ -166,4 +166,9 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS)
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_32
22 +++ b/arch/x86/boot/compressed/Makefile_32
24 # create a compressed vmlinux image from the original vmlinux
27 -targets := vmlinux vmlinux.bin vmlinux.bin.gz head_32.o misc_32.o piggy.o \
28 - vmlinux.bin.all vmlinux.relocs
29 +targets := vmlinux vmlinux.bin vmlinux.bin.lzma head_32.o piggy.o \
30 + vmlinux.bin.all vmlinux.relocs lzma_misc.o
31 EXTRA_AFLAGS := -traditional
34 @@ -17,7 +17,7 @@ KBUILD_CFLAGS := -m32 -D__KERNEL__ $(LI
35 $(call cc-option,-fno-stack-protector)
36 LDFLAGS := -m elf_i386
38 -$(obj)/vmlinux: $(src)/vmlinux_32.lds $(obj)/head_32.o $(obj)/misc_32.o $(obj)/piggy.o FORCE
39 +$(obj)/vmlinux: $(src)/vmlinux_32.lds $(obj)/head_32.o $(obj)/lzma_misc.o $(obj)/piggy.o FORCE
43 @@ -37,14 +37,14 @@ $(obj)/vmlinux.bin.all: $(vmlinux.bin.al
44 $(call if_changed,relocbin)
46 ifdef CONFIG_RELOCATABLE
47 -$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE
48 - $(call if_changed,gzip)
49 +$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin.all FORCE
50 + $(call if_changed,lzma)
52 -$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
53 - $(call if_changed,gzip)
54 +$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
55 + $(call if_changed,lzma)
58 LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T
60 -$(obj)/piggy.o: $(src)/vmlinux_32.scr $(obj)/vmlinux.bin.gz FORCE
61 +$(obj)/piggy.o: $(src)/vmlinux_32.scr $(obj)/vmlinux.bin.lzma FORCE