Support targeting PowerPC 64

This prepares most of the modules to be build for it.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
This commit is contained in:
Sergii Dmytruk 2021-07-18 20:34:20 +03:00
parent 2a44e5e7ee
commit f16e92792a
No known key found for this signature in database
GPG Key ID: 48579AA47429663E
33 changed files with 135 additions and 47 deletions

View File

@ -52,6 +52,15 @@ include $(CONFIG)
# Unless otherwise specified, we are building for heads
CONFIG_HEADS ?= y
# Determine arch part for a host triplet
ifeq "$(CONFIG_TARGET_ARCH)" "x86"
MUSL_ARCH := x86_64
else ifeq "$(CONFIG_TARGET_ARCH)" "ppc64"
MUSL_ARCH := powerpc64le
else
$(error "Unexpected value of $$(CONFIG_TARGET_ARCH): $(CONFIG_TARGET_ARCH)")
endif
# Create directories if they don't already exist
BUILD_LOG := $(shell mkdir -p "$(log_dir)")
PACKAGES := $(shell mkdir -p "$(packages)")

Binary file not shown.

View File

@ -26,6 +26,7 @@ $(initrd_tmp_dir)/bin/busybox: $(build)/$(busybox_dir)/.build
$(MAKE) \
-C $(build)/$(busybox_dir) \
CC="$(heads_cc)" \
CROSS_COMPILE="$(CROSS)" \
CONFIG_PREFIX="$(initrd_bin_dir)/.." \
install \
| tee -a $(build)/log/busybox.log \

View File

@ -10,7 +10,7 @@ cairo_configure := \
$(CROSS_TOOLS) \
CFLAGS="-DCAIRO_NO_MUTEX=1 -O3" \
./configure \
--host i386-elf-linux \
--host $(MUSL_ARCH)-elf-linux \
--prefix="/" \
--disable-xlib --disable-xcb --disable-pdf \
--disable-ps --disable-svg --disable-script \

View File

@ -5,6 +5,16 @@ ifeq "$(CONFIG_COREBOOT)" "y"
CONFIG_COREBOOT_ROM ?= coreboot.rom
CONFIG_COREBOOT_BOOTBLOCK ?=
ifeq "$(CONFIG_TARGET_ARCH)" "x86"
COREBOOT_TARGET := i386
LINUX_IMAGE_FILE := bzImage
else ifeq "$(CONFIG_TARGET_ARCH)" "ppc64"
COREBOOT_TARGET := ppc64
LINUX_IMAGE_FILE := zImage
else
$(error "$(CONFIG_TARGET_ARCH) target isn't supported by this module")
endif
ifeq "$(CONFIG_COREBOOT_VERSION)" "4.8.1"
coreboot_version := 4.8.1
coreboot_hash := f0ddf4db0628c1fe1e8348c40084d9cbeb5771400c963fd419cda3995b69ad23
@ -60,15 +70,21 @@ coreboot_configure := \
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.
# coreboot for x86 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)" \
ifeq "$(CONFIG_TARGET_ARCH)" "x86"
COREBOOT_CROSS := $(dir $(CROSS))i386-linux-musl-
else
COREBOOT_CROSS := $(CROSS)
endif
coreboot_target := \
-C "$(build)/$(coreboot_base_dir)" \
obj="$(build)/$(coreboot_dir)" \
CROSS="$(dir $(CROSS))i386-linux-musl-" \
CROSS="$(COREBOOT_CROSS)" \
IASL="$(COREBOOT_IASL)" \
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
BUILD_TIMELESS=1 \
@ -82,13 +98,13 @@ coreboot_depend += linux initrd $(musl_dep)
COREBOOT_TOOLCHAIN="$(build)/$(coreboot_base_dir)/.xcompile"
$(COREBOOT_TOOLCHAIN): $(build)/$(coreboot_base_dir)/.canary
$(MAKE) -C "$(build)/$(coreboot_base_dir)" CPUS=$(CPUS) crossgcc-i386
$(MAKE) -C "$(build)/$(coreboot_base_dir)" CPUS=$(CPUS) "crossgcc-$(COREBOOT_TARGET)"
$(build)/$(coreboot_dir)/.configured: $(COREBOOT_TOOLCHAIN)
# Force a rebuild if the inputs have changed
$(build)/$(coreboot_dir)/.build: \
$(build)/$(BOARD)/bzImage \
$(build)/$(BOARD)/$(LINUX_IMAGE_FILE) \
$(build)/$(BOARD)/initrd.cpio.xz \
# This produces a ROM image that is written with the flashrom program

View File

@ -12,7 +12,7 @@ cryptsetup_hash := af2b04e8475cf40b8d9ffd97a1acfa73aa787c890430afd89804fb544d6ad
# build path.
cryptsetup_configure := ./configure \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--host $(MUSL_ARCH)-elf-linux \
--prefix "/" \
--disable-gcrypt-pbkdf2 \
--enable-cryptsetup-reencrypt \

View File

@ -12,7 +12,7 @@ cryptsetup2_hash := 3bca4ffe39e2f94cef50f6ea65acb873a6dbce5db34fc6bcefe38b6d095e
# build path.
cryptsetup2_configure := ./configure \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--host $(MUSL_ARCH)-elf-linux \
--prefix "/" \
--disable-rpath \
--disable-gcrypt-pbkdf2 \

View File

@ -9,7 +9,7 @@ dropbear_hash := 2720ea54ed009af812701bcc290a2a601d5c107d12993e5d92c0f5f81f71889
dropbear_configure := ./configure \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--host $(MUSL_ARCH)-elf-linux \
--prefix "/" \
--disable-syslog \
--disable-lastlog \

View File

@ -19,8 +19,8 @@ gpg_hash := 6b47a3100c857dcab3c60e6152e56a997f2c7862c1b8b2b25adf3884a1ae2276
#
gpg_configure := ./configure \
$(CROSS_TOOLS) \
--build i386-elf-linux \
--host x86_64-linux-musl \
--build $(MUSL_ARCH)-elf-linux \
--host $(MUSL_ARCH)-linux-musl \
--with-libusb="$(INSTALL)" \
--prefix "/" \
--enable-card-support \

View File

@ -14,7 +14,7 @@ gpg2_hash := 61e83278fb5fa7336658a8b73ab26f379d41275bb1c7c6e694dd9f9a6e8e76ec
gpg2_configure := ./configure \
$(CROSS_TOOLS) \
CPPFLAGS="-I$(INSTALL)/include/libusb-1.0" \
--host x86_64-linux-musl \
--host $(MUSL_ARCH)-linux-musl \
--with-libusb="$(INSTALL)" \
--with-gpg-error-prefix="$(INSTALL)" \
--with-libgcrypt-prefix="$(INSTALL)" \

View File

@ -8,8 +8,8 @@ kexec_hash := 40623d4321be2865ef9ea2cd6ec998d31dcf93d0f74353cbd3aa06d8821e3e41
kexec_configure := ./configure \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--target x86_64 \
--host $(MUSL_ARCH)-elf-linux \
--target $(MUSL_ARCH) \
--prefix="/" \
--without-lzma \
&& $(MAKE) clean

View File

@ -1,4 +1,5 @@
modules-$(CONFIG_GPG2) += libassuan
libassuan_version := 2.5.3
libassuan_dir := libassuan-$(libassuan_version)
libassuan_tar := libassuan-$(libassuan_version).tar.bz2
@ -7,7 +8,7 @@ libassuan_hash := 91bcb0403866b4e7c4bc1cc52ed4c364a9b5414b3994f718c70303f7f765e7
libassuan_configure := ./configure \
$(CROSS_TOOLS) \
--host x86_64-linux-musl \
--host $(MUSL_ARCH)-linux-musl \
--prefix "/" \
--disable-static \
--disable-debug \

View File

@ -1,4 +1,5 @@
modules-$(CONFIG_GPG2) += libgcrypt
libgcrypt_version := 1.8.6
libgcrypt_dir := libgcrypt-$(libgcrypt_version)
libgcrypt_tar := libgcrypt-$(libgcrypt_version).tar.bz2
@ -7,7 +8,7 @@ libgcrypt_hash := 0cba2700617b99fc33864a0c16b1fa7fdf9781d9ed3509f5d767178e5fd7b9
libgcrypt_configure := ./configure \
$(CROSS_TOOLS) \
--host=x86_64-linux-musl \
--host=$(MUSL_ARCH)-linux-musl \
--prefix "/" \
--disable-static \
--with-gpg-error-prefix="$(INSTALL)" \

View File

@ -1,4 +1,5 @@
modules-$(CONFIG_GPG2) += libgpg-error
libgpg-error_version := 1.37
libgpg-error_dir := libgpg-error-$(libgpg-error_version)
libgpg-error_tar := libgpg-error-$(libgpg-error_version).tar.bz2
@ -8,7 +9,7 @@ libgpg-error_hash := b32d6ff72a73cf79797f7f2d039e95e9c6f92f0c1450215410840ab62ae
libgpg-error_configure := ./configure \
$(CROSS_TOOLS) \
--prefix "/" \
--host=x86_64-linux-musl \
--host=$(MUSL_ARCH)-linux-musl \
--disable-static \
--disable-nls \
--disable-languages \

View File

@ -16,7 +16,7 @@ MY_CROSS_TOOLS := \
libhidapi-libusb_configure := ./bootstrap && \
./configure \
$(MY_CROSS_TOOLS) \
--host i386-elf-linux\
--host $(MUSL_ARCH)-elf-linux\
--prefix "/"

View File

@ -1,4 +1,5 @@
modules-$(CONFIG_GPG2) += libksba
libksba_version := 1.4.0
libksba_dir := libksba-$(libksba_version)
libksba_tar := libksba-$(libksba_version).tar.bz2
@ -7,7 +8,7 @@ libksba_hash := bfe6a8e91ff0f54d8a329514db406667000cb207238eded49b599761bfca41b6
libksba_configure := ./configure \
$(CROSS_TOOLS) \
--host x86_64-linux-musl \
--host $(MUSL_ARCH)-linux-musl \
--prefix "/" \
--disable-static \
--with-gpg-error-prefix="$(INSTALL)" \

View File

@ -9,7 +9,7 @@ libpng_hash := 574623a4901a9969080ab4a2df9437026c8a87150dfd5c235e28c94b212964a7
libpng_configure := \
$(CROSS_TOOLS) \
./configure \
--host i386-elf-linux \
--host $(MUSL_ARCH)-elf-linux \
--prefix="/" \
libpng_target := \

View File

@ -11,7 +11,7 @@ libusb_hash := 7dce9cce9a81194b7065ee912bcd55eeffebab694ea403ffb91b67db66b1824b
libusb_configure := ./configure\
$(CROSS_TOOLS)\
--host i386-elf-linux\
--host $(MUSL_ARCH)-elf-linux\
--prefix "/"\
--disable-udev\
--disable-tests\

View File

@ -13,7 +13,7 @@ libusb-compat_hash := 404ef4b6b324be79ac1bfb3d839eac860fbc929e6acb1ef88793a6ea32
libusb-compat_configure := ./configure \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--host $(MUSL_ARCH)-elf-linux \
--prefix "/" \
PKG_CONFIG=/bin/false \
LIBUSB_1_0_CFLAGS="-I$(INSTALL)/include/libusb-1.0" \

View File

@ -1,5 +1,15 @@
modules-y += linux
ifeq "$(CONFIG_TARGET_ARCH)" "x86"
LINUX_ARCH := x86
LINUX_IMAGE_FILE := bzImage
else ifeq "$(CONFIG_TARGET_ARCH)" "ppc64"
LINUX_ARCH := powerpc
LINUX_IMAGE_FILE := zImage
else
$(error "$(CONFIG_TARGET_ARCH) target isn't supported by this module")
endif
ifeq "$(CONFIG_LINUX_VERSION)" "4.14.62"
linux_version := 4.14.62
linux_hash := 51ca4d7e8ee156dc0f19bc7768915cfae41dbb0b4f251e4fa8b178c5674c22ab
@ -43,17 +53,19 @@ linux_configure := \
mkdir -p "$(build)/$(linux_dir)" \
&& $(call install_config,$(pwd)/$(linux_kconfig),$(build)/$(linux_dir)/.config) \
&& $(MAKE) -C .. \
ARCH="$(LINUX_ARCH)" \
CROSS_COMPILE="$(CROSS)" \
O="$(build)/$(linux_dir)" \
olddefconfig \
linux_output += arch/x86/boot/bzImage
linux_output += arch/$(LINUX_ARCH)/boot/$(LINUX_IMAGE_FILE)
# Once we have extracted the kernel tar file, install the headers
# so that other submodules can make use of them.
$(INSTALL)/include/linux/limits.h: $(build)/$(linux_base_dir)/.canary
$(MAKE) \
-C "$(build)/$(linux_base_dir)" \
ARCH="$(LINUX_ARCH)" \
INSTALL_HDR_PATH="$(INSTALL)" \
O="$(linux_dir)" \
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
@ -117,6 +129,7 @@ EXTRA_FLAGS := -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches
linux_target := \
O="$(build)/$(linux_dir)" \
ARCH="$(LINUX_ARCH)" \
CROSS_COMPILE="$(CROSS)" \
AFLAGS_KERNEL="$(EXTRA_FLAGS)" \
CFLAGS_KERNEL="$(EXTRA_FLAGS)" \
@ -167,10 +180,10 @@ $(build)/$(BOARD)/modules.cpio: $(build)/$(linux_dir)/.build
@$(RM) -rf "$(module_initrd_dir)"
# The output of the linux.intermediate is the bzImage in the
# linus build directory. We need to copy it into our board
# The output of the linux.intermediate is usually the bzImage in the
# linux build directory. We need to copy it into our board
# specific directory for ease of locating it later.
$(build)/$(BOARD)/bzImage: $(build)/$(linux_dir)/.build
$(build)/$(BOARD)/$(LINUX_IMAGE_FILE): $(build)/$(linux_dir)/.build
$(call do-copy,$(dir $<)/$(linux_output),$@)
@touch $@ # force a timestamp update
@sha256sum "$@" | tee -a "$(HASHES)"

View File

@ -15,7 +15,7 @@ lvm2_configure := \
ac_cv_func_malloc_0_nonnull=yes \
ac_cv_func_realloc_0_nonnull=yes \
./configure \
--host i386-elf-linux \
--host $(MUSL_ARCH)-elf-linux \
--prefix "/" \
--enable-devmapper \
--disable-selinux \

View File

@ -31,15 +31,11 @@ musl-cross_libraries := \
else
# Force a full build of the cross compiler for x86_64
# (do not build i386 since coreboot uses its own compiler)
# Force a full build of the cross compiler for target platform
# No need to build i386 for x86 since coreboot uses its own compiler
musl-cross_configure := \
/bin/echo -e >> Makefile 'both: musl-x86_64' ; \
/bin/echo -e >> Makefile 'musl-x86_64: extract_all' ; \
/bin/echo -e >> Makefile '\t$$$$''(MAKE) TARGET=x86_64-linux-musl install' ; \
/bin/echo -e >> Makefile 'musl-i386: extract_all' ; \
/bin/echo -e >> Makefile '\t$$$$''(MAKE) TARGET=i386-linux-musl install' ; \
/bin/echo -e >> Makefile 'musl-target:' ; \
/bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET="$(MUSL_ARCH)-linux-musl" install' ;
CROSS_PATH ?= $(pwd)/crossgcc/$(CONFIG_TARGET_ARCH)
@ -47,10 +43,10 @@ musl-cross_target := \
OUTPUT="$(CROSS_PATH)" \
MAKE="$(MAKE)" \
$(MAKE_JOBS) \
both
"musl-target"
CROSS := $(CROSS_PATH)/bin/x86_64-linux-musl-
musl-cross_libraries := $(CROSS_PATH)/x86_64-linux-musl/lib/libc.so
CROSS := $(CROSS_PATH)/bin/$(subst -,_,$(MUSL_ARCH))-linux-musl-
musl-cross_libraries := $(CROSS_PATH)/$(subst -,_,$(MUSL_ARCH))-linux-musl/lib/libc.so
endif

View File

@ -23,5 +23,5 @@ newt_libraries := \
newt_configure := ./autogen.sh; ./configure \
$(CROSS_TOOLS) \
--prefix "/" \
--host i386-elf-linux \
--host $(MUSL_ARCH)-elf-linux \
--without-tcl

View File

@ -1,4 +1,5 @@
modules-$(CONFIG_GPG2) += npth
npth_version := 1.6
npth_dir := npth-$(npth_version)
npth_tar := npth-$(npth_version).tar.bz2
@ -7,7 +8,7 @@ npth_hash := 1393abd9adcf0762d34798dc34fdcf4d0d22a8410721e76f1e3afcd1daa4e2d1
npth_configure := ./configure \
$(CROSS_TOOLS) \
--host x86_64-linux-musl \
--host $(MUSL_ARCH)-linux-musl \
--prefix "/" \
--disable-static \
--with-gpg-error-prefix="$(INSTALL)" \

View File

@ -19,6 +19,7 @@ pciutils_hash := 64293c6ab9318c40ef262b76d87bd9097531759752bac556e50979b1e63cfe6
pciutils_target := \
$(MAKE_JOBS) \
$(CROSS_TOOLS) \
HOST=$(MUSL_ARCH)-linux-musl \
ZLIB=no \
HWDB=no \
LIBKMOD=no \

View File

@ -15,7 +15,7 @@ pinentry_hash := 68076686fa724a290ea49cdf0d1c0c1500907d1b759a3bcbfbec0293e8f5657
# location.
pinentry_configure := ./configure \
$(CROSS_TOOLS) \
--host x86_64-linux-musl \
--host $(MUSL_ARCH)-linux-musl \
--prefix "/" \
--enable-pinentry-tty \
--disable-libsecret \

View File

@ -9,7 +9,7 @@ pixman_hash := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
pixman_configure := \
$(CROSS_TOOLS) \
./configure \
--host i386-elf-linux \
--host $(MUSL_ARCH)-elf-linux \
--prefix="/" \
--disable-gtk

View File

@ -9,7 +9,7 @@ popt_hash := e728ed296fe9f069a0e005003c3d6b2dde3d9cad453422a10d6558616d304cc8
popt_configure := ./configure \
$(CROSS_TOOLS) \
--prefix "/" \
--host i386-elf-linux \
--host $(MUSL_ARCH)-elf-linux \
popt_target := \
$(MAKE_JOBS) \

View File

@ -12,7 +12,7 @@ qrencode_configure := ./configure \
$(CROSS_TOOLS) \
--prefix "/" \
--without-tools \
--host i386-elf-linux \
--host $(MUSL_ARCH)-elf-linux \
qrencode_target := \
$(MAKE_JOBS) \

View File

@ -10,7 +10,7 @@ slang_configure := ./configure \
$(CROSS_TOOLS) \
ac_cv_path_nc5config=no \
--prefix "/" \
--host i386-elf-linux \
--host $(MUSL_ARCH)-elf-linux \
--with-z=no \
--with-png=no \
--with-pcre=no \

View File

@ -8,7 +8,7 @@ util-linux_hash := accea4d678209f97f634f40a93b7e9fcad5915d1f4749f6c47bee6bf110fe
util-linux_configure := ./configure \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--host $(MUSL_ARCH)-elf-linux \
--prefix "/" \
--oldincludedir "$(INSTALL)/include" \
--without-ncurses \

View File

@ -174,3 +174,19 @@ diff -u -r libgcrypt-1.8.3-clean/configure libgcrypt-1.8.3/configure
# Compile-time system search path for libraries.
sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
diff --git a/random/jitterentropy-base-user.h b/random/jitterentropy-base-user.h
index 75dd768..8a8dbd5 100644
--- a/random/jitterentropy-base-user.h
+++ b/random/jitterentropy-base-user.h
@@ -86,9 +86,9 @@ jent_get_nstime(u64 *out)
* not rely on that extra little entropy. */
if (!clock_gettime (CLOCK_REALTIME, &tv))
{
- tmp = time.tv_sec;
+ tmp = tv.tv_sec;
tmp = tmp << 32;
- tmp = tmp | time.tv_nsec;
+ tmp = tmp | tv.tv_nsec;
}
else
tmp = 0;

View File

@ -0,0 +1,31 @@
diff --git a/src/syscfg/lock-obj-pub.powerpc64le-unknown-linux-musl.h b/src/syscfg/lock-obj-pub.powerpc64le-unknown-linux-musl.h
new file mode 100644
index 0000000..635e6eb
--- /dev/null
+++ b/src/syscfg/lock-obj-pub.powerpc64le-unknown-linux-musl.h
@@ -0,0 +1,25 @@
+## lock-obj-pub.powerpc64le-unknown-linux-musl.h
+## File created by gen-posix-lock-obj - DO NOT EDIT
+## To be included by mkheader into gpg-error.h
+
+typedef struct
+{
+ long _vers;
+ union {
+ volatile char _priv[40];
+ long _x_align;
+ long *_xp_align;
+ } u;
+} gpgrt_lock_t;
+
+#define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0, \
+ 0,0,0,0,0,0,0,0}}}
+##
+## Local Variables:
+## mode: c
+## buffer-read-only: t
+## End:
+##