2010-08-14 22:38:17 +02:00
##
## This file is part of the coreboot project.
##
## Copyright (C) 2009-2010 coresystems GmbH
## Copyright (C) 2009 Ronald G. Minnich
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; version 2 of the License.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
2009-08-12 17:00:51 +02:00
#######################################################################
# Take care of subdirectories
subdirs - y += boot
2010-01-30 10:47:18 +01:00
# subdirs-y += init
2009-08-12 17:00:51 +02:00
subdirs - y += lib
subdirs - y += smp
2010-09-30 18:55:02 +02:00
OPTION_TABLE_H :=
ifeq ( $ ( CONFIG_HAVE_OPTION_TABLE ), y )
2011-01-30 17:31:15 +01:00
cbfs - files - y += cmos_layout . bin
cmos_layout . bin - file = $ ( obj ) / cmos_layout . bin
cmos_layout . bin - type = 0x01aa
2011-01-18 14:56:36 +01:00
2010-09-30 18:55:02 +02:00
OPTION_TABLE_H := $ ( obj ) / option_table . h
endif
2009-08-12 17:00:51 +02:00
#######################################################################
# Build the final rom image
2010-03-16 17:59:03 +01:00
COREBOOT_ROM_DEPENDENCIES :=
2010-12-30 18:39:50 +01:00
ifeq ( $ ( CONFIG_PAYLOAD_ELF ), y )
2010-12-19 22:20:14 +01:00
COREBOOT_ROM_DEPENDENCIES += $ ( CONFIG_PAYLOAD_FILE )
2010-03-16 17:59:03 +01:00
endif
2010-12-30 18:39:50 +01:00
ifeq ( $ ( CONFIG_PAYLOAD_SEABIOS ), y )
COREBOOT_ROM_DEPENDENCIES += seabios
endif
2011-04-15 05:34:05 +02:00
ifeq ( $ ( CONFIG_PAYLOAD_FILO ), y )
COREBOOT_ROM_DEPENDENCIES += filo
endif
2010-03-30 23:52:05 +02:00
ifeq ( $ ( CONFIG_AP_CODE_IN_CAR ), y )
COREBOOT_ROM_DEPENDENCIES += $ ( obj ) / coreboot_ap
endif
2010-04-21 22:55:38 +02:00
ifeq ( $ ( CONFIG_GEODE_VSA_FILE ), y )
COREBOOT_ROM_DEPENDENCIES += $ ( CONFIG_VSA_FILENAME )
2010-04-20 20:35:33 +02:00
endif
2010-03-30 23:52:05 +02:00
2010-12-16 08:36:28 +01:00
extract_nth = $ ( word $ ( 1 ), $ ( subst | , , $ ( 2 )))
ifneq ( $ ( CONFIG_UPDATE_IMAGE ), y )
prebuild - files = \
$ ( foreach file , $ ( cbfs - files ), \
2011-11-05 03:07:01 +01:00
$ ( CBFSTOOL ) $ @. tmp add $ ( call extract_nth , 1 , $ ( file )) \
$ ( call extract_nth , 2 , $ ( file )) $ ( call extract_nth , 3 , $ ( file )) \
$ ( call extract_nth , 4 , $ ( file )) && )
2010-12-16 08:36:28 +01:00
prebuilt - files = $ ( foreach file , $ ( cbfs - files ), $ ( call extract_nth , 1 , $ ( file )))
2011-04-15 11:01:42 +02:00
$ ( obj ) / coreboot . pre1 : $ ( obj ) / coreboot . bootblock $ $ ( prebuilt - files ) $ ( CBFSTOOL )
2011-11-05 03:07:01 +01:00
$ ( CBFSTOOL ) $ @. tmp create $ ( CONFIG_COREBOOT_ROMSIZE_KB ) K $ ( obj ) / coreboot . bootblock
$ ( prebuild - files ) true
mv $ @. tmp $ @
2010-12-16 08:36:28 +01:00
else
2011-10-28 22:52:11 +02:00
. PHONY : $ ( obj ) / coreboot . pre1
2010-12-16 08:36:28 +01:00
$ ( obj ) / coreboot . pre1 : $ ( CBFSTOOL )
mv $ ( obj ) / coreboot . rom $ @
endif
2010-03-16 20:01:32 +01:00
$ ( obj ) / coreboot . rom : $ ( obj ) / coreboot . pre $ ( obj ) / coreboot_ram $ ( CBFSTOOL ) $ ( call strip_quotes , $ ( COREBOOT_ROM_DEPENDENCIES ))
2010-04-19 22:39:22 +02:00
@ printf " CBFS $ (subst $ (obj)/,, $ (@)) \n "
2010-03-16 17:59:03 +01:00
cp $ ( obj ) / coreboot . pre $ @. tmp
2010-03-30 23:52:05 +02:00
if [ - f $ ( obj ) / coreboot_ap ]; \
2009-08-12 17:00:51 +02:00
then \
2010-03-30 23:52:05 +02:00
$ ( CBFSTOOL ) $ @. tmp add - stage $ ( obj ) / coreboot_ap $ ( CONFIG_CBFS_PREFIX ) / coreboot_ap $ ( CBFS_COMPRESS_FLAG ); \
2009-08-12 17:00:51 +02:00
fi
2010-03-16 17:59:03 +01:00
$ ( CBFSTOOL ) $ @. tmp add - stage $ ( obj ) / coreboot_ram $ ( CONFIG_CBFS_PREFIX ) / coreboot_ram $ ( CBFS_COMPRESS_FLAG )
2009-08-12 17:00:51 +02:00
ifeq ( $ ( CONFIG_PAYLOAD_NONE ), y )
2010-04-19 22:39:22 +02:00
@ printf " PAYLOAD \ e[1;31mnone (as specified by user) \ e[0m \n "
2010-12-30 18:39:50 +01:00
endif
ifeq ( $ ( CONFIG_PAYLOAD_ELF ), y )
2010-12-19 22:20:14 +01:00
@ printf " PAYLOAD $ (CONFIG_PAYLOAD_FILE) (compression: $ (CBFS_PAYLOAD_COMPRESS_NAME)) \n "
$ ( CBFSTOOL ) $ @. tmp add - payload $ ( CONFIG_PAYLOAD_FILE ) $ ( CONFIG_CBFS_PREFIX ) / payload $ ( CBFS_PAYLOAD_COMPRESS_FLAG )
2009-10-23 14:14:15 +02:00
endif
2010-12-30 18:39:50 +01:00
ifeq ( $ ( CONFIG_PAYLOAD_SEABIOS ), y )
@ printf " PAYLOAD SeaBIOS (internal, compression: $ (CBFS_PAYLOAD_COMPRESS_NAME)) \n "
$ ( CBFSTOOL ) $ @. tmp add - payload $ ( CONFIG_PAYLOAD_FILE ) $ ( CONFIG_CBFS_PREFIX ) / payload $ ( CBFS_PAYLOAD_COMPRESS_FLAG )
endif
2011-04-15 05:34:05 +02:00
ifeq ( $ ( CONFIG_PAYLOAD_FILO ), y )
@ printf " PAYLOAD FILO (internal, compression: $ (CBFS_PAYLOAD_COMPRESS_NAME)) \n "
$ ( CBFSTOOL ) $ @. tmp add - payload $ ( CONFIG_PAYLOAD_FILE ) $ ( CONFIG_CBFS_PREFIX ) / payload $ ( CBFS_PAYLOAD_COMPRESS_FLAG )
endif
2010-04-21 22:55:38 +02:00
ifeq ( $ ( CONFIG_GEODE_VSA_FILE ), y )
@ printf " VSA $ (CONFIG_VSA_FILENAME) \n "
$ ( OBJCOPY ) -- set - start 0x20 -- adjust - vma 0x60000 - I binary - O elf32 - i386 - B i386 $ ( CONFIG_VSA_FILENAME ) $ ( obj ) / vsa . o
2010-06-07 16:09:41 +02:00
$ ( LD ) - m elf_i386 - e 0x60020 -- section - start . data = 0x60000 $ ( obj ) / vsa . o - o $ ( obj ) / vsa . elf
2010-04-20 20:35:33 +02:00
$ ( CBFSTOOL ) $ @. tmp add - stage $ ( obj ) / vsa . elf vsa
2011-06-19 03:03:28 +02:00
endif
ifeq ( $ ( CONFIG_INCLUDE_CONFIG_FILE ), y )
@ printf " CONFIG $ (DOTCONFIG) \n "
if [ - f $ ( DOTCONFIG ) ]; then \
echo " # This image was built using git revision " `git rev-parse HEAD` > $ ( obj ) / config . tmp ; \
sed - e '/^#/d' - e '/^ *$$/d' $ ( DOTCONFIG ) >> $ ( obj ) / config . tmp ; \
$ ( CBFSTOOL ) $ @. tmp add $ ( obj ) / config . tmp config raw ; rm - f $ ( obj ) / config . tmp ; fi
2009-08-17 16:46:13 +02:00
endif
2010-03-16 17:59:03 +01:00
mv $ @. tmp $ @
2010-04-19 22:39:22 +02:00
@ printf " CBFSPRINT $ (subst $ (obj)/,, $ (@)) \n \n "
2010-03-16 17:59:03 +01:00
$ ( CBFSTOOL ) $ @ print
2009-08-12 17:00:51 +02:00
2011-01-30 17:37:39 +01:00
stripped_vgabios_id = $ ( call strip_quotes , $ ( CONFIG_VGA_BIOS_ID ))
cbfs - files - $ ( CONFIG_VGA_BIOS ) += pci $ ( stripped_vgabios_id ) . rom
pci $ ( stripped_vgabios_id ) . rom - file := $ ( call strip_quotes , $ ( CONFIG_VGA_BIOS_FILE ))
pci $ ( stripped_vgabios_id ) . rom - type := optionrom
cbfs - files - $ ( CONFIG_INTEL_MBI ) += mbi . bin
mbi . bin - file := $ ( call strip_quotes , $ ( CONFIG_MBI_FILE ))
mbi . bin - type := mbi
cbfs - files - $ ( CONFIG_BOOTSPLASH ) += bootsplash . jpg
bootsplash . jpg - file := $ ( call strip_quotes , $ ( CONFIG_BOOTSPLASH_FILE ))
bootsplash . jpg - type := bootsplash
2009-08-12 17:00:51 +02:00
#######################################################################
# i386 specific tools
2010-09-30 18:55:02 +02:00
$ ( OPTION_TABLE_H ) : $ ( objutil ) / options / build_opt_tbl $ ( top ) / src / mainboard / $ ( MAINBOARDDIR ) / cmos . layout
2009-10-28 18:10:51 +01:00
@ printf " OPTION $ (subst $ (obj)/,, $ (@)) \n "
2010-09-30 18:55:02 +02:00
$ ( objutil ) / options / build_opt_tbl -- config $ ( top ) / src / mainboard / $ ( MAINBOARDDIR ) / cmos . layout -- header $ @
2010-04-15 16:32:17 +02:00
2011-01-18 14:56:36 +01:00
$ ( obj ) / cmos_layout . bin : $ ( objutil ) / options / build_opt_tbl $ ( top ) / src / mainboard / $ ( MAINBOARDDIR ) / cmos . layout
2010-04-15 16:32:17 +02:00
@ printf " OPTION $ (subst $ (obj)/,, $ (@)) \n "
2011-01-18 14:56:36 +01:00
$ ( objutil ) / options / build_opt_tbl -- config $ ( top ) / src / mainboard / $ ( MAINBOARDDIR ) / cmos . layout -- binary $ @
2009-08-12 17:00:51 +02:00
2010-04-17 00:48:57 +02:00
$ ( objutil ) / options / build_opt_tbl : $ ( top ) / util / options / build_opt_tbl . c $ ( top ) / src / include / pc80 / mc146818rtc . h $ ( top ) / src / include / boot / coreboot_tables . h
2009-10-28 18:10:51 +01:00
@ printf " HOSTCC $ (subst $ (obj)/,, $ (@)) \n "
2010-03-29 19:14:28 +02:00
$ ( HOSTCC ) $ ( HOSTCFLAGS ) $ < - o $ @
2009-08-12 17:00:51 +02:00
#######################################################################
# Build the coreboot_ram (stage 2)
2010-12-11 21:33:41 +01:00
$ ( obj ) / coreboot_ram : $ ( obj ) / coreboot_ram . o $ ( src ) / arch / x86 / coreboot_ram . ld #ldoptions
2009-10-28 18:10:51 +01:00
@ printf " CC $ (subst $ (obj)/,, $ (@)) \n "
2012-03-31 08:48:11 +02:00
$ ( CC ) - nostdlib - nostartfiles - static - o $ @. tmp - L $ ( obj ) - T $ ( src ) / arch / x86 / coreboot_ram . ld $ ( obj ) / coreboot_ram . o
$ ( NM ) - n $ @. tmp | sort > $ @. map
$ ( OBJCOPY ) -- only - keep - debug $ @. tmp $ @. debug
$ ( OBJCOPY ) -- strip - debug $ @. tmp
$ ( OBJCOPY ) -- add - gnu - debuglink = $ @. debug $ @. tmp
mv $ @. tmp $ @
2009-08-12 17:00:51 +02:00
2010-12-11 21:33:41 +01:00
$ ( obj ) / coreboot_ram . o : $ ( obj ) / arch / x86 / lib / c_start . ramstage . o $ $ ( driver - objs ) $ ( obj ) / coreboot . a $ ( LIBGCC_FILE_NAME )
2009-10-28 18:10:51 +01:00
@ printf " CC $ (subst $ (obj)/,, $ (@)) \n "
2010-12-11 21:33:41 +01:00
$ ( CC ) - nostdlib - r - o $ @ $ ( obj ) / arch / x86 / lib / c_start . ramstage . o $ ( driver - objs ) - Wl , -- wrap , __divdi3 - Wl , -- wrap , __udivdi3 - Wl , -- wrap , __moddi3 - Wl , -- wrap , __umoddi3 - Wl , -- start - group $ ( obj ) / coreboot . a $ ( LIBGCC_FILE_NAME ) - Wl , -- end - group
2009-08-12 17:00:51 +02:00
2010-09-30 18:55:02 +02:00
$ ( obj ) / coreboot . a : $ $ ( ramstage - objs )
2009-10-28 18:10:51 +01:00
@ printf " AR $ (subst $ (obj)/,, $ (@)) \n "
2009-08-25 21:38:46 +02:00
rm - f $ ( obj ) / coreboot . a
2010-03-27 18:18:39 +01:00
$ ( AR ) cr $ ( obj ) / coreboot . a $ ^
2009-08-12 17:00:51 +02:00
2010-03-30 23:52:05 +02:00
#######################################################################
# coreboot_ap.rom
ifeq ( $ ( CONFIG_AP_CODE_IN_CAR ), y )
$ ( obj ) / coreboot_ap : $ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / ap_romstage . o
@ printf " CC $ (subst $ (obj)/,, $ (@)) \n "
2012-03-31 08:48:11 +02:00
$ ( CC ) - nostdlib - nostartfiles - static - o $ @. tmp - L $ ( obj ) - T $ ( src ) / arch / x86 / init / ldscript_apc . lb $ ^
$ ( OBJCOPY ) -- only - keep - debug $ @. tmp $ @. debug
$ ( OBJCOPY ) -- strip - debug $ @. tmp
$ ( OBJCOPY ) -- add - gnu - debuglink = $ @. debug $ @. tmp
$ ( NM ) - n $ @. tmp | sort > $ @. map
mv $ @. tmp $ @
2010-03-30 23:52:05 +02:00
endif
2009-08-12 17:00:51 +02:00
#######################################################################
# done
2010-12-11 21:33:41 +01:00
crt0s = $ ( src ) / arch / x86 / init / prologue . inc
2010-03-30 22:32:01 +02:00
ldscripts =
2011-04-14 22:30:21 +02:00
ldscripts += $ ( src ) / arch / x86 / init / bootblock . ld
2010-02-25 18:03:17 +01:00
crt0s += $ ( src ) / cpu / x86 / 32 bit / entry32 . inc
2010-02-25 22:50:26 +01:00
ldscripts += $ ( src ) / cpu / x86 / 32 bit / entry32 . lds
2010-02-25 18:03:17 +01:00
crt0s += $ ( src ) / cpu / x86 / fpu_enable . inc
ifeq ( $ ( CONFIG_SSE ), y )
crt0s += $ ( src ) / cpu / x86 / sse_enable . inc
endif
2010-04-12 17:28:34 +02:00
crt0s += $ ( cpu_incs )
#
# FIXME move to CPU_INTEL_SOCKET_MPGA604
#
2010-02-25 18:03:17 +01:00
ifeq ( $ ( CONFIG_BOARD_TYAN_S2735 ), y )
2010-04-14 09:47:07 +02:00
crt0s += $ ( src ) / cpu / intel / car / cache_as_ram . inc
2010-02-25 18:03:17 +01:00
endif
2010-03-13 23:07:15 +01:00
ifeq ( $ ( CONFIG_LLSHELL ), y )
2010-12-11 21:33:41 +01:00
crt0s += $ ( src ) / arch / x86 / llshell / llshell . inc
2010-03-13 23:07:15 +01:00
endif
2010-02-25 18:03:17 +01:00
crt0s += $ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / romstage . inc
2010-04-08 23:04:45 +02:00
ifeq ( $ ( CONFIG_ROMCC ), y )
2010-12-11 21:33:41 +01:00
crt0s += $ ( src ) / arch / x86 / init / crt0_romcc_epilogue . inc
2010-04-08 23:04:45 +02:00
endif
2010-02-09 13:21:10 +01:00
ifeq ( $ ( CONFIG_ROMCC ), y )
ROMCCFLAGS ? = - mcpu = p2 - O2
2010-04-17 01:01:34 +02:00
$ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / romstage . inc : $ ( src ) / mainboard / $ ( MAINBOARDDIR ) / romstage . c $ ( objutil ) / romcc / romcc $ ( OPTION_TABLE_H ) $ ( obj ) / build . h $ ( obj ) / config . h
2010-03-16 13:01:13 +01:00
printf " ROMCC romstage.inc \n "
2010-03-29 15:04:13 +02:00
$ ( ROMCC ) - c - S $ ( ROMCCFLAGS ) - D__PRE_RAM__ - I . $ ( INCLUDES ) $ < - o $ @
2010-02-09 13:21:10 +01:00
else
2010-02-11 09:44:20 +01:00
2010-03-29 23:50:53 +02:00
$ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / ap_romstage . o : $ ( src ) / mainboard / $ ( MAINBOARDDIR ) / ap_romstage . c $ ( OPTION_TABLE_H )
2010-03-24 16:51:48 +01:00
@ printf " CC $ (subst $ (obj)/,, $ (@)) \n "
2011-04-10 06:15:23 +02:00
$ ( CC ) - MMD $ ( CFLAGS ) - I $ ( src ) - D__PRE_RAM__ - I . - I $ ( obj ) - c $ < - o $ @
2010-02-11 09:44:20 +01:00
2011-03-29 11:01:10 +02:00
$ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / romstage . pre . inc : $ ( src ) / mainboard / $ ( MAINBOARDDIR ) / romstage . c $ ( OPTION_TABLE_H ) $ ( obj ) / build . h $ ( obj ) / config . h
2010-04-19 22:39:22 +02:00
@ printf " CC romstage.inc \n "
2010-09-25 12:40:47 +02:00
$ ( CC ) - MMD $ ( CFLAGS ) - D__PRE_RAM__ - I $ ( src ) - I . - I $ ( obj ) - c - S $ < - o $ @
2010-03-24 16:51:48 +01:00
$ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / romstage . inc : $ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / romstage . pre . inc
2010-04-19 22:39:22 +02:00
@ printf " POST romstage.inc \n "
2011-10-12 21:54:08 +02:00
sed - e 's/\.rodata/.rom.data/g' - e 's/\^\.text/.section .rom.text/g' \
- e 's/\^\.section \.text/.section .rom.text/g' $ ^ > $ @. tmp
2010-02-10 19:08:22 +01:00
mv $ @. tmp $ @
2010-02-09 13:21:10 +01:00
endif
2010-02-27 09:39:04 +01:00
# Things that appear in every board
2010-09-30 18:55:02 +02:00
romstage - srcs += $ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / crt0 . s
ramstage - srcs += src / mainboard / $ ( MAINBOARDDIR ) / mainboard . c
2010-02-27 09:39:04 +01:00
ifeq ( $ ( CONFIG_GENERATE_MP_TABLE ), y )
2010-09-30 18:55:02 +02:00
ramstage - srcs += src / mainboard / $ ( MAINBOARDDIR ) / mptable . c
2010-02-27 09:39:04 +01:00
endif
ifeq ( $ ( CONFIG_GENERATE_PIRQ_TABLE ), y )
2010-09-30 18:55:02 +02:00
ramstage - srcs += src / mainboard / $ ( MAINBOARDDIR ) / irq_tables . c
2010-02-27 09:39:04 +01:00
endif
ifeq ( $ ( CONFIG_BOARD_HAS_HARD_RESET ), y )
2010-09-30 18:55:02 +02:00
ramstage - srcs += src / mainboard / $ ( MAINBOARDDIR ) / reset . c
2010-02-27 09:39:04 +01:00
endif
2010-02-28 19:23:00 +01:00
ifeq ( $ ( CONFIG_GENERATE_ACPI_TABLES ), y )
2010-09-30 18:55:02 +02:00
ramstage - srcs += src / mainboard / $ ( MAINBOARDDIR ) / acpi_tables . c
ramstage - srcs += src / mainboard / $ ( MAINBOARDDIR ) / dsdt . asl
2010-03-01 08:42:02 +01:00
# make doesn't have arithmetic operators or greater-than comparisons
ifeq ( $ ( subst 5 , 4 , $ ( CONFIG_ACPI_SSDTX_NUM )), 4 )
2010-09-30 18:55:02 +02:00
ramstage - srcs += src / mainboard / $ ( MAINBOARDDIR ) / ssdt2 . asl
ramstage - srcs += src / mainboard / $ ( MAINBOARDDIR ) / ssdt3 . asl
ramstage - srcs += src / mainboard / $ ( MAINBOARDDIR ) / ssdt4 . asl
2010-03-01 08:42:02 +01:00
endif
ifeq ( $ ( CONFIG_ACPI_SSDTX_NUM ), 5 )
2010-09-30 18:55:02 +02:00
ramstage - srcs += src / mainboard / $ ( MAINBOARDDIR ) / ssdt5 . asl
2010-03-01 08:42:02 +01:00
endif
2010-02-28 19:23:00 +01:00
ifeq ( $ ( CONFIG_BOARD_HAS_FADT ), y )
2010-09-30 18:55:02 +02:00
ramstage - srcs += src / mainboard / $ ( MAINBOARDDIR ) / fadt . c
2010-02-28 19:23:00 +01:00
endif
endif
ifeq ( $ ( CONFIG_HAVE_BUS_CONFIG ), y )
2010-09-30 18:55:02 +02:00
ramstage - srcs += src / mainboard / $ ( MAINBOARDDIR ) / get_bus_conf . c
2010-02-28 19:23:00 +01:00
endif
2010-02-27 09:39:04 +01:00
2011-11-01 18:55:59 +01:00
#######################################################################
# Build the final rom image
$ ( obj ) / coreboot . pre : $ ( obj ) / coreboot . romstage $ ( obj ) / coreboot . pre1 $ ( CBFSTOOL )
@ printf " CBFS $ (subst $ (obj)/,, $ (@)) \n "
2011-11-05 03:07:01 +01:00
cp $ ( obj ) / coreboot . pre1 $ @. tmp
$ ( CBFSTOOL ) $ @. tmp add - stage $ ( obj ) / romstage . elf \
2011-10-01 13:27:32 +02:00
$ ( CONFIG_CBFS_PREFIX ) / romstage x 0 x $ ( shell cat $ ( obj ) / location . txt )
2011-11-05 03:07:01 +01:00
mv $ @. tmp $ @
2011-11-01 18:55:59 +01:00
#FIXME: location.txt might require an offset of header size
#######################################################################
# Build the bootblock
$ ( obj ) / coreboot . bootblock : $ ( obj ) / bootblock . elf
@ printf " OBJCOPY $ (subst $ (obj)/,, $ (@)) \n "
$ ( OBJCOPY ) - O binary $ < $ @
bootblock_lds = $ ( src ) / arch / x86 / init / ldscript_failover . lb
bootblock_lds += $ ( src ) / cpu / x86 / 16 bit / entry16 . lds
bootblock_lds += $ ( src ) / cpu / x86 / 16 bit / reset16 . lds
bootblock_lds += $ ( src ) / arch / x86 / lib / id . lds
bootblock_lds += $ ( chipset_bootblock_lds )
bootblock_inc = $ ( src ) / arch / x86 / init / prologue . inc
bootblock_inc += $ ( src ) / cpu / x86 / 16 bit / entry16 . inc
bootblock_inc += $ ( src ) / cpu / x86 / 16 bit / reset16 . inc
bootblock_inc += $ ( src ) / cpu / x86 / 32 bit / entry32 . inc
bootblock_inc += $ ( src ) / arch / x86 / lib / id . inc
bootblock_inc += $ ( chipset_bootblock_inc )
ifeq ( $ ( CONFIG_SSE ), y )
bootblock_inc += $ ( src ) / cpu / x86 / sse_enable . inc
endif
bootblock_inc += $ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / bootblock . inc
bootblock_inc += $ ( src ) / arch / x86 / lib / walkcbfs . S
bootblock_romccflags := - mcpu = i386 - O2 - D__PRE_RAM__
ifeq ( $ ( CONFIG_SSE ), y )
bootblock_romccflags := - mcpu = k7 - msse - O2 - D__PRE_RAM__
endif
$ ( obj ) / bootblock / ldscript . ld : $ $ ( bootblock_lds ) $ ( obj ) / ldoptions
@ printf " GEN $ (subst $ (obj)/,, $ (@)) \n "
mkdir - p $ ( obj ) / bootblock
printf '$(foreach ldscript,ldoptions $(bootblock_lds),INCLUDE "$(ldscript)"\n)' > $ @
$ ( obj ) / bootblock / bootblock . S : $ $ ( bootblock_inc )
@ printf " GEN $ (subst $ (obj)/,, $ (@)) \n "
mkdir - p $ ( obj ) / bootblock
2012-01-17 13:13:59 +01:00
printf '$(foreach crt0,$(bootblock_inc),#include "$(crt0)"\n)' > $ @
2011-11-01 18:55:59 +01:00
$ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / bootblock . o : $ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / bootblock . s
@ printf " CC $ (subst $ (obj)/,, $ (@)) \n "
2012-03-11 19:34:12 +01:00
$ ( CC ) - Wa , - acdlns - c - o $ @ $ < > $ ( dir $ @ ) / crt0 . disasm
2011-11-01 18:55:59 +01:00
2012-01-17 13:13:59 +01:00
$ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / bootblock . s : $ ( obj ) / bootblock / bootblock . S $ ( obj ) / config . h $ ( obj ) / build . h
2011-11-01 18:55:59 +01:00
@ printf " CC $ (subst $ (obj)/,, $ (@)) \n "
2012-01-17 13:13:59 +01:00
$ ( CC ) - MMD - x assembler - with - cpp - E - I $ ( src ) / include - I $ ( src ) / arch / x86 / include - I $ ( obj ) - I $ ( obj ) / bootblock - include $ ( obj ) / build . h - include $ ( obj ) / config . h - I . - I $ ( src ) $ < - o $ @
2011-11-01 18:55:59 +01:00
$ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / bootblock . inc : $ ( src ) / arch / x86 / init / $ ( subst " ,, $ (CONFIG_BOOTBLOCK_SOURCE)) $ (objutil)/romcc/romcc $ (OPTION_TABLE_H)
@ printf " ROMCC $ (subst $ (obj)/,, $ (@)) \n "
2012-03-11 19:29:46 +01:00
$ ( CC ) $ ( INCLUDES ) - MM - MT $ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / bootblock . inc \
2011-11-01 18:55:59 +01:00
$ < > $ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / bootblock . inc . d
$ ( ROMCC ) - c - S $ ( bootblock_romccflags ) $ ( ROMCCFLAGS ) - I . $ ( INCLUDES ) $ < - o $ @
$ ( obj ) / bootblock . elf : $ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / bootblock . o $ ( obj ) / bootblock / ldscript . ld
@ printf " LINK $ (subst $ (obj)/,, $ (@)) \n "
2012-03-31 08:48:11 +02:00
$ ( CC ) - nostdlib - nostartfiles - static - o $ @. tmp - L $ ( obj ) - T $ ( obj ) / bootblock / ldscript . ld $ <
$ ( NM ) - n $ @. tmp | sort > $ ( obj ) / bootblock . map
$ ( OBJCOPY ) -- only - keep - debug $ @. tmp $ ( obj ) / bootblock . debug
$ ( OBJCOPY ) -- strip - debug $ @. tmp
$ ( OBJCOPY ) -- add - gnu - debuglink = $ ( obj ) / bootblock . debug $ @. tmp
mv $ @. tmp $ @
2011-11-01 18:55:59 +01:00
#######################################################################
# Build the romstage
$ ( obj ) / coreboot . romstage : $ ( obj ) / coreboot . pre1 $ $ ( romstage - objs ) $ ( obj ) / romstage / ldscript . ld
@ printf " LINK $ (subst $ (obj)/,, $ (@)) \n "
2012-03-19 18:12:49 +01:00
printf " ROMSTAGE_BASE = 0x0; \n " > $ ( obj ) / location . ld
2011-11-01 18:55:59 +01:00
$ ( CC ) - nostdlib - nostartfiles - static - o $ ( obj ) / romstage . elf - L $ ( obj ) - T $ ( obj ) / romstage / ldscript . ld $ ( romstage - objs )
$ ( OBJCOPY ) - O binary $ ( obj ) / romstage . elf $ ( obj ) / romstage . bin
2012-03-19 18:12:49 +01:00
printf " ROMSTAGE_BASE = 0x " > $ ( obj ) / location . ld
2012-02-17 14:44:09 +01:00
$ ( CBFSTOOL ) $ ( obj ) / coreboot . pre1 locate $ ( obj ) / romstage . bin $ ( CONFIG_CBFS_PREFIX ) / romstage $ ( CONFIG_XIP_ROM_SIZE ) > $ ( obj ) / location . txt || { echo " The romstage is larger than XIP size. Please expand the CONFIG_XIP_ROM_SIZE " ; exit 1 ; }
2011-11-01 18:55:59 +01:00
cat $ ( obj ) / location . txt >> $ ( obj ) / location . ld
printf ';\n' >> $ ( obj ) / location . ld
$ ( CC ) - nostdlib - nostartfiles - static - o $ ( obj ) / romstage . elf - L $ ( obj ) - T $ ( obj ) / romstage / ldscript . ld $ ( romstage - objs )
$ ( NM ) - n $ ( obj ) / romstage . elf | sort > $ ( obj ) / romstage . map
$ ( OBJCOPY ) -- only - keep - debug $ ( obj ) / romstage . elf $ ( obj ) / romstage . debug
$ ( OBJCOPY ) -- strip - debug $ ( obj ) / romstage . elf
$ ( OBJCOPY ) -- add - gnu - debuglink = $ ( obj ) / romstage . debug $ ( obj ) / romstage . elf
$ ( OBJCOPY ) - O binary $ ( obj ) / romstage . elf $ @
$ ( obj ) / romstage / ldscript . ld : $ $ ( ldscripts ) $ ( obj ) / ldoptions
@ printf " GEN $ (subst $ (obj)/,, $ (@)) \n "
mkdir - p $ ( obj ) / romstage
printf '$(foreach ldscript,ldoptions location.ld $(ldscripts),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' > $ @
$ ( obj ) / romstage / crt0 . S : $ $ ( crt0s )
@ printf " GEN $ (subst $ (obj)/,, $ (@)) \n "
mkdir - p $ ( obj ) / romstage
2012-01-17 13:13:59 +01:00
printf '$(foreach crt0,$(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $ @
2011-11-01 18:55:59 +01:00
$ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / crt0 . romstage . o : $ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / crt0 . s
@ printf " CC $ (subst $ (obj)/,, $ (@)) \n "
2012-03-11 19:34:12 +01:00
$ ( CC ) - Wa , - acdlns - c - o $ @ $ < > $ ( dir $ @ ) / crt0 . disasm
2011-11-01 18:55:59 +01:00
2012-01-17 13:13:59 +01:00
$ ( obj ) / mainboard / $ ( MAINBOARDDIR ) / crt0 . s : $ ( obj ) / romstage / crt0 . S $ ( obj ) / config . h $ ( obj ) / build . h
2011-11-01 18:55:59 +01:00
@ printf " CC $ (subst $ (obj)/,, $ (@)) \n "
2012-01-17 13:13:59 +01:00
$ ( CC ) - MMD - x assembler - with - cpp - E - I $ ( src ) / include - I $ ( src ) / arch / x86 / include - I $ ( obj ) - I $ ( obj ) / romstage - include $ ( obj ) / config . h - include $ ( obj ) / build . h - I . - I $ ( src ) $ < - o $ @
2010-12-30 18:39:50 +01:00
seabios :
$ ( MAKE ) - C payloads / external / SeaBIOS - f Makefile . inc \
2011-02-07 21:16:40 +01:00
HOSTCC = " $ (HOSTCC) " \
2011-01-29 06:51:54 +01:00
CC = " $ (CC) " LD = " $ (LD) " OBJDUMP = " $ (OBJDUMP) " \
OBJCOPY = " $ (OBJCOPY) " STRIP = " $ (STRIP) " \
2010-12-30 18:39:50 +01:00
CONFIG_SEABIOS_MASTER = $ ( CONFIG_SEABIOS_MASTER ) \
2012-01-21 19:34:22 +01:00
CONFIG_SEABIOS_STABLE = $ ( CONFIG_SEABIOS_STABLE ) \
OUT = $ ( abspath $ ( obj ))
2011-04-15 05:34:05 +02:00
filo :
$ ( MAKE ) - C payloads / external / FILO - f Makefile . inc \
HOSTCC = " $ (HOSTCC) " \
CC = " $ (CC) " LD = " $ (LD) " OBJDUMP = " $ (OBJDUMP) " \
OBJCOPY = " $ (OBJCOPY) " STRIP = " $ (STRIP) " \
CONFIG_FILO_MASTER = $ ( CONFIG_FILO_MASTER ) \
CONFIG_FILO_STABLE = $ ( CONFIG_FILO_STABLE )
2010-12-30 18:39:50 +01:00