aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v10/boot/compressed/Makefile
blob: 6584a44820f416996f4352073a9620e2e4a1b883 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#
# create a compressed vmlinuz image from the binary vmlinux.bin file
#
target = $(target_compressed_dir)
src    = $(src_compressed_dir)

CC = gcc-cris -melf $(LINUXINCLUDE)
CFLAGS = -O2
LD = ld-cris
OBJCOPY = objcopy-cris
OBJCOPYFLAGS = -O binary --remove-section=.bss
OBJECTS = $(target)/head.o $(target)/misc.o

# files to compress
SYSTEM = $(objtree)/vmlinux.bin

all: $(target_compressed_dir)/vmlinuz

$(target)/decompress.bin: $(OBJECTS)
	$(LD) -T $(src)/decompress.ld -o $(target)/decompress.o $(OBJECTS)
	$(OBJCOPY) $(OBJCOPYFLAGS) $(target)/decompress.o $(target)/decompress.bin

# Create vmlinuz image in top-level build directory
$(target_compressed_dir)/vmlinuz: $(target) piggy.img $(target)/decompress.bin
	@echo "  COMPR   vmlinux.bin --> vmlinuz"
	@cat $(target)/decompress.bin piggy.img > $(target_compressed_dir)/vmlinuz
	@rm -f piggy.img

$(target)/head.o: $(src)/head.S
	$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@

$(target)/misc.o: $(src)/misc.c
	$(CC) -D__KERNEL__ -c $< -o $@

# gzip the kernel image

piggy.img: $(SYSTEM)
	@cat $(SYSTEM) | gzip -f -9 > piggy.img

$(target):
	mkdir -p $(target)

clean:
	rm -f piggy.img $(objtree)/vmlinuz