linux4.14: add ppc64 and ppc support

This commit is contained in:
q66 2020-03-17 04:19:57 +01:00
parent 3b42f1a798
commit a60bfaccce
4 changed files with 15596 additions and 9 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,85 @@
This makes the Linux kernel build as ELFv2 on big endian ppc64. The upstream
doesn't seem to be interested in this but it's a small patch that is unlikely
to break/easy to remake and in worst case can always be ditched.
Using ELFv2 has some potential performance benefits and is already always used
on little endian. It requires a relatively modern toolchain, which we already
have.
Ping q66 if it does not apply.
--- a/arch/powerpc/Makefile 2020-01-05 14:40:50.395763093 +0100
+++ b/arch/powerpc/Makefile 2020-01-05 14:48:39.025251092 +0100
@@ -86,10 +86,8 @@ MULTIPLEWORD := -mmultiple
endif
ifdef CONFIG_PPC64
-cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1)
-cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mcall-aixdesc)
-aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1)
-aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mabi=elfv2
+cflags-y += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc))
+aflags-y += $(call cc-option,-mabi=elfv2,$(call cc-option,-mabi=elfv1))
endif
cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
@@ -130,14 +128,8 @@ endif
endif
CFLAGS-$(CONFIG_PPC64) := $(call cc-option,-mtraceback=no)
-ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc))
-AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2)
-else
-CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1)
-CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc)
-AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1)
-endif
+AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mabi=elfv1))
CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc))
CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 $(MULTIPLEWORD)
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -44,8 +44,8 @@ ifdef CONFIG_CPU_BIG_ENDIAN
BOOTCFLAGS += -mbig-endian
else
BOOTCFLAGS += -mlittle-endian
-BOOTCFLAGS += $(call cc-option,-mabi=elfv2)
endif
+BOOTCFLAGS += $(call cc-option,-mabi=elfv2)
BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
--- a/drivers/crypto/vmx/Makefile 2020-01-01 10:56:10.560965046 +0100
+++ b/drivers/crypto/vmx/Makefile 2020-01-01 10:57:05.189968856 +0100
@@ -5,7 +5,7 @@
ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
override flavour := linux-ppc64le
else
-override flavour := linux-ppc64
+override flavour := linux-ppc64v2
endif
quiet_cmd_perl = PERL $@
--- a/drivers/crypto/vmx/ppc-xlate.pl
+++ b/drivers/crypto/vmx/ppc-xlate.pl
@@ -40,7 +40,7 @@ my $globl = sub {
};
my $text = sub {
my $ret = ($flavour =~ /aix/) ? ".csect\t.text[PR],7" : ".text";
- $ret = ".abiversion 2\n".$ret if ($flavour =~ /linux.*64le/);
+ $ret = ".abiversion 2\n".$ret if ($flavour =~ /linux.*64(le|v2)/);
$ret;
};
my $machine = sub {
@@ -142,7 +142,7 @@ my $vmr = sub {
# Some ABIs specify vrsave, special-purpose register #256, as reserved
# for system use.
-my $no_vrsave = ($flavour =~ /linux-ppc64le/);
+my $no_vrsave = ($flavour =~ /linux-ppc64(le|v2)/);
my $mtspr = sub {
my ($f,$idx,$ra) = @_;
if ($idx == 256 && $no_vrsave) {

View File

@ -17,9 +17,13 @@ noverifyrdeps=yes
noshlibprovides=yes
preserve=yes
archs="i686* x86_64* armv5tel* armv7l* aarch64*"
archs="i686* x86_64* armv5tel* armv7l* aarch64* ppc*"
hostmakedepends="bc elfutils-devel kmod libressl-devel perl uboot-mkimage gmp-devel libmpc-devel"
case "$XBPS_TARGET_MACHINE" in
ppc64le*) broken="No ppc64le support";;
esac
_kernver="${version}_${revision}"
triggers="kernel-hooks"
kernel_hooks_version="${_kernver}"
@ -43,26 +47,28 @@ do_configure() {
# If there's a file called <arch>-dotconfig, use it to
# configure the kernel; otherwise use arch defaults and all stuff
# as modules (defconfig+allmodconfig).
local arch _args
local arch subarch _args
case "$XBPS_TARGET_MACHINE" in
i686*) arch=i386;;
x86_64*) arch=x86_64;;
armv5*|armv7*) arch=arm;;
aarch64*) arch=arm64;;
ppc64*) arch=powerpc; subarch=ppc64;;
ppc*) arch=powerpc;;
esac
if [ "$CROSS_BUILD" ]; then
_args="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
fi
if [ -f ${FILESDIR}/${arch}-dotconfig-custom ]; then
if [ -f ${FILESDIR}/${subarch:-$arch}-dotconfig-custom ]; then
msg_normal "Detected a custom .config file for your arch, using it.\n"
cp -f ${FILESDIR}/${arch}-dotconfig-custom .config
cp -f ${FILESDIR}/${subarch:-$arch}-dotconfig-custom .config
make ${makejobs} ARCH=$arch ${_args} oldconfig
elif [ -f ${FILESDIR}/${arch}-dotconfig ]; then
elif [ -f ${FILESDIR}/${subarch:-$arch}-dotconfig ]; then
msg_normal "Detected a .config file for your arch, using it.\n"
cp -f ${FILESDIR}/${arch}-dotconfig .config
cp -f ${FILESDIR}/${subarch:-$arch}-dotconfig .config
make ${makejobs} ARCH=$arch ${_args} oldconfig
elif [ -f ${FILESDIR}/${XBPS_TARGET_MACHINE%%-musl}-dotconfig ]; then
msg_normal "Detected a .config file for your cpu family, using it.\n"
@ -84,6 +90,7 @@ do_build() {
x86_64*) _args="bzImage modules"; arch=x86_64;;
armv5*|armv7*) _args="zImage modules dtbs"; arch=arm;;
aarch64*) _args="Image modules dtbs"; arch=arm64;;
ppc*) _args="zImage modules"; arch=powerpc;;
esac
if [ "$CROSS_BUILD" ]; then
_cross="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
@ -103,6 +110,7 @@ do_install() {
x86_64*) arch=x86; subarch=x86_64;;
armv5*|armv7*) arch=arm;;
aarch64*) arch=arm64;;
ppc*) arch=powerpc;;
esac
# Run depmod after compressing modules.
@ -130,6 +138,12 @@ do_install() {
vmkdir boot/dtbs
cp arch/arm64/boot/dts/*/*.dtb ${DESTDIR}/boot/dtbs
;;
powerpc)
# zImage on powerpc is useless as it won't load initramfs
# raw vmlinux is huge, and this is nostrip, so do it manually
vinstall vmlinux 644 boot vmlinux-${_kernver}
/usr/bin/$STRIP ${DESTDIR}/boot/vmlinux-${_kernver}
;;
esac
# Switch to /usr.
@ -251,11 +265,12 @@ do_install() {
# Remove unneeded architectures
case "$arch" in
i386|x86_64) _args="arm*";;
arm|arm64) _args="x86*";;
i386|x86_64) _args="arm* p*";;
arm|arm64) _args="x86* p*";;
powerpc) _args="arm* x86* parisc";;
esac
for arch in alpha avr32 blackfin cris frv h8300 \
ia64 m* p* s* um v850 xtensa ${_args}; do
ia64 m* s* um v850 xtensa ${_args}; do
rm -rf ${hdrdest}/arch/${arch}
done