Skip to content

Commit

Permalink
Working build with musl-libc cross compiler (issue #77).
Browse files Browse the repository at this point in the history
Pass in the --host argument to all of the various programs
that need to treat the configure scripts as cross compilation
targets.

This removes all dependencies on the host libc (issue #7)
and adds some tools to the initrd (cryptsetup #46).
  • Loading branch information
osresearch committed Jan 4, 2017
1 parent e68f09b commit 58ff958
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 11 deletions.
5 changes: 4 additions & 1 deletion modules/cryptsetup
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ 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 \
Expand Down
4 changes: 2 additions & 2 deletions modules/gpg
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ gpg_hash := 6b47a3100c857dcab3c60e6152e56a997f2c7862c1b8b2b25adf3884a1ae2276

gpg_configure := ./configure \
CC="$(heads_cc)" \
CFLAGS="-I$(INSTALL)/include" \
LDFLAGS="-L$(INSTALL)/lib" \
--host i386-elf-linux \
--prefix $(INSTALL) \
--disable-bzip2 \
--disable-gpg \
--disable-gpgsm \
--disable-asm \
--disable-agent \
--disable-scdaemon \
--disable-tools \
Expand Down
1 change: 1 addition & 0 deletions modules/kexec
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ kexec_configure := ./configure \
CC="$(heads_cc)" \
CFLAGS="-I$(INSTALL)/include" \
LDFLAGS="-L$(INSTALL)/lib" \
--host i386-elf-linux \
--prefix="$(INSTALL)" \
--without-zlib \
--without-lzma \
Expand Down
1 change: 1 addition & 0 deletions modules/libuuid
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ libuuid_hash := 46af3275291091009ad7f1b899de3d0cea0252737550e7919d17237997db5644
libuuid_configure := ./configure \
CC="$(heads_cc)" \
--prefix $(INSTALL) \
--host i386-elf-linux \

libuuid_target := install

Expand Down
13 changes: 11 additions & 2 deletions modules/lvm2
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,23 @@ 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

Expand Down
9 changes: 4 additions & 5 deletions modules/musl
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ 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.
# 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.
#
# Otherwise we'll have to make a whole cross compiler setup.
# That works, with some hacks...
#
musl_configure := ./configure \
--prefix="$(INSTALL)" \
Expand Down
1 change: 1 addition & 0 deletions modules/popt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ popt_hash := e728ed296fe9f069a0e005003c3d6b2dde3d9cad453422a10d6558616d304cc8
popt_configure := ./configure \
CC="$(heads_cc)" \
--prefix $(INSTALL) \
--host i386-elf-linux \

popt_target := install

Expand Down
1 change: 1 addition & 0 deletions modules/qrencode
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ qrencode_configure := ./configure \
CC="$(heads_cc)" \
--prefix $(INSTALL) \
--without-tools \
--host i386-elf-linux \

qrencode_target := install

Expand Down
5 changes: 4 additions & 1 deletion modules/tpmtotp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +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)"
tpmtotp_target := \
CC="$(heads_cc)" \
CFLAGS="-I$(INSTALL)/include" \
LDFLAGS="-L$(INSTALL)/lib" \

tpmtotp_output := \
totp \
Expand Down

0 comments on commit 58ff958

Please sign in to comment.