mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 20:47:55 +00:00
Merge branch 'musl-libc'
This commit is contained in:
commit
a8f2f0ec4a
30
Makefile
30
Makefile
@ -8,6 +8,11 @@ INSTALL := $(pwd)/install
|
||||
# Currently supported targets are x230, chell and qemu
|
||||
BOARD ?= qemu
|
||||
|
||||
# If musl-libc is being used in the initrd, set the heads_cc
|
||||
# variable to point to it.
|
||||
musl_dep := musl
|
||||
heads_cc := $(INSTALL)/bin/musl-gcc
|
||||
|
||||
all: $(BOARD).rom
|
||||
|
||||
# Disable all built in rules
|
||||
@ -68,7 +73,8 @@ define define_module =
|
||||
$(build)/$($1_dir)/.canary: $(packages)/.$1_verify
|
||||
tar -xf "$(packages)/$($1_tar)" -C "$(build)"
|
||||
if [ -r patches/$1-$($1_version).patch ]; then \
|
||||
( cd $(build)/$($1_dir) ; patch -p1 ) < patches/$1-$($1_version).patch; \
|
||||
( cd $(build)/$($1_dir) ; patch -p1 ) \
|
||||
< patches/$1-$($1_version).patch; \
|
||||
fi
|
||||
touch "$$@"
|
||||
endif
|
||||
@ -100,6 +106,7 @@ define define_module =
|
||||
# Target for all of the outputs, which depend on their dependent modules
|
||||
$1.intermediate: \
|
||||
$(foreach d,$($1_depends),$(call outputs,$d)) \
|
||||
$(foreach d,$($1_depends),$d.intermediate) \
|
||||
$(build)/$($1_dir)/.configured
|
||||
make -C "$(build)/$($1_dir)" $($1_target)
|
||||
|
||||
@ -108,7 +115,7 @@ endef
|
||||
|
||||
$(foreach _, $(modules), $(eval $(call define_module,$_)))
|
||||
|
||||
initrd_lib_dir := initrd/lib/x86_64-linux-gnu
|
||||
initrd_lib_dir := initrd/lib
|
||||
initrd_bin_dir := initrd/bin
|
||||
|
||||
#
|
||||
@ -163,16 +170,21 @@ initrd/bin/busybox: $(build)/$(busybox_dir)/busybox
|
||||
cmp --quiet "$@" "$^" || \
|
||||
make \
|
||||
-C $(build)/$(busybox_dir) \
|
||||
CC="$(heads_cc)" \
|
||||
CONFIG_PREFIX="$(pwd)/initrd" \
|
||||
-j 8 \
|
||||
install
|
||||
|
||||
# hack to build cbmem from coreboot
|
||||
# this must be built *AFTER* musl
|
||||
initrd_bins += initrd/bin/cbmem
|
||||
initrd/bin/cbmem: $(build)/$(coreboot_dir)/util/cbmem/cbmem
|
||||
cmp --quiet "$^" "$@" \
|
||||
|| cp "$^" "$@"
|
||||
$(build)/$(coreboot_dir)/util/cbmem/cbmem: $(build)/$(coreboot_dir)/.canary
|
||||
make -C "$(dir $@)"
|
||||
$(build)/$(coreboot_dir)/util/cbmem/cbmem: \
|
||||
$(build)/$(coreboot_dir)/.canary \
|
||||
musl.intermediate
|
||||
make -C "$(dir $@)" CC="$(heads_cc)"
|
||||
|
||||
|
||||
# Update all of the libraries in the initrd based on the executables
|
||||
@ -182,11 +194,11 @@ initrd_lib_install: $(initrd_bins) $(initrd_libs)
|
||||
| xargs -0 strip
|
||||
LD_LIBRARY_PATH="$(INSTALL)/lib" \
|
||||
./populate-lib \
|
||||
./initrd/lib/x86_64-linux-gnu/ \
|
||||
$(initrd_lib_dir) \
|
||||
initrd/bin/* \
|
||||
initrd/sbin/* \
|
||||
|
||||
-strip ./initrd/lib/x86_64-linux-gnu/*
|
||||
-strip $(initrd_lib_dir)/* ; true
|
||||
|
||||
|
||||
#
|
||||
@ -247,3 +259,9 @@ x230.rom: $(build)/$(coreboot_dir)/x230/coreboot.rom
|
||||
|
||||
qemu.rom: $(build)/$(coreboot_dir)/qemu/coreboot.rom
|
||||
cp -a "$<" "$@"
|
||||
|
||||
clean-modules:
|
||||
for dir in busybox-1.25.0 cryptsetup-1.7.3 gnupg-1.4.21 kexec-tools-2.0.12 libuuid-1.0.3 LVM2.2.02.168 mbedtls-2.3.0 popt-1.16 qrencode-3.4.4 tpmtotp-git ; do \
|
||||
make -C build/$$dir clean; \
|
||||
rm build/$$dir/.configured; \
|
||||
done
|
||||
|
1
initrd/lib/ld-musl-x86_64.so.1
Symbolic link
1
initrd/lib/ld-musl-x86_64.so.1
Symbolic link
@ -0,0 +1 @@
|
||||
./libc.so
|
@ -1 +0,0 @@
|
||||
../lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
|
@ -6,7 +6,13 @@ busybox_tar := busybox-$(busybox_version).tar.bz2
|
||||
busybox_url := https://busybox.net/downloads/$(busybox_tar)
|
||||
busybox_hash := 5a0fe06885ee1b805fb459ab6aaa023fe4f2eccee4fb8c0fd9a6c17c0daca2fc
|
||||
|
||||
busybox_configure := make oldconfig
|
||||
busybox_configure := make CC=$(heads_cc) oldconfig
|
||||
busybox_config := busybox.config
|
||||
busybox_output := busybox
|
||||
busybox_target := \
|
||||
CC="$(heads_cc)" \
|
||||
CONFIG_PREFIX="$(INSTALL)" \
|
||||
-j 8 \
|
||||
install
|
||||
|
||||
busybox_depends := $(musl_dep)
|
||||
|
@ -1,6 +1,6 @@
|
||||
modules += cryptsetup
|
||||
|
||||
cryptsetup_depends := libuuid popt lvm2
|
||||
cryptsetup_depends := libuuid popt lvm2 $(musl_dep)
|
||||
|
||||
cryptsetup_version := 1.7.3
|
||||
cryptsetup_dir := cryptsetup-$(cryptsetup_version)
|
||||
@ -9,13 +9,17 @@ cryptsetup_url := https://www.kernel.org/pub/linux/utils/cryptsetup/v1.7/cryptse
|
||||
cryptsetup_hash := af2b04e8475cf40b8d9ffd97a1acfa73aa787c890430afd89804fb544d6adc02
|
||||
|
||||
cryptsetup_configure := ./configure \
|
||||
CC="$(heads_cc)" \
|
||||
CFLAGS="-I$(INSTALL)/include" \
|
||||
LDFLAGS="-L$(INSTALL)/lib" \
|
||||
--host i386-elf-linux \
|
||||
--prefix "$(INSTALL)" \
|
||||
--disable-gcrypt-pbkdf2 \
|
||||
--with-crypto_backend=kernel \
|
||||
|
||||
cryptsetup_target := -j 8 install
|
||||
cryptsetup_target := \
|
||||
-j 8 \
|
||||
install
|
||||
|
||||
cryptsetup_output := \
|
||||
src/.libs/cryptsetup \
|
||||
|
@ -9,12 +9,13 @@ gpg_url := https://www.gnupg.org/ftp/gcrypt/gnupg/$(gpg_tar)
|
||||
gpg_hash := 6b47a3100c857dcab3c60e6152e56a997f2c7862c1b8b2b25adf3884a1ae2276
|
||||
|
||||
gpg_configure := ./configure \
|
||||
CFLAGS="-I$(INSTALL)/include" \
|
||||
LDFLAGS="-L$(INSTALL)/lib" \
|
||||
CC="$(heads_cc)" \
|
||||
--host i386-elf-linux \
|
||||
--prefix $(INSTALL) \
|
||||
--disable-bzip2 \
|
||||
--disable-gpg \
|
||||
--disable-gpgsm \
|
||||
--disable-asm \
|
||||
--disable-agent \
|
||||
--disable-scdaemon \
|
||||
--disable-tools \
|
||||
@ -35,3 +36,4 @@ gpg_target := -j 8 install
|
||||
|
||||
gpg_output := g10/gpgv
|
||||
|
||||
gpg_depends := $(musl_dep)
|
||||
|
18
modules/kernel-headers
Normal file
18
modules/kernel-headers
Normal file
@ -0,0 +1,18 @@
|
||||
modules += kernel-headers
|
||||
|
||||
# we install kernel-headers from sabotage linux, a musl-libc based
|
||||
# distribution, that works well with busybox and other tools.
|
||||
|
||||
kernel-headers_version := 3.12.6-5
|
||||
kernel-headers_dir := kernel-headers-$(kernel-headers_version)
|
||||
kernel-headers_tar := kernel-headers-$(kernel-headers_version).tar.gz
|
||||
kernel-headers_url := https://github.com/sabotage-linux/kernel-headers/archive/v$(kernel-headers_version).tar.gz
|
||||
kernel-headers_hash := ecf4db8781dc50a21cbc4cb17b039f96aede53f9da13435a3201373abb49b96b
|
||||
|
||||
kernel-headers_configure :=
|
||||
|
||||
kernel-headers_target := \
|
||||
ARCH=x86_64 \
|
||||
prefix="$(INSTALL)" \
|
||||
install
|
||||
|
@ -7,15 +7,20 @@ kexec_url := https://kernel.org/pub/linux/utils/kernel/kexec/$(kexec_tar)
|
||||
kexec_hash := cc7b60dad0da202004048a6179d8a53606943062dd627a2edba45a8ea3a85135
|
||||
|
||||
kexec_configure := ./configure \
|
||||
CC="$(heads_cc)" \
|
||||
CFLAGS="-I$(INSTALL)/include" \
|
||||
LDFLAGS="-L$(INSTALL)/lib" \
|
||||
--host i386-elf-linux \
|
||||
--prefix="$(INSTALL)" \
|
||||
--without-zlib \
|
||||
--without-lzma \
|
||||
&& make clean
|
||||
|
||||
kexec_target := -j 8 install
|
||||
kexec_target := \
|
||||
install \
|
||||
|
||||
kexec_output := build/sbin/kexec
|
||||
|
||||
# if we don't need zlib, don't built it
|
||||
#kexec_depends := zlib
|
||||
kexec_depends := $(musl_dep)
|
||||
|
@ -7,8 +7,11 @@ libuuid_url := http://downloads.sourceforge.net/project/libuuid/$(libuuid_tar)
|
||||
libuuid_hash := 46af3275291091009ad7f1b899de3d0cea0252737550e7919d17237997db5644
|
||||
|
||||
libuuid_configure := ./configure \
|
||||
CC="$(heads_cc)" \
|
||||
--prefix $(INSTALL) \
|
||||
--host i386-elf-linux \
|
||||
|
||||
libuuid_target := install
|
||||
|
||||
libuuid_libraries := .libs/libuuid.so
|
||||
libuuid_depends := $(musl_dep)
|
||||
|
18
modules/lvm2
18
modules/lvm2
@ -6,14 +6,26 @@ lvm2_tar := LVM2.$(lvm2_version).tgz
|
||||
lvm2_url := http://mirrors.kernel.org/sourceware/lvm2/$(lvm2_tar)
|
||||
lvm2_hash := 23a3d1cddd41b3ef51812ebf83e9fa491f502fe74130d4263be327a91914660d
|
||||
|
||||
lvm2_configure := ./configure \
|
||||
# cross compiling test assumes malloc/realloc aren't glibc compat
|
||||
# so we force it via the configure cache.
|
||||
lvm2_configure := \
|
||||
CC="$(heads_cc)" \
|
||||
ac_cv_func_malloc_0_nonnull=yes \
|
||||
ac_cv_func_realloc_0_nonnull=yes \
|
||||
./configure \
|
||||
--host i386-elf-linux \
|
||||
--prefix $(INSTALL) \
|
||||
--disable-selinux \
|
||||
--disable-udev-systemd-background-jobs \
|
||||
--disable-realtime \
|
||||
--with-cluster=none \
|
||||
|
||||
lvm2_target := -j 8 install_device-mapper
|
||||
# not sure why LIB_SUFFIX is not defined in the cross build
|
||||
lvm2_target := \
|
||||
install_device-mapper \
|
||||
|
||||
lvm2_libraries := libdm/libdevmapper.so
|
||||
#lvm2_libraries := libdm/libdevmapper.so
|
||||
|
||||
lvm2_output := tools/dmsetup
|
||||
|
||||
lvm2_depends := $(musl_dep)
|
||||
|
@ -10,4 +10,11 @@ mbedtls_libraries := \
|
||||
library/libmbedcrypto.so.0 \
|
||||
|
||||
mbedtls_configure :=
|
||||
mbedtls_target := SHARED=1 DESTDIR=$(INSTALL) -j 8 install
|
||||
mbedtls_target := \
|
||||
SHARED=1 \
|
||||
DESTDIR=$(INSTALL) \
|
||||
CC="$(heads_cc)" \
|
||||
-j 8 \
|
||||
install
|
||||
|
||||
mbedtls_depends := $(musl_dep)
|
||||
|
24
modules/musl
Normal file
24
modules/musl
Normal file
@ -0,0 +1,24 @@
|
||||
modules += 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 \
|
||||
--prefix="$(INSTALL)" \
|
||||
--syslibdir="/lib" \
|
||||
|
||||
musl_target := -j 8 install
|
||||
|
||||
musl_depends := kernel-headers
|
@ -7,8 +7,11 @@ popt_url := http://rpm5.org/files/popt/$(popt_tar)
|
||||
popt_hash := e728ed296fe9f069a0e005003c3d6b2dde3d9cad453422a10d6558616d304cc8
|
||||
|
||||
popt_configure := ./configure \
|
||||
CC="$(heads_cc)" \
|
||||
--prefix $(INSTALL) \
|
||||
--host i386-elf-linux \
|
||||
|
||||
popt_target := install
|
||||
|
||||
popt_libraries := ./libs/libpopt.so
|
||||
popt_depends := $(musl_dep)
|
||||
|
@ -9,8 +9,11 @@ qrencode_hash := e794e26a96019013c0e3665cb06b18992668f352c5553d0a553f5d144f7f2a7
|
||||
qrencode_output := .libs/libqrencode.so.$(qrencode_version)
|
||||
|
||||
qrencode_configure := ./configure \
|
||||
CC="$(heads_cc)" \
|
||||
--prefix $(INSTALL) \
|
||||
--without-tools \
|
||||
--host i386-elf-linux \
|
||||
|
||||
qrencode_target := install
|
||||
|
||||
qrencode_depends := $(musl_dep)
|
||||
|
@ -1,6 +1,6 @@
|
||||
modules += tpmtotp
|
||||
|
||||
tpmtotp_depends := mbedtls qrencode
|
||||
tpmtotp_depends := mbedtls qrencode $(musl_dep)
|
||||
|
||||
tpmtotp_version := git
|
||||
tpmtotp_repo := https://github.com/osresearch/tpmtotp
|
||||
@ -11,6 +11,10 @@ tpmtotp_dir := tpmtotp-$(tpmtotp_version)
|
||||
#tpmtotp_url := https://github.com/osresearch/tpmtotp/archive/v0.0.1.tar.gz
|
||||
#tpmtotp_hash := 8bf2380248fea540a96ad0ff8a4f170b8d93b6bb5fe49b958f9f1926f994823f
|
||||
|
||||
tpmtotp_target := \
|
||||
CC="$(heads_cc)" \
|
||||
CFLAGS="-I$(INSTALL)/include" \
|
||||
LDFLAGS="-L$(INSTALL)/lib" \
|
||||
|
||||
tpmtotp_output := \
|
||||
totp \
|
||||
|
67
patches/kexec-2.0.12.patch
Normal file
67
patches/kexec-2.0.12.patch
Normal file
@ -0,0 +1,67 @@
|
||||
diff -u --recursive clean/kexec-tools-2.0.12/kexec/arch/i386/kexec-x86-common.c build/kexec-tools-2.0.12/kexec/arch/i386/kexec-x86-common.c
|
||||
--- clean/kexec-tools-2.0.12/kexec/arch/i386/kexec-x86-common.c 2015-11-29 18:52:07.000000000 -0500
|
||||
+++ kexec-tools-2.0.12/kexec/arch/i386/kexec-x86-common.c 2017-01-04 13:46:53.684313636 -0500
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
+#include <inttypes.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@@ -74,20 +75,20 @@
|
||||
return -1;
|
||||
}
|
||||
while(fgets(line, sizeof(line), fp) != 0) {
|
||||
- unsigned long long start, end;
|
||||
+ uintptr_t start, end;
|
||||
char *str;
|
||||
int type;
|
||||
int consumed;
|
||||
int count;
|
||||
if (memory_ranges >= MAX_MEMORY_RANGES)
|
||||
break;
|
||||
- count = sscanf(line, "%Lx-%Lx : %n",
|
||||
+ count = sscanf(line, "%"SCNxPTR"-%"SCNxPTR" : %n",
|
||||
&start, &end, &consumed);
|
||||
if (count != 2)
|
||||
continue;
|
||||
str = line + consumed;
|
||||
|
||||
- dbgprintf("%016Lx-%016Lx : %s", start, end, str);
|
||||
+ dbgprintf("%016"PRIxPTR"-%016"PRIxPTR" : %s", start, end, str);
|
||||
|
||||
if (memcmp(str, "System RAM\n", 11) == 0) {
|
||||
type = RANGE_RAM;
|
||||
@@ -114,7 +115,7 @@
|
||||
memory_range[memory_ranges].end = end;
|
||||
memory_range[memory_ranges].type = type;
|
||||
|
||||
- dbgprintf("%016Lx-%016Lx : %x\n", start, end, type);
|
||||
+ dbgprintf("%016"PRIxPTR"-%016"PRIxPTR" : %x\n", start, end, type);
|
||||
|
||||
memory_ranges++;
|
||||
}
|
||||
diff -u --recursive clean/kexec-tools-2.0.12/Makefile.in build/kexec-tools-2.0.12/Makefile.in
|
||||
--- clean/kexec-tools-2.0.12/Makefile.in 2014-10-14 00:58:06.000000000 -0400
|
||||
+++ kexec-tools-2.0.12/Makefile.in 2017-01-04 10:08:51.584425301 -0500
|
||||
@@ -158,16 +158,16 @@
|
||||
|
||||
# kdump (read a crashdump from memory)
|
||||
#
|
||||
-include $(srcdir)/kdump/Makefile
|
||||
+#include $(srcdir)/kdump/Makefile
|
||||
|
||||
# vmcore-dmesg (read dmesg from a vmcore)
|
||||
#
|
||||
-include $(srcdir)/vmcore-dmesg/Makefile
|
||||
+#include $(srcdir)/vmcore-dmesg/Makefile
|
||||
|
||||
#
|
||||
# kexec_test (test program)
|
||||
#
|
||||
-include $(srcdir)/kexec_test/Makefile
|
||||
+#include $(srcdir)/kexec_test/Makefile
|
||||
|
||||
SPEC=$(PACKAGE_NAME).spec
|
||||
GENERATED_SRCS:= $(SPEC)
|
Loading…
Reference in New Issue
Block a user