From eaf1313d4de3265a40fd8c926750407a3255e9ee Mon Sep 17 00:00:00 2001 From: Petr Hodina Date: Thu, 16 Feb 2023 17:48:49 +0100 Subject: [PATCH] linux-google-crosshatch-mainline: Rewrite build and fix lint warnings. (MR 3874) --- ...c10-extern_YYLOC_global_declaration.patch} | 0 .../linux-google-crosshatch-mainline/APKBUILD | 149 +++--------------- .../config-google-crosshatch-mainline.aarch64 | 7 +- 3 files changed, 30 insertions(+), 126 deletions(-) rename device/testing/linux-google-crosshatch-mainline/{linux4.17-gcc10-extern_YYLOC_global_declaration.patch => 0001-linux4.17-gcc10-extern_YYLOC_global_declaration.patch} (100%) diff --git a/device/testing/linux-google-crosshatch-mainline/linux4.17-gcc10-extern_YYLOC_global_declaration.patch b/device/testing/linux-google-crosshatch-mainline/0001-linux4.17-gcc10-extern_YYLOC_global_declaration.patch similarity index 100% rename from device/testing/linux-google-crosshatch-mainline/linux4.17-gcc10-extern_YYLOC_global_declaration.patch rename to device/testing/linux-google-crosshatch-mainline/0001-linux4.17-gcc10-extern_YYLOC_global_declaration.patch diff --git a/device/testing/linux-google-crosshatch-mainline/APKBUILD b/device/testing/linux-google-crosshatch-mainline/APKBUILD index dafea83e9..0e69ce61f 100644 --- a/device/testing/linux-google-crosshatch-mainline/APKBUILD +++ b/device/testing/linux-google-crosshatch-mainline/APKBUILD @@ -6,20 +6,17 @@ _flavor=google-crosshatch-mainline _config="config-$_flavor.$CARCH" pkgname=linux-$_flavor - pkgver=5.3_rc5 -_pkgver=${pkgver/_/-} -_kernver=${pkgver%_rc*} -_mainver=${_kernver%.*} -_patchlevel=${_kernver/$_mainver./} -_basever=$_mainver.$((_patchlevel-1)) -pkgrel=4 - +pkgrel=5 arch="aarch64" +_carch="arm64" pkgdesc="Google Pixel 3 XL kernel fork, close to mainline" url="https://kernel.org/" +license="GPL2-2.0-only" makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev openssl-dev file bison flex" -options="!strip !check !tracedeps pmb:cross-native" +options="!strip !check !tracedeps + pmb:cross-native + pmb:kconfigcheck-community" _repository="linux" _commit="9c9b87cec239101274451cc9c086da60108f9fda" @@ -27,139 +24,43 @@ _commit="9c9b87cec239101274451cc9c086da60108f9fda" source=" $pkgname-$_commit.tar.gz::https://github.com/Pixel3Dev/$_repository/archive/$_commit.tar.gz config-$_flavor.aarch64 - linux4.17-gcc10-extern_YYLOC_global_declaration.patch + 0001-linux4.17-gcc10-extern_YYLOC_global_declaration.patch " -subpackages="$pkgname-dev" - -license="GPL2" -_abi_release=$_pkgver -_carch=$CARCH -case "$_carch" in -aarch64*) _carch="arm64" ;; -arm*) _carch="arm" ;; -ppc*) _carch="powerpc" ;; -s390*) _carch="s390" ;; -esac - builddir="$srcdir/linux-$_commit" prepare() { - local _patch_failed= - # first apply patches in specified order - for i in $source; do - case $i in - *.patch|*.patch::*) - _patch=${i%::*} - msg "Applying $_patch..." - if ! patch -s -p1 -N -i "$srcdir"/$_patch; then - echo $_patch >>failed - _patch_failed=1 - fi - ;; - esac - done - - if ! [ -z "$_patch_failed" ]; then - error "The following patches failed:" - cat failed - return 1 - fi - - mkdir -p "$srcdir"/build - cp -v "$srcdir"/$_config "$srcdir"/build/.config - make -C "$builddir" O="$srcdir"/build ARCH="$_carch" \ - olddefconfig + default_prepare + cp "$srcdir"/$_config .config } build() { - cd "$srcdir"/build unset LDFLAGS + # V=1: workaround for pma#1990 make ARCH="$_carch" CC="${CC:-gcc}" \ KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-$_flavor" \ - CFLAGS_MODULE=-fno-pic + CFLAGS_MODULE=-fno-pic V=1 } package() { - cd "$srcdir/build/arch/$_carch/boot" - if [ "$CARCH" == "aarch64" ]; then - install -Dm644 "$srcdir/build/arch/$_carch/boot/Image.gz" \ - "$pkgdir/boot/vmlinuz" - else - install -Dm644 "$srcdir/build/arch/$_carch/boot/"*zImage \ - "$pkgdir/boot/vmlinuz" - fi + install -Dm644 "$builddir/arch/$_carch/boot/Image.gz" \ + "$pkgdir/boot/vmlinuz" - install -D "$srcdir/build/include/config/kernel.release" \ - "$pkgdir/usr/share/kernel/$_flavor/kernel.release" - - cd "$srcdir"/build - - local _install - case "$CARCH" in - aarch64*|arm*) _install="modules_install dtbs_install" ;; - *) _install="modules_install" ;; - esac - - make -j1 $_install \ + make modules_install dtbs_install \ ARCH="$_carch" \ + INSTALL_PATH="$pkgdir"/boot \ INSTALL_MOD_PATH="$pkgdir" \ INSTALL_DTBS_PATH="$pkgdir/boot/dtbs" + + rm -f "$pkgdir"/lib/modules/*/build "$pkgdir"/lib/modules/*/source + + install -D "$builddir/include/config/kernel.release" \ + "$pkgdir/usr/share/kernel/$_flavor/kernel.release" } - -dev() { - # copy the only the parts that we really need for build 3rd party - # kernel modules and install those as /usr/src/linux-headers, - # similar to what ubuntu does - # - # this way you don't need to install the 300-400 kernel sources to - # build a tiny kernel module - # - pkgdesc="Headers and script for third party modules for postmarketos kernel" - depends="gmp-dev bash perl" - local dir="$subpkgdir"/usr/src/linux-headers-$_abi_release - - # first we import config, run prepare to set up for building - # external modules, and create the scripts - mkdir -p "$dir" - cp "$srcdir"/$_config "$dir"/.config - make -j1 -C "$builddir" O="$dir" ARCH="$_carch" \ - olddefconfig prepare modules_prepare scripts - - # needed for 3rd party modules - # https://bugzilla.kernel.org/show_bug.cgi?id=11143 - case "$CARCH" in - ppc*) (cd "$dir" && make arch/powerpc/lib/crtsavres.o);; - esac - - # remove the stuff that points to real sources. we want 3rd party - # modules to believe this is the sources - rm "$dir"/Makefile "$dir"/source - - # copy the needed stuff from real sources - # - # this is taken from ubuntu kernel build script - # http://kernel.ubuntu.com/git/ubuntu/ubuntu-zesty.git/tree/debian/rules.d/3-binary-indep.mk - - cd "$builddir" - find . -path './include/*' -prune \ - -o -path './scripts/*' -prune -o -type f \ - \( -name 'Makefile*' -o -name 'Kconfig*' -o -name 'Kbuild*' -o \ - -name '*.sh' -o -name '*.pl' -o -name '*.lds' \) \ - -print | cpio -pdm "$dir" - cp -a scripts include "$dir" - find $(find arch -name include -type d -print) -type f \ - | cpio -pdm "$dir" - - install -Dm644 "$srcdir"/build/Module.symvers \ - "$dir"/Module.symvers - - mkdir -p "$subpkgdir"/lib/modules/$_abi_release - ln -sf /usr/src/linux-headers-$_abi_release \ - "$subpkgdir"/lib/modules/$_abi_release/build -} -sha512sums="1ce235689d7ce0b40be203cb16c1bdfe9bc7b2c5e793a942afc5ea4f3268a0a15b684d9c4017a87916d989d8592a96a4223976c95bf7fcca603e71d2f20fee86 linux-google-crosshatch-mainline-9c9b87cec239101274451cc9c086da60108f9fda.tar.gz -63f7e39aaba78f144ad65b8257e559049cbb827d015c1a9002e5f12a24ae4126fc8dee6256ba56ba557d6f51d8522cf19460c2fcb7879c39a399ebe94c3ca551 config-google-crosshatch-mainline.aarch64 -27827877040007fc1c4c719f7e2e19e5c272d44972415cfc53feba0313d87e4074f8204bdb13cbc5fe21ea61bf595314b68f10c081e7b7bac3c888b60f008acf linux4.17-gcc10-extern_YYLOC_global_declaration.patch" +sha512sums=" +1ce235689d7ce0b40be203cb16c1bdfe9bc7b2c5e793a942afc5ea4f3268a0a15b684d9c4017a87916d989d8592a96a4223976c95bf7fcca603e71d2f20fee86 linux-google-crosshatch-mainline-9c9b87cec239101274451cc9c086da60108f9fda.tar.gz +dd0e65335ce8583ef216b1efde4fc46450dc9ff5173dca3207f4743602a8a45b54cd0d3bdaf550820328f112b4e6581a31bd3d8814f90e409a5892cd3cdf4b62 config-google-crosshatch-mainline.aarch64 +27827877040007fc1c4c719f7e2e19e5c272d44972415cfc53feba0313d87e4074f8204bdb13cbc5fe21ea61bf595314b68f10c081e7b7bac3c888b60f008acf 0001-linux4.17-gcc10-extern_YYLOC_global_declaration.patch +" diff --git a/device/testing/linux-google-crosshatch-mainline/config-google-crosshatch-mainline.aarch64 b/device/testing/linux-google-crosshatch-mainline/config-google-crosshatch-mainline.aarch64 index 3ed939b56..5c7476519 100644 --- a/device/testing/linux-google-crosshatch-mainline/config-google-crosshatch-mainline.aarch64 +++ b/device/testing/linux-google-crosshatch-mainline/config-google-crosshatch-mainline.aarch64 @@ -4,10 +4,10 @@ # # -# Compiler: aarch64-alpine-linux-musl-gcc (Alpine 10.2.1_pre1) 10.2.1 20201203 +# Compiler: aarch64-alpine-linux-musl-gcc (Alpine 12.2.1_git20220924-r9) 12.2.1 20220924 # CONFIG_CC_IS_GCC=y -CONFIG_GCC_VERSION=100201 +CONFIG_GCC_VERSION=120201 CONFIG_CLANG_VERSION=0 CONFIG_CC_HAS_ASM_GOTO=y CONFIG_CC_HAS_WARN_MAYBE_UNINITIALIZED=y @@ -7113,7 +7113,9 @@ CONFIG_LSM="yama,loadpin,safesetid,integrity" # # Memory initialization # +CONFIG_CC_HAS_AUTO_VAR_INIT=y CONFIG_INIT_STACK_NONE=y +# CONFIG_INIT_STACK_ALL is not set # CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set # CONFIG_INIT_ON_FREE_DEFAULT_ON is not set # end of Memory initialization @@ -7504,6 +7506,7 @@ CONFIG_DEBUG_MEMORY_INIT=y CONFIG_HAVE_ARCH_KASAN=y CONFIG_HAVE_ARCH_KASAN_SW_TAGS=y CONFIG_CC_HAS_KASAN_GENERIC=y +CONFIG_CC_HAS_KASAN_SW_TAGS=y # CONFIG_KASAN is not set CONFIG_KASAN_STACK=1 # end of Memory Debugging