summaryrefslogtreecommitdiff
path: root/src/arch/i386/Config.lb
blob: 4c6278acb54f513e74e2ff58a3df3e89e59955fb (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
uses CONFIG_CBFS
uses CONFIG_SMP
uses CONFIG_PRECOMPRESSED_PAYLOAD
uses CONFIG_USE_INIT
uses CONFIG_HAVE_FAILOVER_BOOT
uses CONFIG_USE_FAILOVER_IMAGE
uses CONFIG_USE_FALLBACK_IMAGE
uses CONFIG_CBFS

init init/crt0.S.lb

if CONFIG_CBFS
	if CONFIG_USE_FAILOVER_IMAGE
	else
		initobject /src/lib/cbfs.o
		initobject /src/console/vsprintf.o
		initobject /src/lib/lzma.o
	end
end

if CONFIG_HAVE_FAILOVER_BOOT
	if CONFIG_USE_FAILOVER_IMAGE
		ldscript init/ldscript_failover.lb
	else
		if CONFIG_CBFS
			ldscript init/ldscript_cbfs.lb
		else
			ldscript init/ldscript.lb
		end
	end
else
	if CONFIG_CBFS
		if CONFIG_USE_FALLBACK_IMAGE
			ldscript init/ldscript_fallback_cbfs.lb
		else
			ldscript init/ldscript_cbfs.lb
		end
	else
		if CONFIG_USE_FALLBACK_IMAGE
			ldscript init/ldscript_fallback.lb
		else
			ldscript init/ldscript.lb
		end
	end
end

makerule all
	depends	"coreboot.rom"
end

makerule floppy 
	depends	"all" 
	action	"mcopy -o coreboot.rom a:"
end

makerule nrv2b 
	depends	"$(TOP)/util/nrv2b/nrv2b.c"
	action	"$(HOSTCC) -O2 -DENCODE -DDECODE -DMAIN -DVERBOSE -DNDEBUG -DBITSIZE=32 -DENDIAN=0 $< -o $@"
end

makerule payload
	depends "$(PAYLOAD)"
	action  "cp $< $@"
end

makerule payload.nrv2b
	depends "$(PAYLOAD) nrv2b"
	action  "./nrv2b e $(PAYLOAD) $@"
end

# unlike nrv2b, lzma is a huge build mess. If they want lzma, they have to have built it
makerule payload.lzma
	depends "$(PAYLOAD) "
	action  "lzma -zc $(PAYLOAD) > $@ || lzma e $(PAYLOAD) $@"
end


# this one example shows the mess that has occurred. People are now mixing
# conditional if in the make style with if in the config language style. 
# The -1 is linux standard. 
# I don't much like it but it is the mode nowadays. So coreboot will change
# what a mess. -- RGM
# catch the case where there is no compression
makedefine PAYLOAD-1:=payload

if CONFIG_CBFS
else
# match the case where a compression type is specified.
makedefine PAYLOAD-$(CONFIG_COMPRESSED_PAYLOAD_NRV2B):=payload.nrv2b
makedefine PAYLOAD-$(CONFIG_COMPRESSED_PAYLOAD_LZMA):=payload.lzma
end

# catch the case where there is precompression. Yes, this bites. 
if CONFIG_PRECOMPRESSED_PAYLOAD 
	makedefine PAYLOAD-1:=payload
end

if CONFIG_USE_FAILOVER_IMAGE
	makedefine COREBOOT_APC:=
	makedefine COREBOOT_RAM_ROM:=

	makerule coreboot.rom 
		depends	"coreboot.strip" 
		action "cp $< $@"
	end
else
	makerule coreboot.rom 
		depends	"coreboot.strip buildrom $(PAYLOAD-1)"
		action "PAYLOAD=$(PAYLOAD-1); if [ $(CONFIG_CBFS) -eq 1 ]; then PAYLOAD=/dev/null; touch cbfs-support; fi; ./buildrom $< $@ $$PAYLOAD $(CONFIG_ROM_IMAGE_SIZE) $(CONFIG_ROM_SECTION_SIZE)"
		action "if [ $(CONFIG_COMPRESSED_PAYLOAD_LZMA) -eq 1 -a $(CONFIG_CBFS) -eq 1 ]; then echo l > cbfs-support; fi"
	end
end

makerule crt0.S
	depends "$(CONFIG_CRT0)"
	action  "cp $< $@"
end

addaction clean "rm -f romimage payload.*"

if CONFIG_USE_INIT
	makerule init.o
        	depends "$(INIT-OBJECTS)"
	        action  "$(LD) -melf_i386 -r -o init.pre.o $(INIT-OBJECTS)"
	        action  "$(CONFIG_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"
	end

        makerule coreboot   
		depends	"crt0.o init.o $(COREBOOT_APC) $(COREBOOT_RAM_ROM) ldscript.ld"
		action	"$(CC) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o init.o"
		action	"$(CONFIG_CROSS_COMPILE)nm -n coreboot | sort > coreboot.map"
        end

end

dir lib
dir boot
if CONFIG_SMP
	dir smp
end