Skip to content
Snippets Groups Projects
Commit abe77a02 authored by NeKit's avatar NeKit
Browse files

planet-geminipda: add support for Planet Gemini PDA based on earlier work

parent bccf3d10
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
. /etc/deviceinfo
. ./init_functions.sh
mount_loopback_device() {
loopback_img=postmarketOS.img
partitions="/dev/mmcblk0p29 /dev/mmcblk0p30 /dev/mmcblk0p31"
mkdir /tmpmnt
for part in $partitions; do
mount -o ro $part /tmpmnt
if [ -f "/tmpmnt/$loopback_img" ]; then
mount -o remount,rw /tmpmnt
loopback_device=$(losetup -f)
losetup $loopback_device "/tmpmnt/$loopback_img"
kpartx -afs $loopback_device
return 0
fi
umount /tmpmnt
done
}
mount_loopback_device
Section "Device"
Identifier "Framebuffer device"
Driver "fbdev"
Option "Rotate" "CCW"
EndSection
Section "Device"
Identifier "HWComposer device"
Driver "hwcomposer"
Option "Rotate" "CCW"
EndSection
# Reference: <https://postmarketos.org/devicepkg>
pkgname="device-planet-geminipda"
pkgdesc="Gemini PDA"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base linux-planet-geminipda mkbootimg"
makedepends="devicepkg-dev"
source="deviceinfo
10-geminipda-loopback-device.sh
20-fbdev.conf
40-hwcomposer.conf"
subpackages="$pkgname-hybris"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
install -Dm644 "$srcdir"/10-geminipda-loopback-device.sh \
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/10-geminipda-loopback-device.sh
install -Dm644 "$srcdir"/20-fbdev.conf \
"$subpkgdir"/etc/X11/xorg.conf.d/20-fbdev.conf
}
hybris() {
depends="lxc-android
libhybris-7.1 libhybris-egl libhybris-gles libhybris-libwayland-egl
xf86-video-hwcomposer xf86-video-hwcomposer-7.1"
install -Dm644 "$srcdir"/40-hwcomposer.conf \
"$subpkgdir"/etc/X11/xorg.conf.d/40-hwcomposer.conf
}
sha512sums="273a79f621df7d40f4b10e4845fbd7147b060e5b2eadd3e5c93d25b5cc029b0e4dfe32fd0f1f827b2512ee7da942aa4186d872e4174e90dd08370dfae312784d deviceinfo
a8b6623a0a8bea1ab3e28582f203426e42aed477be9ca1d6147d090f9f9d080a69c262a47f9dd5cd8ce99a9bf64912d902dc881f97967873466ebe73d9bba587 10-geminipda-loopback-device.sh
07bda3435dffec7f8e8e158266cb619fb41c6b04a49a605e76fa88bc33be3cb27fdc54c8664be0738bab2c7a8054ce3d7563036323bf04762dcf735064ac10a2 20-fbdev.conf
785bd225025fb73900dca06b70b2d62fdf4145d1c035b1b03fb0f82a10cc09eff63ec551ead4e1ee780a6b6f348c3f82fd068f6efa6f4e34205600d752f38913 40-hwcomposer.conf"
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="Planet Gemini PDA"
deviceinfo_manufacturer="Planet"
deviceinfo_codename="planet-geminipda"
deviceinfo_date=""
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_arch="aarch64"
# Device related
deviceinfo_keyboard="true"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1080"
deviceinfo_screen_height="2160"
deviceinfo_dev_touchscreen=""
deviceinfo_dev_touchscreen_calibration=""
deviceinfo_dev_keyboard=""
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="bootopt=64S3,32N2,64N2 androidboot.selinux=permissive buildvariant=userdebug selinux=1"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_flash_offset_base="0x40080000"
deviceinfo_flash_offset_kernel="0x00000000"
deviceinfo_flash_offset_ramdisk="0x04f80000"
deviceinfo_flash_offset_second="0x00e80000"
deviceinfo_flash_offset_tags="0x03f80000"
deviceinfo_flash_pagesize="2048"
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/aeon6797_6m_n_halium_defconfig
pkgname="linux-planet-geminipda"
pkgver=3.18.41
pkgrel=0
pkgdesc="Gemini PDA kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="planet-geminipda"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev gcc6 python"
# Compiler: GCC 6 (doesn't boot when compiled with newer versions)
if [ "${CC:0:5}" != "gcc6-" ]; then
CC="gcc6-$CC"
HOSTCC="gcc6-gcc"
CROSS_COMPILE="gcc6-$CROSS_COMPILE"
fi
# Source
_repository="gemini-linux-kernel-3.18"
_commit="bf7daa4483d5dce94c9d478fc28854f5978d60da"
_config="config-${_flavor}.${arch}"
source="
$pkgname-$_commit.tar.gz::https://github.com/gemian/${_repository}/archive/${_commit}.tar.gz
$_config
"
builddir="$srcdir/${_repository}-${_commit}"
prepare() {
default_prepare
# support newer GCC versions
cp -v "/usr/share/devicepkg-dev/compiler-gcc.h" "$builddir/include/linux/"
# Remove -Werror from all makefiles
makefiles="$(find "$builddir" -type f -name Makefile)
$(find "$builddir" -type f -name Kbuild)"
for i in $makefiles; do
sed -i 's/-Werror-/-W/g' "$i"
sed -i 's/-Werror//g' "$i"
done
# Device kernel must(!) be build out-of-tree to avoid include errors
mkdir -p "$builddir"/KERNEL_OBJ
# Prepare kernel config ('yes ""' for kernels lacking olddefconfig)
cp "$srcdir"/$_config "$builddir"/KERNEL_OBJ/.config
yes "" | make -C "$builddir" ARCH="$_carch" HOSTCC="$HOSTCC" \
O="$builddir"/KERNEL_OBJ oldconfig
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" \
O="$builddir"/KERNEL_OBJ
}
package() {
# kernel.release
install -D "$builddir/KERNEL_OBJ/include/config/kernel.release" \
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
# zImage (find the right one)
cd "$builddir/KERNEL_OBJ/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
}
sha512sums="84579ba59ada9166794ec02843616049128c199f9c68b519d3e33056822a22d12921b6589ff058d08e580e877a227a124f999f041e29b6d81a8fde7ce7480b11 linux-planet-geminipda-bf7daa4483d5dce94c9d478fc28854f5978d60da.tar.gz
019e2cb30c6d61b37c5c6c5f583da5be42e37bb7eb695bba4dc30dfe91196d3f20ba57ae3ac6931f9ea4cbf4a7c2cdd95f603191e387c3e292b667049a4e9876 config-planet-geminipda.aarch64"
// 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 */
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment