3a2574a244f3e84a9b4f99f4e15fbf48cb40fcef
[coreboot.git] / src / arch / i386 / Config.lb
1 uses CONFIG_SMP
2 uses CONFIG_PRECOMPRESSED_PAYLOAD
3 uses CONFIG_USE_INIT
4 uses HAVE_FAILOVER_BOOT
5 uses USE_FAILOVER_IMAGE
6 uses USE_FALLBACK_IMAGE
7
8 init init/crt0.S.lb
9
10 if HAVE_FAILOVER_BOOT
11       if USE_FAILOVER_IMAGE
12               ldscript init/ldscript_failover.lb
13       else
14               ldscript init/ldscript.lb
15       end
16 else
17       if USE_FALLBACK_IMAGE
18               ldscript init/ldscript_fallback.lb
19       else
20               ldscript init/ldscript.lb
21       end
22 end
23
24 makerule all
25         depends "coreboot.rom"
26 end
27
28 makerule floppy 
29         depends "all" 
30         action  "mcopy -o coreboot.rom a:"
31 end
32
33 makerule nrv2b 
34         depends "$(TOP)/util/nrv2b/nrv2b.c"
35         action  "$(HOSTCC) -O2 -DENCODE -DDECODE -DMAIN -DVERBOSE -DNDEBUG -DBITSIZE=32 -DENDIAN=0 $< -o $@"
36 end
37
38 makerule payload
39         depends "$(PAYLOAD)"
40         action  "cp $< $@"
41 end
42
43 makerule payload.nrv2b
44         depends "$(PAYLOAD) nrv2b"
45         action  "./nrv2b e $(PAYLOAD) $@"
46 end
47
48 # unlike nrv2b, lzma is a huge build mess. If they want lzma, they have to have built it
49 makerule payload.lzma
50         depends "$(PAYLOAD) "
51         action  "lzma -zc $(PAYLOAD) > $@ || lzma e $(PAYLOAD) $@"
52 end
53
54
55 # this one example shows the mess that has occurred. People are now mixing
56 # conditional if in the make style with if in the config language style. 
57 # The -1 is linux standard. 
58 # I don't much like it but it is the mode nowadays. So coreboot will change
59 # what a mess. -- RGM
60 # catch the case where there is no compression
61 makedefine PAYLOAD-1:=payload
62
63 # match the case where a compression type is specified.
64 makedefine PAYLOAD-$(CONFIG_COMPRESSED_PAYLOAD_NRV2B):=payload.nrv2b
65 makedefine PAYLOAD-$(CONFIG_COMPRESSED_PAYLOAD_LZMA):=payload.lzma
66
67 # catch the case where there is precompression. Yes, this bites. 
68 if CONFIG_PRECOMPRESSED_PAYLOAD 
69         makedefine PAYLOAD-1:=payload
70 end
71
72 if USE_FAILOVER_IMAGE
73         makedefine COREBOOT_APC:=
74         makedefine COREBOOT_RAM_ROM:=
75
76         makerule coreboot.rom 
77                 depends "coreboot.strip" 
78                 action "cp $< $@"
79         end
80 else
81         makerule coreboot.rom 
82                 depends "coreboot.strip buildrom $(PAYLOAD-1)"
83                 action "PAYLOAD=$(PAYLOAD-1); if [ $(CONFIG_ROMFS) -eq 1 ]; then PAYLOAD=/dev/null; touch romfs-support; fi; ./buildrom $< $@ $$PAYLOAD $(ROM_IMAGE_SIZE) $(ROM_SECTION_SIZE)"
84                 action "if [ $(CONFIG_COMPRESSED_PAYLOAD_LZMA) -eq 1 -a $(CONFIG_ROMFS) -eq 1 ]; then echo l > romfs-support; fi"
85         end
86 end
87
88 makerule crt0.S
89         depends "$(CRT0)"
90         action  "cp $< $@"
91 end
92
93 addaction clean "rm -f romimage payload.*"
94
95 if CONFIG_USE_INIT
96         makerule init.o
97                 depends "$(INIT-OBJECTS)"
98                 action  "$(LD) -melf_i386 -r -o init.pre.o $(INIT-OBJECTS)"
99                 action  "$(OBJCOPY) --rename-section .text=.init.text --rename-section .data=.init.data --rename-section .rodata=.init.rodata --rename-section .rodata.str1.1=.init.rodata.str1.1 init.pre.o init.o"
100         end
101
102         makerule coreboot   
103                 depends "crt0.o init.o $(COREBOOT_APC) $(COREBOOT_RAM_ROM) ldscript.ld"
104                 action  "$(CC) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o init.o"
105                 action  "$(CROSS_COMPILE)nm -n coreboot | sort > coreboot.map"
106         end
107
108 end
109
110 dir lib
111 dir boot
112 if CONFIG_SMP
113         dir smp
114 end