From 84064debbea37019ccda5b3a6977995ca5eb9c50 Mon Sep 17 00:00:00 2001 From: Trammell Hudson Date: Wed, 4 Jan 2017 10:31:27 -0500 Subject: [PATCH] musl-libc patches to build a successfull qemu image --- Makefile | 12 +++++++++--- initrd/lib/ld-musl-x86_64.so.1 | 1 + initrd/lib64/ld-linux-x86-64.so.2 | 1 - modules/musl | 10 +++++++++- 4 files changed, 19 insertions(+), 5 deletions(-) create mode 120000 initrd/lib/ld-musl-x86_64.so.1 delete mode 120000 initrd/lib64/ld-linux-x86-64.so.2 diff --git a/Makefile b/Makefile index 7fd6d425..c24643bf 100644 --- a/Makefile +++ b/Makefile @@ -115,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 # @@ -194,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 # @@ -259,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 diff --git a/initrd/lib/ld-musl-x86_64.so.1 b/initrd/lib/ld-musl-x86_64.so.1 new file mode 120000 index 00000000..bdbca7c0 --- /dev/null +++ b/initrd/lib/ld-musl-x86_64.so.1 @@ -0,0 +1 @@ +./libc.so \ No newline at end of file diff --git a/initrd/lib64/ld-linux-x86-64.so.2 b/initrd/lib64/ld-linux-x86-64.so.2 deleted file mode 120000 index 797a5e51..00000000 --- a/initrd/lib64/ld-linux-x86-64.so.2 +++ /dev/null @@ -1 +0,0 @@ -../lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 \ No newline at end of file diff --git a/modules/musl b/modules/musl index e249e561..b97fa0c2 100644 --- a/modules/musl +++ b/modules/musl @@ -8,9 +8,17 @@ musl_hash := 97e447c7ee2a7f613186ec54a93054fe15469fe34d7d323080f7ef38f5ecb0fa musl_output := $(INSTALL)/bin/musl-gcc +# +# Note that for syslibdir to be /lib the install will likely fail. +# this is unfortunate, but can be worked around by making sure that +# a /lib/ld-musl-x86_64.so.1 symlink exists and points to libc.so +# for your musl build. +# +# Otherwise we'll have to make a whole cross compiler setup. +# musl_configure := ./configure \ --prefix="$(INSTALL)" \ - --syslibdir="$(INSTALL)/lib" \ + --syslibdir="/lib" \ musl_target := -j 8 install