root/ar5315_microredboot/microredboot/boot/src/Makefile

Revision 12325, 4.2 kB (checked in by BrainSlayer, 5 months ago)

increase lzma decoder speed by 2

Line 
1 #
2 # linux/arch/mips/boot/compressed/Makefile
3 #
4 # create a compressed vmlinuz image from the original vmlinux
5 #
6 # Note: SYSTEM, ZTEXTADDR, ZBSSADDR and ZRELADDR are exported
7 # from arch/mips/boot/Makefile. Their meanings are as follows:
8 #
9 # ZTEXTADDR
10 #       Start address of decompressor.  You normally call the kernel
11 #       at this address to start it booting.  This doesn't have
12 #       to be located in RAM, it can be in flash or other read-only or
13 #       read-write addressable medium. It should be an address in kseg1.
14 #
15 # ZBSSADDR
16 #       Start address of zero-initialised work area for the decompressor.
17 #       This must be pointing at RAM.  The decompressor will zero initialise
18 #       this for you. It should be an address in kseg1 too. The default for
19 #       this is to place it just after the image (so when running the code
20 #       from ROM you will need to set this to something useful).
21 #
22 # ZRELADDR
23 #       This is the address where the decompressed kernel will be written,
24 #       and eventually executed. It will be in kseg0.
25 #
26 CC = /xfs/toolchains/staging_dir_mips/bin/mips-linux-gcc
27 LD = /xfs/toolchains/staging_dir_mips/bin/mips-linux-ld
28 #CC = /home/seg/DEV/broadcom/ar5315_microredboot/microredboot/tools/ecos_build/gnutools/mipsisa32-elf/bin/mipsisa32-elf-gcc
29 #LD = /home/seg/DEV/broadcom/ar5315_microredboot/microredboot/tools/ecos_build/gnutools/mipsisa32-elf/bin/mipsisa32-elf-ld
30 OBJCOPY = /xfs/toolchains/staging_dir_mips/bin/mips-linux-objcopy
31 CFLAGS = -Os -G 0 -mabi=32 -mno-abicalls -fno-pic -pipe -msoft-float -ffreestanding -march=mips32 -Iinclude -I. -Iinclude/asm-mips/mach-atheros -Iinclude/asm/mach-generic -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__ -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32 -D__KERNEL__
32 CFLAGS+= -DCONFIG_MIPS_L1_CACHE_SHIFT=5 -DCONFIG_PAGE_SIZE_4KB -DCONFIG_32BIT -DCONFIG_BOOTLOADER
33 AFLAGS = -D__ASSEMBLY__ -G 0 -mabi=32 -mno-abicalls -fno-pic -pipe -msoft-float -ffreestanding -march=mips32 -Iinclude -Iinclude/asm-mips/mach-atheros -Iinclude/asm/mach-generic -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__ -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32
34 AFLAGS+= -DCONFIG_MIPS_L1_CACHE_SHIFT=5 -DCONFIG_PAGE_SIZE_4KB -DCONFIG_32BIT -DCONFIG_BOOTLOADER
35 ifeq ($(PLATFORM),ap51)
36 CFLAGS+= -DHAVE_ap51
37 AFLAGS+= -DHAVE_ap51
38 endif
39 ifeq ($(PLATFORM),ap61)
40 CFLAGS+= -DHAVE_ap61
41 AFLAGS+= -DHAVE_ap61
42 endif
43 ifeq ($(PLATFORM),ap65)
44 CFLAGS+= -DHAVE_ap65
45 AFLAGS+= -DHAVE_ap65
46 endif
47
48
49 HEAD             = head.o
50 OBJS             = misc_lzma.o lib/lib.o lib/print.o lib/printf.o
51 MEMCPY           = memset.o
52 # CFLAGS         = $(CPPFLAGS) -O2 -DSTDC_HEADERS $(CFLAGS_BOOT)
53 ZLDFLAGS         = -G 0 -static -X -T ld.script
54
55 SYSTEM           = redboot.elf
56
57 #
58 # Architecture dependencies
59 #
60 OBJS            += head-ar5315.o head-ar531x.o
61
62 #ifneq ($(CONFIG_BOOTLOADER),y)
63 #ZTEXTADDR      = 0x80400000
64 #else
65 ZTEXTADDR       = 0x80400000    # 0x9fc00000 Link at cached address
66 ZBSSADDR        = 0x80700000    # Workspace for decompression @ 7MB
67 ZCACHEADDR      = 0x80800000    # decompression cache @ 8 MB
68 #endif
69 ZRELADDR        = 0x80000400  # 0x80002000
70 BOOTBASE        = 0xbfc00000
71
72
73
74 AFLAGS+= -DBOOTBASE=$(BOOTBASE) -DZCACHEADDR=$(ZCACHEADDR)
75 CFLAGS+= -DBOOTBASE=$(BOOTBASE) -DZCACHEADDR=$(ZCACHEADDR)
76
77 SEDFLAGS        = s/@@TEXTADDR@@/$(ZTEXTADDR)/;s/@@LOADADDR@@/$(ZRELADDR)/;
78
79 ifneq ($(ZBSSADDR),)
80 SEDFLAGS        += s/@@BSSADDR@@/$(ZBSSADDR)/
81 else
82 SEDFLAGS        += s/@@BSSADDR@@/ALIGN(4)/
83 endif
84
85 LIBGCC          := $(shell $(CC) $(CFLAGS) --print-libgcc-file-name)
86
87 all:            vmlinuz
88
89 vmlinuz:        $(OBJS) $(HEAD) $(MEMCPY) payload.o ld.script
90                 $(LD) $(ZLDFLAGS) $(HEAD) $(OBJS) $(MEMCPY) payload.o $(LIBGCC) -o vmlinuz
91
92 $(HEAD):        $(HEAD:.o=.S) include/linux/autoconf.h
93                 $(CC) $(AFLAGS) -Iinclude -c $(HEAD:.o=.S) -o $(HEAD)
94
95 head-ar531x.o: head-ar531x.S include/linux/autoconf.h
96                 $(CC) $(AFLAGS) -Iinclude -c head-ar531x.S -o head-ar531x.o
97
98 head-ar5315.o: head-ar5315.S include/linux/autoconf.h
99                 $(CC) $(AFLAGS) -Iinclude -c head-ar5315.S -o head-ar5315.o
100
101 payload.o:      $(SYSTEM) __payload.o
102                 $(OBJCOPY) -O binary -R .note -R .comment -S $(SYSTEM) payload
103                 lzma e -lc1 -lp2 -pb2 payload payload.gz
104                 $(LD) -r -o $@ __payload.o -b binary payload.gz
105 #               rm -f payload payload.gz
106
107 ld.script:      ld.script.in Makefile
108                 sed "$(SEDFLAGS)" < ld.script.in > $@
109
110 clean:;         rm -f payload* ld.script *.o *.c~ *.h~ lib/*.o
111
112 .PHONY: clean
113
114
115 misc.o:         misc.c lib/inflate.c
116
117 misc_lzma.o:            misc_lzma.c lib/LzmaDecode.c
118
119 %.o: %.S
120         $(CC) $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$@) -c -o $@ $<
Note: See TracBrowser for help on using the browser.