sony-nicki: add a WIP mainline kernel adaptation (!640)
[ci:skip-build]: already built successfully in CI
This commit is contained in:
parent
061c154e26
commit
1573a80619
4 changed files with 4838 additions and 5 deletions
|
@ -2,19 +2,35 @@
|
|||
pkgname="device-sony-nicki"
|
||||
pkgdesc="Sony Xperia M"
|
||||
pkgver=0.1
|
||||
pkgrel=2
|
||||
pkgrel=3
|
||||
url="https://postmarketos.org"
|
||||
license="MIT"
|
||||
arch="armv7"
|
||||
options="!check !archcheck"
|
||||
depends="postmarketos-base linux-sony-nicki mkbootimg mesa-dri-swrast mdss-fb-init-hack msm-fb-refresher"
|
||||
depends="postmarketos-base mkbootimg mesa-dri-swrast mdss-fb-init-hack msm-fb-refresher"
|
||||
makedepends="devicepkg-dev"
|
||||
source="deviceinfo 90-android-touch-dev.rules screen-workaround.sh fb.modes pointercal"
|
||||
subpackages="
|
||||
$pkgname-kernel-downstream:kernel_downstream
|
||||
$pkgname-kernel-mainline:kernel_mainline
|
||||
"
|
||||
|
||||
build() {
|
||||
devicepkg_build $startdir $pkgname
|
||||
}
|
||||
|
||||
kernel_downstream() {
|
||||
pkgdesc="LineageOS downstream kernel (recommended)"
|
||||
depends="linux-sony-nicki"
|
||||
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
|
||||
}
|
||||
|
||||
kernel_mainline() {
|
||||
pkgdesc="Mainline kernel (do not use - only for development!)"
|
||||
depends="linux-sony-nicki-mainline"
|
||||
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
|
||||
}
|
||||
|
||||
package() {
|
||||
devicepkg_package $startdir $pkgname
|
||||
install -D -m644 "$srcdir"/90-android-touch-dev.rules \
|
||||
|
@ -31,7 +47,7 @@ package() {
|
|||
ln -s /dev/null "$pkgdir"/etc/udev/rules.d/60-persistent-v4l.rules
|
||||
}
|
||||
|
||||
sha512sums="502ecbed9fc61887af0cd0569929ed03b1aad209b499c7ea3a1e86d667ecb270d512ec203da550acc89ac0a6ae444c93d2741118d5a4b601009a2ffef7a2e6a9 deviceinfo
|
||||
sha512sums="49a75a0fa879f2b5ad9335754edb6e38e682f68f45e4a4a842df00fe76091db75f0f064d5c9fc643e3c8f424e5cb8fa1a7161e76a5bdb31bf771476605cda420 deviceinfo
|
||||
a3d3a0cf43c5f216279666143d6042f2669dbe3dc5ecec2817b6118a0c122f5b927799b37432bee3167359c118d0142fd8e8e8d67374e8ab1d837673f217e1ae 90-android-touch-dev.rules
|
||||
336b6ac90946ec4b4626e9dcb8f1cce503d0ad6fc164177e53502b580aa509dc31ae2ef4fcb9fb04906576cdd6590f625f127e2c29ec61493e30cb6508fdb68d screen-workaround.sh
|
||||
aac9a5d4c856b6feaf4f2961251fbc81d9173e24c3b20806e803711b40e388a173abf2651d5d828d36a504ef2de12c1c1eacea1f1b9479e31f55234012140405 fb.modes
|
||||
|
|
|
@ -6,10 +6,14 @@ deviceinfo_name="Sony Xperia M"
|
|||
deviceinfo_manufacturer="Sony"
|
||||
deviceinfo_codename="sony-nicki"
|
||||
deviceinfo_date=""
|
||||
deviceinfo_dtb=""
|
||||
deviceinfo_modules_initfs=""
|
||||
deviceinfo_arch="armv7"
|
||||
|
||||
# Mainline kernel related
|
||||
deviceinfo_dtb_mainline="qcom-msm8627-sony-xperia-nicki"
|
||||
deviceinfo_append_dtb_mainline="true"
|
||||
deviceinfo_kernel_cmdline_mainline="console=ttyMSM0,115200,n8 PMOS_NO_OUTPUT_REDIRECT"
|
||||
|
||||
# Device related
|
||||
deviceinfo_keyboard="false"
|
||||
deviceinfo_external_storage="true"
|
||||
|
@ -21,7 +25,7 @@ deviceinfo_dev_keyboard=""
|
|||
|
||||
# Bootloader related
|
||||
deviceinfo_flash_method="fastboot"
|
||||
deviceinfo_kernel_cmdline="panic=3 console=ttyHSL0,115200,n8 androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3"
|
||||
deviceinfo_kernel_cmdline_downstream="panic=3 console=ttyHSL0,115200,n8 androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3"
|
||||
deviceinfo_generate_bootimg="true"
|
||||
deviceinfo_bootimg_qcdt="false"
|
||||
deviceinfo_flash_offset_base="0x80200000"
|
||||
|
|
191
device/linux-sony-nicki-mainline/APKBUILD
Normal file
191
device/linux-sony-nicki-mainline/APKBUILD
Normal file
|
@ -0,0 +1,191 @@
|
|||
# Kernel config based on: arch/arm/configs/qcom_defconfig
|
||||
# APKBUILD based on linux-postmarketos-mainline
|
||||
# See: https://gitlab.com/postmarketOS/pmaports/issues/184
|
||||
|
||||
_flavor=sony-nicki-mainline
|
||||
_config="config-${_flavor}.${CARCH}"
|
||||
|
||||
pkgname=linux-${_flavor}
|
||||
|
||||
pkgver=5.3
|
||||
_pkgver=${pkgver/_/-}
|
||||
_kernver=${pkgver%_rc*}
|
||||
_mainver=${_kernver%.*}
|
||||
_patchlevel=${_kernver/$_mainver./}
|
||||
_basever=${_mainver}.$((_patchlevel-1))
|
||||
pkgrel=0
|
||||
|
||||
arch="armv7"
|
||||
pkgdesc="Sony Xperia M mainline kernel fork; only USB networking works"
|
||||
url="https://kernel.org/"
|
||||
depends=""
|
||||
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev openssl-dev file bison flex"
|
||||
options="!strip !check !tracedeps"
|
||||
install=
|
||||
|
||||
_repository="linux"
|
||||
_commit="ad6ab7f8c57896cb3829e6a80408e0912d6096c2"
|
||||
|
||||
source="
|
||||
$pkgname-$_commit.tar.gz::https://github.com/konradybcio/${_repository}/archive/${_commit}.tar.gz
|
||||
config-${_flavor}.armv7
|
||||
"
|
||||
|
||||
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
|
||||
|
||||
HOSTCC="${CC:-gcc}"
|
||||
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
|
||||
|
||||
builddir="$srcdir/linux-$_commit"
|
||||
|
||||
prepare() {
|
||||
local _patch_failed=
|
||||
cd "$builddir"
|
||||
# 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" HOSTCC="$HOSTCC" \
|
||||
olddefconfig
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "$srcdir"/build
|
||||
unset LDFLAGS
|
||||
make ARCH="$_carch" CC="${CC:-gcc}" \
|
||||
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-${_flavor}" \
|
||||
CFLAGS_MODULE=-fno-pic
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$srcdir/build/arch/${_carch}/boot"
|
||||
|
||||
if [ "$CARCH" == "aarch64" ]; then
|
||||
install -Dm644 "$srcdir/build/arch/${_carch}/boot/Image.gz" \
|
||||
"$pkgdir/boot/vmlinuz-$_flavor"
|
||||
else
|
||||
install -Dm644 "$srcdir/build/arch/${_carch}/boot/"*zImage \
|
||||
"$pkgdir/boot/vmlinuz-$_flavor"
|
||||
fi
|
||||
|
||||
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 \
|
||||
ARCH="$_carch" \
|
||||
INSTALL_MOD_PATH="$pkgdir" \
|
||||
INSTALL_DTBS_PATH="$pkgdir/usr/share/dtb"
|
||||
}
|
||||
|
||||
|
||||
dev() {
|
||||
# copy the only the parts that we really need for build 3rd party
|
||||
# kernel modules and install those as /usr/src/linux-headers,
|
||||
# simlar to what ubuntu does
|
||||
#
|
||||
# this way you dont 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" HOSTCC="$HOSTCC" \
|
||||
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 soruces
|
||||
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
|
||||
|
||||
# cross-compiling: delete binaries with host arch and replace them with
|
||||
# symlinks to binaries with the target arch (packaged in kernel-scripts)
|
||||
if [ -n "$CROSS_COMPILE" ]; then
|
||||
msg "Symlinking binary scripts..."
|
||||
depends="$depends kernel-scripts"
|
||||
local found="false"
|
||||
cd "$dir/scripts"
|
||||
local i
|
||||
for i in $(find . -type f); do
|
||||
local type="$(file -b --mime-type "$i")"
|
||||
[ "$type" != "application/x-pie-executable" ] && continue
|
||||
local native="/usr/bin/kernel-scripts/$(echo "$i" | cut -d '/' -f 2-)"
|
||||
ln -svf "$native" "$i"
|
||||
found="true"
|
||||
done
|
||||
if [ "$found" = "false" ]; then
|
||||
error "Failed to symlink binary scripts!"
|
||||
error "Did the mime-type change (see #1659)?"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
sha512sums="31e9ef9b3e956df38824865c291530fa5dda067bfea8b0169a3871d7876cfe192a42ae631e51a8a02f7c64319269c8af2688d8ae180805173bf2c1c84c390a59 linux-sony-nicki-mainline-ad6ab7f8c57896cb3829e6a80408e0912d6096c2.tar.gz
|
||||
c83d8f35536bf28088421ce4fb037b17248b27e80c7d401fb1328682b6ca0a45c88cd29b97a7ba9da54456d2375338a84794408f7371a7c3edf6544bbf310eb8 config-sony-nicki-mainline.armv7"
|
4622
device/linux-sony-nicki-mainline/config-sony-nicki-mainline.armv7
Normal file
4622
device/linux-sony-nicki-mainline/config-sony-nicki-mainline.armv7
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue