1 LOADADDR
= 0x80400000 # RAM start + 4M
2 KERNEL_ENTRY
= 0x80001000
3 RAMSIZE
= 0x00100000 # 1MB
5 CROSS_COMPILE
= mips-linux-
8 $(CPP
) $(CFLAGS
) $< -o
$*.s
10 $(CC
) $(CFLAGS
) -c
$< -o
$*.o
12 $(CC
) $(CFLAGS
) -c
$< -o
$*.o
14 CC
= $(CROSS_COMPILE
)gcc
15 LD
= $(CROSS_COMPILE
)ld
16 OBJCOPY
= $(CROSS_COMPILE
)objcopy
17 OBJDUMP
= $(CROSS_COMPILE
)objdump
19 CFLAGS
= -fno-builtin
-Os
-G
0 -mno-abicalls
-fno-pic
-Wall
-DRAMSIZE
=${RAMSIZE} -DKERNEL_ENTRY
=${KERNEL_ENTRY} -D_LZMA_IN_CB
20 # CFLAGS = -fno-builtin -Os -G 0 -mno-abicalls -fno-pic -Wall -DRAMSIZE=${RAMSIZE}
22 O_FORMAT
= $(shell $(OBJDUMP
) -i | head
-2 | grep elf32
)
24 # Drop some uninteresting sections in the kernel.
25 # This is only relevant for ELF kernels but doesn't hurt a.out
26 drop-sections
= .reginfo .mdebug .comment
27 strip-flags
= $(addprefix --remove-section
=,$(drop-sections
))
33 sed
-e
's,@LOADADDR@,$(LOADADDR),g' $< >$@
35 kernel.o
: vmlinux.lzma lzma.lds
36 $(LD
) -r
-b binary
--oformat
$(O_FORMAT
) -o
$@
$<
38 lzma.elf
: start.o decompress.o LzmaDecode.o kernel.o
39 $(LD
) -s
-Tlzma.lds
-o
$@
$^