mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 20:47:55 +00:00
musl-cross-make: replace all cross compilers with musl-cross-make
Signed-off-by: Trammell Hudson <hudson@trmm.net>
This commit is contained in:
parent
8af849cadc
commit
791d064397
14
Makefile
14
Makefile
@ -106,11 +106,13 @@ SHELL := /bin/bash
|
||||
# be defined prior to any other module.
|
||||
include modules/musl-cross
|
||||
|
||||
musl_dep := musl
|
||||
heads_cc := $(INSTALL)/bin/musl-gcc \
|
||||
musl_dep := musl-cross
|
||||
heads_cc := $(CROSS)gcc \
|
||||
-fdebug-prefix-map=$(pwd)=heads \
|
||||
-gno-record-gcc-switches \
|
||||
-D__MUSL__ \
|
||||
-I$(INSTALL)/include \
|
||||
-L$(INSTALL)/lib \
|
||||
|
||||
CROSS_TOOLS_NOCC := \
|
||||
AR="$(CROSS)ar" \
|
||||
@ -145,8 +147,9 @@ all:
|
||||
FORCE:
|
||||
|
||||
# Make helpers to operate on lists of things
|
||||
# Prefix is "smart" and doesn't add the prefix for absolute file paths
|
||||
define prefix =
|
||||
$(foreach _, $2, $1$_)
|
||||
$(foreach _, $2, $(if $(patsubst /%,,$_),$1$_,$_))
|
||||
endef
|
||||
define map =
|
||||
$(foreach _,$2,$(eval $(call $1,$_)))
|
||||
@ -410,6 +413,7 @@ endef
|
||||
|
||||
# Only some modules have binaries that we install
|
||||
# Shouldn't this be specified in the module file?
|
||||
#bin_modules-$(CONFIG_MUSL) += musl-cross
|
||||
bin_modules-$(CONFIG_KEXEC) += kexec
|
||||
bin_modules-$(CONFIG_TPMTOTP) += tpmtotp
|
||||
bin_modules-$(CONFIG_PCIUTILS) += pciutils
|
||||
@ -451,8 +455,7 @@ endif
|
||||
$(COREBOOT_UTIL_DIR)/cbmem/cbmem \
|
||||
$(COREBOOT_UTIL_DIR)/superiotool/superiotool \
|
||||
$(COREBOOT_UTIL_DIR)/inteltool/inteltool \
|
||||
: $(build)/$(coreboot_base_dir)/.canary \
|
||||
$(build)/$(musl_dir)/.build
|
||||
: $(build)/$(coreboot_base_dir)/.canary
|
||||
+$(call do,MAKE,$(notdir $@),\
|
||||
$(MAKE) -C "$(dir $@)" $(CROSS_TOOLS) \
|
||||
)
|
||||
@ -564,7 +567,6 @@ modules.clean:
|
||||
real.clean:
|
||||
for dir in \
|
||||
$(module_dirs) \
|
||||
$(musl_dir) \
|
||||
$(kernel_headers) \
|
||||
; do \
|
||||
if [ ! -z "$$dir" ]; then \
|
||||
|
BIN
blobs/dev.cpio
BIN
blobs/dev.cpio
Binary file not shown.
@ -1,4 +1,5 @@
|
||||
CONFIG_LOCALVERSION="heads"
|
||||
CONFIG_ANY_TOOLCHAIN=y
|
||||
CONFIG_USE_OPTION_TABLE=y
|
||||
# CONFIG_COLLECT_TIMESTAMPS is not set
|
||||
CONFIG_VENDOR_ASUS=y
|
||||
|
@ -1,4 +1,5 @@
|
||||
CONFIG_LOCALVERSION="4.8.1-Purism-1-heads-beta"
|
||||
CONFIG_ANY_TOOLCHAIN=y
|
||||
CONFIG_USE_BLOBS=y
|
||||
CONFIG_MEASURED_BOOT=y
|
||||
CONFIG_VENDOR_PURISM=y
|
||||
|
@ -1,4 +1,5 @@
|
||||
CONFIG_LOCALVERSION="4.8.1-Purism-1-heads-beta"
|
||||
CONFIG_ANY_TOOLCHAIN=y
|
||||
CONFIG_USE_BLOBS=y
|
||||
CONFIG_MEASURED_BOOT=y
|
||||
CONFIG_VENDOR_PURISM=y
|
||||
|
@ -1,4 +1,5 @@
|
||||
CONFIG_LOCALVERSION="4.8.1-Purism-1-heads-beta"
|
||||
CONFIG_ANY_TOOLCHAIN=y
|
||||
CONFIG_USE_BLOBS=y
|
||||
CONFIG_MEASURED_BOOT=y
|
||||
CONFIG_VENDOR_PURISM=y
|
||||
|
@ -1,4 +1,5 @@
|
||||
CONFIG_LOCALVERSION="4.8.1-Purism-1-heads-beta"
|
||||
CONFIG_ANY_TOOLCHAIN=y
|
||||
CONFIG_USE_BLOBS=y
|
||||
CONFIG_MEASURED_BOOT=y
|
||||
CONFIG_VENDOR_PURISM=y
|
||||
|
@ -1,4 +1,5 @@
|
||||
CONFIG_LOCALVERSION="-heads"
|
||||
CONFIG_ANY_TOOLCHAIN=y
|
||||
# CONFIG_INCLUDE_CONFIG_FILE is not set
|
||||
CONFIG_CBFS_SIZE=0x700000
|
||||
# CONFIG_POST_IO is not set
|
||||
|
@ -1,4 +1,5 @@
|
||||
CONFIG_LOCALVERSION="heads"
|
||||
CONFIG_ANY_TOOLCHAIN=y
|
||||
# CONFIG_INCLUDE_CONFIG_FILE is not set
|
||||
# CONFIG_COLLECT_TIMESTAMPS is not set
|
||||
CONFIG_USE_BLOBS=y
|
||||
|
@ -1,4 +1,5 @@
|
||||
CONFIG_LOCALVERSION="heads"
|
||||
CONFIG_ANY_TOOLCHAIN=y
|
||||
# CONFIG_INCLUDE_CONFIG_FILE is not set
|
||||
# CONFIG_COLLECT_TIMESTAMPS is not set
|
||||
CONFIG_USE_BLOBS=y
|
||||
|
@ -1,4 +1,5 @@
|
||||
CONFIG_LOCALVERSION="heads"
|
||||
CONFIG_ANY_TOOLCHAIN=y
|
||||
# CONFIG_INCLUDE_CONFIG_FILE is not set
|
||||
# CONFIG_COLLECT_TIMESTAMPS is not set
|
||||
CONFIG_USE_BLOBS=y
|
||||
|
@ -9,7 +9,7 @@ coreboot_tar := coreboot-$(coreboot_version).tar.xz
|
||||
coreboot_url := https://www.coreboot.org/releases/$(coreboot_tar)
|
||||
coreboot_hash := f0ddf4db0628c1fe1e8348c40084d9cbeb5771400c963fd419cda3995b69ad23
|
||||
|
||||
# Coreboot builds are specialized on a per-target basis.
|
||||
# coreboot builds are specialized on a per-target basis.
|
||||
# The builds are done in a per-target subdirectory
|
||||
CONFIG_COREBOOT_CONFIG ?= config/coreboot-$(BOARD).config
|
||||
|
||||
@ -29,9 +29,18 @@ coreboot_configure := \
|
||||
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
|
||||
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
|
||||
|
||||
COREBOOT_IASL="$(build)/$(coreboot_base_dir)/util/crossgcc/xgcc/bin/iasl"
|
||||
|
||||
# coreboot is built with the 32-bit compiler; ideally we could use the same
|
||||
# x86_64-linux-musl -m32 to build it, but this causes some link errors that need
|
||||
# to be tracked down.
|
||||
# CROSS="$(CROSS)" \
|
||||
|
||||
coreboot_target := \
|
||||
-C "$(build)/$(coreboot_base_dir)" \
|
||||
obj="$(build)/$(coreboot_dir)" \
|
||||
CROSS="$(dir $(CROSS))i386-linux-musl-" \
|
||||
IASL="$(COREBOOT_IASL)" \
|
||||
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
|
||||
BUILD_TIMELESS=1 \
|
||||
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
|
||||
@ -39,35 +48,11 @@ coreboot_target := \
|
||||
$(MAKE_JOBS)
|
||||
|
||||
coreboot_output := coreboot.rom
|
||||
coreboot_depend += linux initrd
|
||||
coreboot_depend += linux initrd $(musl_dep)
|
||||
|
||||
COREBOOT_XGCC_REL := $(coreboot_base_dir)/util/crossgcc/xgcc
|
||||
COREBOOT_XGCC_PATH := $(build)/$(COREBOOT_XGCC_REL)
|
||||
COREBOOT_XGCC := $(COREBOOT_XGCC_PATH)/bin/i386-elf-gcc
|
||||
|
||||
# hack to force a build dependency on the cross compiler
|
||||
coreboot-gcc $(build)/$(coreboot_dir)/.configured: $(COREBOOT_XGCC)
|
||||
|
||||
ifeq "$(TOOLCHAIN)" ""
|
||||
# Force a rebuild of the entire coreboot toolchain
|
||||
$(COREBOOT_XGCC): $(build)/$(coreboot_base_dir)/.canary
|
||||
echo '******* Building crossgcc-i386 (this might take a while) ******'
|
||||
$(MAKE) -C "$(build)/$(coreboot_base_dir)" CPUS=`nproc` crossgcc-i386
|
||||
#echo '******* Building crossgcc-arm (this might take a while) ******'
|
||||
#$(MAKE) -C "$(build)/$(coreboot_base_dir)" crossgcc-arm
|
||||
else
|
||||
# Use the pre-build one from the external toolchain build
|
||||
$(COREBOOT_XGCC): $(build)/$(coreboot_base_dir)/.canary
|
||||
if [ ! -e "$(TOOLCHAIN)/build/$(COREBOOT_XGCC_REL)" ]; then \
|
||||
echo >&2 "ERROR: TOOLCHAIN=$(TOOLCHAIN) does not have coreboot" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
if [ ! -e "$(COREBOOT_XGCC_PATH)" ]; then \
|
||||
ln -s \
|
||||
"$(TOOLCHAIN)/build/$(COREBOOT_XGCC_REL)" \
|
||||
"$(COREBOOT_XGCC_PATH)" ; \
|
||||
fi
|
||||
endif
|
||||
$(build)/$(coreboot_dir)/.configured: $(COREBOOT_IASL)
|
||||
$(COREBOOT_IASL): $(build)/$(coreboot_base_dir)/.canary
|
||||
$(MAKE) -C "$(build)/$(coreboot_base_dir)" CPUS=`nproc` iasl
|
||||
|
||||
# Force a rebuild if the inputs have changed
|
||||
$(build)/$(coreboot_dir)/.build: \
|
||||
|
41
modules/musl
41
modules/musl
@ -1,41 +0,0 @@
|
||||
CONFIG_MUSL ?= y
|
||||
modules-$(CONFIG_MUSL) += musl
|
||||
|
||||
musl_version := 1.1.15
|
||||
musl_dir := musl-$(musl_version)
|
||||
musl_tar := musl-$(musl_version).tar.gz
|
||||
musl_url := https://www.musl-libc.org/releases/$(musl_tar)
|
||||
musl_hash := 97e447c7ee2a7f613186ec54a93054fe15469fe34d7d323080f7ef38f5ecb0fa
|
||||
|
||||
musl_output := ../../install/bin/musl-gcc
|
||||
|
||||
#
|
||||
# Note that for syslibdir to be /lib the install will fail.
|
||||
# this is unfortunate since it prevents the binaries from running
|
||||
# and requires that we treat the rest of the build as a cross compile.
|
||||
#
|
||||
# That works, with some hacks...
|
||||
#
|
||||
musl_configure := ./configure \
|
||||
$(CROSS_TOOLS_NOCC) \
|
||||
CC="$(CROSS)gcc" \
|
||||
--prefix="$(INSTALL)" \
|
||||
--syslibdir="/lib" \
|
||||
--enable-gcc-wrapper \
|
||||
--enable-shared \
|
||||
|
||||
musl_target := \
|
||||
$(MAKE_JOBS) \
|
||||
$(CROSS_TOOLS_NOCC) \
|
||||
CC="$(CROSS)gcc" \
|
||||
install \
|
||||
|
||||
musl_libraries := \
|
||||
lib/libc.so \
|
||||
|
||||
|
||||
musl_depends := musl-cross
|
||||
|
||||
# Fake a target so that musl will force a header install by the
|
||||
# Linux kernel sources.
|
||||
$(build)/$(musl_dir)/.build: $(INSTALL)/include/linux/limits.h
|
@ -1,5 +1,14 @@
|
||||
CONFIG_MUSL ?= y
|
||||
|
||||
ifeq "$(MUSL_CROSS_ONCE)" ""
|
||||
MUSL_CROSS_ONCE := 1
|
||||
modules-$(CONFIG_MUSL) += musl-cross
|
||||
|
||||
musl-cross_version := 38e52db
|
||||
musl-cross_dir := musl-cross-$(musl-cross_version)
|
||||
musl-cross_url := https://github.com/richfelker/musl-cross-make/archive/$(musl-cross_version).tar.gz
|
||||
musl-cross_tar := musl-cross-$(musl-cross_version).tar.gz
|
||||
musl-cross_hash := b4b85d6d3ddab0f2b8650a53e775673f8c346fa2fb07d652a9880bd206ade100
|
||||
|
||||
|
||||
ifneq "$(CROSS)" ""
|
||||
@ -7,39 +16,47 @@ ifneq "$(CROSS)" ""
|
||||
# check that $(CROSS)gcc exists or else things just won't work
|
||||
ifneq "y" "$(shell [ -x '$(CROSS)gcc' ] && echo y)"
|
||||
$(error $(CROSS)gcc does not exist - can not build)
|
||||
else
|
||||
$(info Using $(CROSS)gcc)
|
||||
endif
|
||||
|
||||
# The cross compiler has already been built, so the musl-cross target
|
||||
# is a NOP.
|
||||
#musl-cross.intermediate:
|
||||
# is a NOP. We really don't need to check out this code tree, but it is easier
|
||||
# if we have a target for it.
|
||||
musl-cross_target := --version
|
||||
|
||||
musl-cross_dir := musl-cross-ext
|
||||
$(build)/$(musl-cross_dir)/.build:
|
||||
mkdir -p $(dir $@)
|
||||
touch $@
|
||||
# Ask the compiler where to find its own libc.so
|
||||
musl-cross_libraries := \
|
||||
$(shell $(CROSS)gcc --print-file-name=libc.so) \
|
||||
|
||||
else
|
||||
|
||||
# Force a full build of the cross compiler
|
||||
|
||||
modules-y += musl-cross
|
||||
musl-cross_version := 1952975
|
||||
musl-cross_dir := musl-cross
|
||||
musl-cross_url := https://github.com/GregorR/musl-cross/archive/$(musl-cross_version).tar.gz
|
||||
musl-cross_tar := musl-cross-$(musl-cross_version).tar.gz
|
||||
musl-cross_hash := dea10cfe4bfe5f5b131d8f98e65127cf5093477af56054d15563e858dc3b25cb
|
||||
|
||||
CROSS_TOP := crossgcc/x86_64-linux-musl/bin/x86_64-linux-musl-
|
||||
CROSS := $(build)/../$(CROSS_TOP)
|
||||
musl-cross_output := ../../$(CROSS_TOP)gcc
|
||||
# have to build both x86_64 and i386 versions for coreboot
|
||||
|
||||
musl-cross_configure := \
|
||||
/bin/echo -e > Makefile \
|
||||
'$(musl-cross_output):\n\tCC_BASE_PREFIX="$(pwd)/crossgcc" ./build.sh'
|
||||
/bin/echo -e >> Makefile 'both:' ; \
|
||||
/bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET=x86_64-linux-musl install' ; \
|
||||
/bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET=i386-linux-musl install' ; \
|
||||
|
||||
CROSS_PATH ?= $(pwd)/crossgcc
|
||||
|
||||
musl-cross_target := \
|
||||
OUTPUT="$(CROSS_PATH)" \
|
||||
MAKE="$(MAKE)" \
|
||||
both
|
||||
|
||||
CROSS := $(CROSS_PATH)/bin/x86_64-linux-musl-
|
||||
musl-cross_libraries := $(CROSS_PATH)/x86_64-linux-musl/lib/libc.so
|
||||
|
||||
endif
|
||||
|
||||
musl-cross_target :=
|
||||
|
||||
musl-cross_output := $(CROSS)gcc
|
||||
|
||||
## Fake a target so that musl will force a header install by the
|
||||
## Linux kernel sources.
|
||||
$(build)/$(musl-cross_dir)/.build: $(INSTALL)/include/linux/limits.h
|
||||
|
||||
|
||||
endif
|
||||
|
27
patches/coreboot-4.8.1/0010-cross-compiler-support.patch
Normal file
27
patches/coreboot-4.8.1/0010-cross-compiler-support.patch
Normal file
@ -0,0 +1,27 @@
|
||||
--- clean/coreboot-4.8.1/Makefile 2018-05-16 21:00:17.000000000 +0200
|
||||
+++ coreboot-4.8.1/Makefile 2020-01-08 17:01:32.998287979 +0100
|
||||
@@ -152,6 +152,24 @@
|
||||
|
||||
-include .xcompile
|
||||
|
||||
+ifneq "$(CROSS)" ""
|
||||
+ $(info coreboot: Using $(CROSS)gcc)
|
||||
+ CROSS_COMPILE_x86_32 := $(CROSS)
|
||||
+ CC_x86_32 := $(CROSS_COMPILE_x86_32)gcc
|
||||
+ CPP_x86_32 := $(CROSS_COMPILE_x86_32)cpp
|
||||
+ AS_x86_32 := $(CROSS_COMPILE_x86_32)as --32
|
||||
+ LD_x86_32 := $(CROSS_COMPILE_x86_32)ld.bfd -b elf32-i386 -melf_i386
|
||||
+ NM_x86_32 := $(CROSS_COMPILE_x86_32)nm
|
||||
+ OBJCOPY_x86_32 := $(CROSS_COMPILE_x86_32)objcopy
|
||||
+ OBJDUMP_x86_32 := $(CROSS_COMPILE_x86_32)objdump
|
||||
+ READELF_x86_32 := $(CROSS_COMPILE_x86_32)readelf
|
||||
+ STRIP_x86_32 := $(CROSS_COMPILE_x86_32)strip
|
||||
+ AR_x86_32 := $(CROSS_COMPILE_x86_32)ar
|
||||
+ GNATBIND_x86_32 := $(CROSS_COMPILE_x86_32)gnatbind
|
||||
+ COMPILER_RT_x86_32 := $(shell $(CC_x86_32) --print-libgcc-file-name)
|
||||
+endif
|
||||
+
|
||||
+
|
||||
ifneq ($(XCOMPILE_COMPLETE),1)
|
||||
$(shell rm -f .xcompile)
|
||||
$(error .xcompile deleted because it's invalid. \
|
Loading…
Reference in New Issue
Block a user