samsung-i9003: support gcc8 (!307)
This patch forces the kernel to compile with gcc8 and includes by default INSTALL_MOD_STRIP=1.
This commit is contained in:
parent
1c4980bda5
commit
2e9beef9f2
5 changed files with 71 additions and 172 deletions
|
@ -1,144 +1,109 @@
|
||||||
# Based on linux-lg-mako. Changes:
|
# Reference: <https://postmarketos.org/vendorkernel>
|
||||||
# - add findutils makedepend (necessary for the initramfs)
|
# Kernel config based on: arch/arm/configs/latona_defconfig
|
||||||
# - it builds an initramfs - do not use ramdisk.cpio and
|
|
||||||
# ramdisk-recovery-device.cpio, in there, always use the
|
|
||||||
# initramfs from the recovery partition ("isorec")
|
|
||||||
# - directly boot to that initramfs, not only when the recovery
|
|
||||||
# key combination was pressed.
|
|
||||||
# - use Alpine's busybox-static instead of the pre-compiled
|
|
||||||
# binary, that comes with the source
|
|
||||||
#
|
|
||||||
# Kernel config changes, based on: arch/arm/configs/latona_defconfig
|
|
||||||
# - enable devtmpfs (needed for udev -> touch support in weston)
|
|
||||||
# - change compression from CONFIG_KERNEL_LZMA=y to
|
|
||||||
# CONFIG_KERNEL_GZIP=y (so it works with busybox)
|
|
||||||
|
|
||||||
_vendor=samsung
|
pkgname="linux-samsung-i9003"
|
||||||
_flavor=samsung-i9003
|
|
||||||
_hash="7b8d73dd32e6cd21107f9a963a32a5ed237a6e78"
|
|
||||||
_config="config-${_flavor}.armhf"
|
|
||||||
|
|
||||||
pkgname=linux-${_flavor}
|
|
||||||
pkgver=3.0.101
|
pkgver=3.0.101
|
||||||
case $pkgver in
|
pkgrel=15
|
||||||
*.*.*) _kernver=${pkgver%.*};;
|
|
||||||
*.*) _kernver=$pkgver;;
|
|
||||||
esac
|
|
||||||
pkgrel=14
|
|
||||||
arch="armhf"
|
|
||||||
pkgdesc="Samsung Galaxy SI SLC kernel"
|
pkgdesc="Samsung Galaxy SI SLC kernel"
|
||||||
url="https://github.com/dhiru1602/android_kernel_samsung_latona"
|
arch="armhf"
|
||||||
depends=""
|
_carch="arm"
|
||||||
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev
|
_flavor="samsung-i9003"
|
||||||
findutils busybox-static-armhf gcc6"
|
url="https://kernel.org"
|
||||||
|
license="GPL-2.0-only"
|
||||||
options="!strip !check !tracedeps"
|
options="!strip !check !tracedeps"
|
||||||
install=
|
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev busybox-static-armhf"
|
||||||
|
|
||||||
|
# Compiler: latest GCC from Alpine
|
||||||
|
HOSTCC="${CC:-gcc}"
|
||||||
|
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
|
||||||
|
|
||||||
|
# Source
|
||||||
|
_repository="android_kernel_samsung_latona"
|
||||||
|
_commit="7b8d73dd32e6cd21107f9a963a32a5ed237a6e78"
|
||||||
|
_config="config-${_flavor}.${arch}"
|
||||||
source="
|
source="
|
||||||
$pkgname-$_hash.tar.gz::https://github.com/dhiru1602/android_kernel_samsung_latona/archive/${_hash}.tar.gz
|
$pkgname-$_commit.tar.gz::https://github.com/dhiru1602/${_repository}/archive/${_commit}.tar.gz
|
||||||
$_config
|
$_config
|
||||||
compiler-gcc6.h
|
|
||||||
00_return_address.patch
|
00_return_address.patch
|
||||||
01_twl_power_init.patch
|
01_twl_power_init.patch
|
||||||
02_mfd_driver_fix.patch
|
02_mfd_driver_fix.patch
|
||||||
03_fix_paranoid_network_disabled.patch
|
03_fix_paranoid_network_disabled.patch
|
||||||
|
gcc7-give-up-on-ilog2-const-optimizations.patch
|
||||||
|
gcc8-fix-put-user.patch
|
||||||
|
kernel-use-the-gnu89-standard-explicitly.patch
|
||||||
init
|
init
|
||||||
"
|
"
|
||||||
subpackages=""
|
builddir="$srcdir/${_repository}-${_commit}"
|
||||||
license="GPL2"
|
|
||||||
|
|
||||||
_abi_release=${pkgver}
|
|
||||||
_carch="arm"
|
|
||||||
|
|
||||||
# Compiler: this kernel was only tested with GCC6. Feel free to make a merge
|
|
||||||
# request if you find out that it is booting working with newer GCCs as
|
|
||||||
# well. See <https://postmarketos.org/vendorkernel> for instructions.
|
|
||||||
if [ "${CC:0:5}" != "gcc6-" ]; then
|
|
||||||
CC="gcc6-$CC"
|
|
||||||
HOSTCC="gcc6-gcc"
|
|
||||||
CROSS_COMPILE="gcc6-$CROSS_COMPILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ksrcdir="$srcdir/android_kernel_samsung_latona-${_hash}"
|
|
||||||
|
|
||||||
prepare() {
|
|
||||||
local _patch_failed=
|
|
||||||
cd "$ksrcdir"
|
|
||||||
|
|
||||||
# first apply patches in specified order
|
|
||||||
for i in $source; do
|
|
||||||
case $i in
|
|
||||||
*.patch)
|
|
||||||
msg "Applying $i..."
|
|
||||||
if ! patch -s -p1 -N -i "$srcdir"/$i; then
|
|
||||||
echo $i >>failed
|
|
||||||
_patch_failed=1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if ! [ -z "$_patch_failed" ]; then
|
|
||||||
error "The following patches failed:"
|
|
||||||
cat failed
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# gcc6 support
|
|
||||||
cp -v "$srcdir/compiler-gcc6.h" "$ksrcdir/include/linux/"
|
|
||||||
|
|
||||||
mkdir -p "$srcdir"/build
|
|
||||||
cp "$srcdir"/$_config "$srcdir"/build/.config
|
|
||||||
make -C "$ksrcdir" O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" \
|
|
||||||
silentoldconfig
|
|
||||||
|
|
||||||
|
|
||||||
mkdir "$ksrcdir"/usr/latona_initramfs_files/
|
|
||||||
|
|
||||||
|
prepare_isorec() {
|
||||||
# Use Alpine's busybox.static instead of the pre-compiled busybox shipped
|
# Use Alpine's busybox.static instead of the pre-compiled busybox shipped
|
||||||
# with the source
|
# with the source
|
||||||
|
mkdir "$builddir"/usr/latona_initramfs_files/
|
||||||
cp -v /usr/$(arch_to_hostspec $arch)/bin/busybox.static \
|
cp -v /usr/$(arch_to_hostspec $arch)/bin/busybox.static \
|
||||||
"$ksrcdir"/usr/latona_initramfs_files/busybox
|
"$builddir"/usr/latona_initramfs_files/busybox
|
||||||
|
|
||||||
# use custom init script in the initramfs which loads the initramfs from
|
# do not use ramdisk.cpio and ramdisk-recovery-device.cpio, always use
|
||||||
# the kernel2 partition ("isorec")
|
# the initramfs from the recovery partition ("isorec"), so we can build
|
||||||
cp -v "$srcdir"/init "$ksrcdir"/usr/latona_initramfs_files/init
|
# it later and independently from the kernel. also directly boot that
|
||||||
|
# partition, not only when the recovery key combination was used.
|
||||||
|
cd "$builddir"/usr/
|
||||||
|
mv latona_initramfs.list latona_initramfs.list_old
|
||||||
|
grep -v "../../ramdisk" latona_initramfs.list_old > latona_initramfs.list
|
||||||
|
cp -v "$srcdir"/init "$builddir"/usr/latona_initramfs_files/init
|
||||||
|
|
||||||
|
# Paths supplied to gen_initramfs_list.sh are prefixed with "source/".
|
||||||
|
ln -s "$builddir" ln -s "$builddir"/source
|
||||||
|
}
|
||||||
|
|
||||||
mkdir -p "$srcdir"/build
|
prepare() {
|
||||||
cp "$srcdir"/$_config "$srcdir"/build/.config
|
default_prepare
|
||||||
make -C "$ksrcdir" O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" \
|
prepare_isorec
|
||||||
silentoldconfig
|
cd "$builddir"
|
||||||
|
downstreamkernel_prepare "$srcdir" "$builddir" "$_config" "$_carch" "$HOSTCC"
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "$srcdir"/build
|
|
||||||
unset LDFLAGS
|
unset LDFLAGS
|
||||||
|
|
||||||
make ARCH="$_carch" CC="${CC:-gcc}" \
|
make ARCH="$_carch" CC="${CC:-gcc}" \
|
||||||
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" \
|
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" \
|
||||||
CFLAGS_MODULE=-fno-pic
|
CFLAGS_MODULE=-fno-pic
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
install -Dm644 "$srcdir/build/arch/arm/boot/zImage" \
|
# kernel.release
|
||||||
"$pkgdir/boot/vmlinuz-$_flavor"
|
install -D "$builddir/include/config/kernel.release" \
|
||||||
|
|
||||||
install -D "$srcdir/build/include/config/kernel.release" \
|
|
||||||
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
|
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
|
||||||
|
|
||||||
cd "$srcdir"/build
|
# zImage (find the right one)
|
||||||
|
cd "$builddir/arch/$_carch/boot"
|
||||||
|
_target="$pkgdir/boot/vmlinuz-$_flavor"
|
||||||
|
for _zimg in zImage-dtb Image.gz-dtb *zImage Image; do
|
||||||
|
[ -e "$_zimg" ] || continue
|
||||||
|
msg "zImage found: $_zimg"
|
||||||
|
install -Dm644 "$_zimg" "$_target"
|
||||||
|
break
|
||||||
|
done
|
||||||
|
if ! [ -e "$_target" ]; then
|
||||||
|
error "Could not find zImage in $PWD!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$builddir"
|
||||||
unset LDFLAGS
|
unset LDFLAGS
|
||||||
|
|
||||||
echo "--[ Installing modules ]--"
|
echo "--[ Installing modules ]--"
|
||||||
make ARCH="$_carch" CC="${CC:-gcc}" \
|
make ARCH="$_carch" CC="${CC:-gcc}" \
|
||||||
KBUILD_BUILD_VERSION="$((pkgrel + 1))-Alpine" \
|
KBUILD_BUILD_VERSION="$((pkgrel + 1))-postmarketOS" \
|
||||||
INSTALL_MOD_PATH="$pkgdir" modules_install
|
INSTALL_MOD_PATH="$pkgdir" INSTALL_MOD_STRIP=1 modules_install
|
||||||
}
|
}
|
||||||
|
|
||||||
sha512sums="b7ca46b856a0c160ae36a98da39147deb85c054e902447ab68bcd4a011986eee486fb681d0bb832b9b57797aca35332483e99379b792bd467b1f030328bd83c7 linux-samsung-i9003-7b8d73dd32e6cd21107f9a963a32a5ed237a6e78.tar.gz
|
sha512sums="b7ca46b856a0c160ae36a98da39147deb85c054e902447ab68bcd4a011986eee486fb681d0bb832b9b57797aca35332483e99379b792bd467b1f030328bd83c7 linux-samsung-i9003-7b8d73dd32e6cd21107f9a963a32a5ed237a6e78.tar.gz
|
||||||
ac6d9fd10aca7a9460d26bd78d70a6aacfdc9ca28ec10a04210211f748724dbb0018c6388d407327c8736f896c956b0d8ba4b3c72f05e65cd664a8261381a9a9 config-samsung-i9003.armhf
|
ac6d9fd10aca7a9460d26bd78d70a6aacfdc9ca28ec10a04210211f748724dbb0018c6388d407327c8736f896c956b0d8ba4b3c72f05e65cd664a8261381a9a9 config-samsung-i9003.armhf
|
||||||
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h
|
|
||||||
c40eaa11547f5bc2b1ff965506bdfe3015ff16e4b5ad9ccb3b8134ceafd1d32407c4ef2b213e02e036ce1e9bdcbfe768dff7d4b054bec77705a176c1f783b6f5 00_return_address.patch
|
c40eaa11547f5bc2b1ff965506bdfe3015ff16e4b5ad9ccb3b8134ceafd1d32407c4ef2b213e02e036ce1e9bdcbfe768dff7d4b054bec77705a176c1f783b6f5 00_return_address.patch
|
||||||
1972a2b5c429d6bf5fa1423e8805bb89bbd80c4efe6d235cb2037de6ba4d15c01e90239392161d6e5a0802eafaab6e8b468a49a12dc5b66469a111262cde2047 01_twl_power_init.patch
|
1972a2b5c429d6bf5fa1423e8805bb89bbd80c4efe6d235cb2037de6ba4d15c01e90239392161d6e5a0802eafaab6e8b468a49a12dc5b66469a111262cde2047 01_twl_power_init.patch
|
||||||
5b951a2ab60a89fbc3ca209960987035001a6f9147f8ab5c05a6b49ec6dee75d0b6d053bef28df37e583bfc903599beed16692e25ee363e6200e14839d0dda65 02_mfd_driver_fix.patch
|
5b951a2ab60a89fbc3ca209960987035001a6f9147f8ab5c05a6b49ec6dee75d0b6d053bef28df37e583bfc903599beed16692e25ee363e6200e14839d0dda65 02_mfd_driver_fix.patch
|
||||||
df62e03666313bb03d9a455eac875f170a55d378b6e56b847c1c6ff1ce5cfafcfdf1d7605754ca3c684840ea00357f9ec4c6621f6ff77377132a484b9258f6f7 03_fix_paranoid_network_disabled.patch
|
df62e03666313bb03d9a455eac875f170a55d378b6e56b847c1c6ff1ce5cfafcfdf1d7605754ca3c684840ea00357f9ec4c6621f6ff77377132a484b9258f6f7 03_fix_paranoid_network_disabled.patch
|
||||||
|
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch
|
||||||
|
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
|
||||||
|
ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c kernel-use-the-gnu89-standard-explicitly.patch
|
||||||
dd4094d5f4ec281d32f12af88cb22a782e497c8e52f69cf60b73ac7d6171fc95f1f8040b3d0ad2ff3f016d22ac1d91c5b522e5d03203534a76742bc55a082af5 init"
|
dd4094d5f4ec281d32f12af88cb22a782e497c8e52f69cf60b73ac7d6171fc95f1f8040b3d0ad2ff3f016d22ac1d91c5b522e5d03203534a76742bc55a082af5 init"
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
// SOURCE:
|
|
||||||
// https://github.com/NextThingCo/CHIP-u-boot/issues/10#issuecomment-287515505
|
|
||||||
|
|
||||||
#ifndef __LINUX_COMPILER_H
|
|
||||||
#error "Please don't include <linux/compiler-gcc6.h> directly, include <linux/compiler.h> instead."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define __used __attribute__((__used__))
|
|
||||||
#define __must_check __attribute__((warn_unused_result))
|
|
||||||
#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
|
|
||||||
|
|
||||||
/* Mark functions as cold. gcc will assume any path leading to a call
|
|
||||||
to them will be unlikely. This means a lot of manual unlikely()s
|
|
||||||
are unnecessary now for any paths leading to the usual suspects
|
|
||||||
like BUG(), printk(), panic() etc. [but let's keep them for now for
|
|
||||||
older compilers]
|
|
||||||
|
|
||||||
Early snapshots of gcc 4.3 don't support this and we can't detect this
|
|
||||||
in the preprocessor, but we can live with this because they're unreleased.
|
|
||||||
Maketime probing would be overkill here.
|
|
||||||
|
|
||||||
gcc also has a __attribute__((__hot__)) to move hot functions into
|
|
||||||
a special section, but I don't see any sense in this right now in
|
|
||||||
the kernel context */
|
|
||||||
#define __cold __attribute__((__cold__))
|
|
||||||
|
|
||||||
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
|
|
||||||
|
|
||||||
#ifndef __CHECKER__
|
|
||||||
# define __compiletime_warning(message) __attribute__((warning(message)))
|
|
||||||
# define __compiletime_error(message) __attribute__((error(message)))
|
|
||||||
#endif /* __CHECKER__ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Mark a position in code as unreachable. This can be used to
|
|
||||||
* suppress control flow warnings after asm blocks that transfer
|
|
||||||
* control elsewhere.
|
|
||||||
*
|
|
||||||
* Early snapshots of gcc 4.5 don't support this and we can't detect
|
|
||||||
* this in the preprocessor, but we can live with this because they're
|
|
||||||
* unreleased. Really, we need to have autoconf for the kernel.
|
|
||||||
*/
|
|
||||||
#define unreachable() __builtin_unreachable()
|
|
||||||
|
|
||||||
/* Mark a function definition as prohibited from being cloned. */
|
|
||||||
#define __noclone __attribute__((__noclone__))
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Tell the optimizer that something else uses this function or variable.
|
|
||||||
*/
|
|
||||||
#define __visible __attribute__((externally_visible))
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GCC 'asm goto' miscompiles certain code sequences:
|
|
||||||
*
|
|
||||||
* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
|
|
||||||
*
|
|
||||||
* Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
|
|
||||||
*
|
|
||||||
* (asm goto is automatically volatile - the naming reflects this.)
|
|
||||||
*/
|
|
||||||
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
|
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
|
|
||||||
#define __HAVE_BUILTIN_BSWAP32__
|
|
||||||
#define __HAVE_BUILTIN_BSWAP64__
|
|
||||||
#define __HAVE_BUILTIN_BSWAP16__
|
|
||||||
#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
../../.shared-patches/linux/gcc7-give-up-on-ilog2-const-optimizations.patch
|
1
device/linux-samsung-i9003/gcc8-fix-put-user.patch
Symbolic link
1
device/linux-samsung-i9003/gcc8-fix-put-user.patch
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../.shared-patches/linux/gcc8-fix-put-user.patch
|
|
@ -0,0 +1 @@
|
||||||
|
../../.shared-patches/linux/kernel-use-the-gnu89-standard-explicitly.patch
|
Loading…
Reference in a new issue