Motorola Droid 4 (maserati) (#1039)
Note about PMOS_NO_SAFESTRAP kernel cmdline: This can be used to forcefully skip SafeStrap partition mount in device initramfs hook, for example when booting with droid4-kexecboot on device with SafeStrap configured as well.
This commit is contained in:
parent
388a1bee06
commit
12ebd049ff
7 changed files with 3622 additions and 0 deletions
30
device/device-motorola-maserati/10-safestrap-maserati.sh
Normal file
30
device/device-motorola-maserati/10-safestrap-maserati.sh
Normal file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
. /etc/deviceinfo
|
||||
. ./init_functions.sh
|
||||
|
||||
mount_safestrap() {
|
||||
grep -q PMOS_NO_SAFESTRAP /proc/cmdline && return
|
||||
|
||||
mkdir /ss
|
||||
mount -t vfat -o uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020 ${deviceinfo_safestrap_partition} /ss
|
||||
|
||||
slot_loc=$(cat /ss/safestrap/active_slot)
|
||||
|
||||
if [ ! -z $slot_loc ]; then
|
||||
if [ "$slot_loc" = "stock" ]; then
|
||||
umount /ss
|
||||
elif [ "$slot_loc" = "safe" ]; then
|
||||
umount /ss
|
||||
else
|
||||
# setup loopbacks
|
||||
data_partition=$(losetup -f)
|
||||
losetup $data_partition /ss/safestrap/$slot_loc/userdata.img
|
||||
kpartx -afs $data_partition
|
||||
|
||||
system_partition=$(losetup -f)
|
||||
losetup $system_partition /ss/safestrap/$slot_loc/system.img
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
mount_safestrap
|
21
device/device-motorola-maserati/APKBUILD
Normal file
21
device/device-motorola-maserati/APKBUILD
Normal file
|
@ -0,0 +1,21 @@
|
|||
pkgname="device-motorola-maserati"
|
||||
pkgdesc="Motorola Motorola Droid 4"
|
||||
pkgver=0.1
|
||||
pkgrel=1
|
||||
url="https://postmarketos.org"
|
||||
license="MIT"
|
||||
arch="noarch"
|
||||
options="!check"
|
||||
depends="postmarketos-base linux-motorola-maserati"
|
||||
source="deviceinfo 10-safestrap-maserati.sh"
|
||||
|
||||
package() {
|
||||
install -Dm644 "$srcdir"/deviceinfo \
|
||||
"$pkgdir"/etc/deviceinfo
|
||||
|
||||
mkdir -p "$pkgdir"/etc/postmarketos-mkinitfs/hooks/
|
||||
install -Dm644 "$srcdir"/10-safestrap-maserati.sh \
|
||||
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/
|
||||
}
|
||||
sha512sums="7e83d44307330366c9d050395f439af2e46dff5b6eaa2bb3806f3b21630219e0b538271cea7fa41acfbc0ad12445e2b07217f4005eadc0ae74eb616ef9126d02 deviceinfo
|
||||
36e529d5ded647012bb46a3e03ea8916c5046bed628a4b72a0c057dd2de6410bd9a1d74fc01b862feff3a4cfe8b0b0df6bd69fdbb6e63406e97c1811be07f3b8 10-safestrap-maserati.sh"
|
24
device/device-motorola-maserati/deviceinfo
Normal file
24
device/device-motorola-maserati/deviceinfo
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Reference: <https://postmarketos.org/deviceinfo>
|
||||
# Please use double quotes only. You can source this file in shell scripts.
|
||||
|
||||
deviceinfo_format_version="0"
|
||||
deviceinfo_name="Motorola Droid 4"
|
||||
deviceinfo_manufacturer="Motorola"
|
||||
deviceinfo_date=""
|
||||
deviceinfo_dtb=""
|
||||
deviceinfo_modules_initfs=""
|
||||
deviceinfo_arch="armhf"
|
||||
deviceinfo_external_storage="true"
|
||||
|
||||
# Device related
|
||||
deviceinfo_keyboard="true"
|
||||
deviceinfo_screen_width="540"
|
||||
deviceinfo_screen_height="960"
|
||||
deviceinfo_dev_touchscreen=""
|
||||
deviceinfo_dev_keyboard=""
|
||||
|
||||
# Bootloader related
|
||||
deviceinfo_flash_method="none"
|
||||
deviceinfo_safestrap_partition="/dev/mmcblk1p25"
|
||||
deviceinfo_data_partition="/dev/mmcblk1p24"
|
||||
deviceinfo_system_partition="/dev/mmcblk1p20"
|
|
@ -0,0 +1,93 @@
|
|||
From 51a1339a3206ed275b8021958a9a8d237322f9fa Mon Sep 17 00:00:00 2001
|
||||
From: NeKit <nekit1000@gmail.com>
|
||||
Date: Sun, 10 Dec 2017 14:41:20 +0300
|
||||
Subject: [PATCH] Fix compile errors with gcc6 on postmarketOS
|
||||
|
||||
Change-Id: I1f426c864a0377b33b27da5cc6476f6ff888b6cb
|
||||
---
|
||||
arch/arm/include/asm/ftrace.h | 2 +-
|
||||
arch/arm/kernel/return_address.c | 5 -----
|
||||
include/linux/i2c/twl.h | 2 +-
|
||||
kernel/timeconst.pl | 2 +-
|
||||
scripts/mod/elf.h | 5 -----
|
||||
5 files changed, 3 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
|
||||
index f89515adac6..2bb8cac28b9 100644
|
||||
--- a/arch/arm/include/asm/ftrace.h
|
||||
+++ b/arch/arm/include/asm/ftrace.h
|
||||
@@ -45,7 +45,7 @@ void *return_address(unsigned int);
|
||||
|
||||
#else
|
||||
|
||||
-extern inline void *return_address(unsigned int level)
|
||||
+static inline void *return_address(unsigned int level)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c
|
||||
index 0b13a72f855..8bf0a5abec9 100644
|
||||
--- a/arch/arm/kernel/return_address.c
|
||||
+++ b/arch/arm/kernel/return_address.c
|
||||
@@ -62,11 +62,6 @@ void *return_address(unsigned int level)
|
||||
#warning "TODO: return_address should use unwind tables"
|
||||
#endif
|
||||
|
||||
-void *return_address(unsigned int level)
|
||||
-{
|
||||
- return NULL;
|
||||
-}
|
||||
-
|
||||
#endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) / else */
|
||||
|
||||
EXPORT_SYMBOL_GPL(return_address);
|
||||
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
|
||||
index 947543a0fba..ec7c8855117 100644
|
||||
--- a/include/linux/i2c/twl.h
|
||||
+++ b/include/linux/i2c/twl.h
|
||||
@@ -735,7 +735,7 @@ static inline int twl4030_remove_script(u8 flags) { return -EINVAL; }
|
||||
#ifdef CONFIG_TWL6030_POWER
|
||||
extern void twl6030_power_init(struct twl4030_power_data *power_data);
|
||||
#else
|
||||
-extern inline void twl6030_power_init(struct twl4030_power_data *power_data) { }
|
||||
+static inline void twl6030_power_init(struct twl4030_power_data *power_data) { }
|
||||
#endif
|
||||
|
||||
struct twl4030_codec_audio_data {
|
||||
diff --git a/kernel/timeconst.pl b/kernel/timeconst.pl
|
||||
index eb51d76e058..2ccb8fb87a1 100644
|
||||
--- a/kernel/timeconst.pl
|
||||
+++ b/kernel/timeconst.pl
|
||||
@@ -370,7 +370,7 @@ if ($hz eq '--can') {
|
||||
}
|
||||
|
||||
@val = @{$canned_values{$hz}};
|
||||
- if (!defined(@val)) {
|
||||
+ if (!@val) {
|
||||
@val = compute_values($hz);
|
||||
}
|
||||
output($hz, @val);
|
||||
diff --git a/scripts/mod/elf.h b/scripts/mod/elf.h
|
||||
index aba4d0c4c1c..f898d3ee28b 100644
|
||||
--- a/scripts/mod/elf.h
|
||||
+++ b/scripts/mod/elf.h
|
||||
@@ -22,8 +22,6 @@
|
||||
|
||||
/* #include <features.h> */
|
||||
|
||||
-__BEGIN_DECLS
|
||||
-
|
||||
/* Standard ELF types. */
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -2507,7 +2505,4 @@ typedef Elf32_Addr Elf32_Conflict;
|
||||
/* Keep this the last entry. */
|
||||
#define R_V850_NUM 25
|
||||
|
||||
-
|
||||
-__END_DECLS
|
||||
-
|
||||
#endif /* elf.h */
|
||||
--
|
||||
2.13.2
|
||||
|
138
device/linux-motorola-maserati/APKBUILD
Normal file
138
device/linux-motorola-maserati/APKBUILD
Normal file
|
@ -0,0 +1,138 @@
|
|||
# Kernel config based on: arch/arm/configs/mapphone_mmi_defconfig
|
||||
|
||||
pkgname="linux-motorola-maserati"
|
||||
pkgver=3.0.8
|
||||
pkgrel=0
|
||||
pkgdesc="Motorola Droid 4 kernel fork"
|
||||
arch="armhf"
|
||||
_carch="arm"
|
||||
_flavor="motorola-maserati"
|
||||
url="https://kernel.org"
|
||||
license="GPL2"
|
||||
options="!strip !check !tracedeps"
|
||||
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev"
|
||||
HOSTCC="${CC:-gcc}"
|
||||
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
|
||||
|
||||
# Source
|
||||
_repository="android_kernel_motorola_omap4-common"
|
||||
_commit="2a348afc315c4ab32c4a1c8cb2c7e2ad0cedaec3"
|
||||
_config="config-${_flavor}.${arch}"
|
||||
|
||||
_wlan_repository="android_hardware_ti_wlan"
|
||||
_wlan_commit="f75d24a45f68dfeabda86d2e8416990d796f9a7e"
|
||||
|
||||
_hardware_repository="android_hardware_ti_omap4"
|
||||
_hardware_commit="0f456ee3a0d8cc79b708a11b505a9e376d467a2b"
|
||||
|
||||
source="
|
||||
$pkgname-$_commit.tar.gz::https://github.com/NotKit/${_repository}/archive/${_commit}.tar.gz
|
||||
$_wlan_repository-$_wlan_commit.tar.gz::https://github.com/LineageOS/${_wlan_repository}/archive/${_wlan_commit}.tar.gz
|
||||
$_hardware_repository-$_hardware_commit.tar.gz::https://github.com/LineageOS/${_hardware_repository}/archive/${_hardware_commit}.tar.gz
|
||||
$_config
|
||||
compiler-gcc6.h
|
||||
01_maserati-fix-gcc6-compile.patch
|
||||
"
|
||||
builddir="$srcdir/${_repository}-${_commit}"
|
||||
_wlan_builddir="$srcdir/${_wlan_repository}-${_wlan_commit}/mac80211/compat_wl12xx"
|
||||
_pvr_builddir="$srcdir/${_hardware_repository}-${_hardware_commit}/pvr-source/eurasiacon"
|
||||
|
||||
prepare() {
|
||||
default_prepare
|
||||
|
||||
# gcc6 support
|
||||
cp -v "$srcdir/compiler-gcc6.h" "$builddir/include/linux/"
|
||||
|
||||
# Remove -Werror from all makefiles
|
||||
find . -type f -name Makefile -print0 | \
|
||||
xargs -0 sed -i 's/-Werror-/-W/g'
|
||||
find . -type f -name Makefile -print0 | \
|
||||
xargs -0 sed -i 's/-Werror//g'
|
||||
|
||||
# Prepare kernel config ('yes ""' for kernels lacking olddefconfig)
|
||||
cp "$srcdir"/$_config "$builddir"/.config
|
||||
yes "" | make ARCH="$_carch" HOSTCC="$HOSTCC" oldconfig
|
||||
|
||||
# Workaround to get the Makefile working outside of a git repository
|
||||
cd "$_wlan_builddir"
|
||||
mkdir -p .git/refs/tags
|
||||
touch .git/HEAD .git/index .git/refs/tags
|
||||
sed -i "s/\$(shell git describe --dirty)/$_wlan_commit/g" drivers/net/wireless/wl12xx/Makefile
|
||||
}
|
||||
|
||||
menuconfig() {
|
||||
cd "$builddir"
|
||||
make ARCH="$_carch" menuconfig
|
||||
cp .config "$startdir"/$_config
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "$builddir"
|
||||
unset LDFLAGS
|
||||
make ARCH="$_carch" CC="${CC:-gcc}" \
|
||||
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
|
||||
|
||||
cd "$_wlan_builddir"
|
||||
make ARCH="$_carch" CC="${CC:-gcc}" \
|
||||
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" \
|
||||
KBUILD_NOPEDANTIC=1 \
|
||||
KERNEL_DIR="$builddir" KLIB="$builddir" KLIB_BUILD="$builddir"
|
||||
|
||||
cd "$_pvr_builddir/build/linux2/omap4430_android"
|
||||
make ARCH="$_carch" CC="${CC:-gcc}" \
|
||||
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" \
|
||||
TARGET_SGX=540 BUILD=release PLATFORM_VERSION=4.0 \
|
||||
KERNELDIR="$builddir"
|
||||
}
|
||||
|
||||
package() {
|
||||
# kernel.release
|
||||
install -D "$builddir/include/config/kernel.release" \
|
||||
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
|
||||
|
||||
# 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"
|
||||
make modules_install \
|
||||
ARCH="$_carch" CC="${CC:-gcc}" \
|
||||
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" \
|
||||
INSTALL_MOD_STRIP=1 \
|
||||
INSTALL_MOD_PATH="$pkgdir"
|
||||
|
||||
cd "$_wlan_builddir"
|
||||
for _module in "compat/compat.ko" "net/mac80211/mac80211.ko" \
|
||||
"net/wireless/cfg80211.ko" "drivers/net/wireless/wl12xx/wl12xx.ko" \
|
||||
"drivers/net/wireless/wl12xx/wl12xx_spi.ko" \
|
||||
"drivers/net/wireless/wl12xx/wl12xx_sdio.ko"; do
|
||||
install -Dm644 "$_module" "$pkgdir/lib/modules/$pkgver/kernel/$_module"
|
||||
${CROSS_COMPILE}strip --strip-unneeded \
|
||||
"$pkgdir/lib/modules/$pkgver/kernel/$_module"
|
||||
done
|
||||
|
||||
cd "$_pvr_builddir/binary2_omap4430_android_release/target/kbuild"
|
||||
install -Dm644 "pvrsrvkm.ko" \
|
||||
"$pkgdir/lib/modules/$pkgver/pvrsrvkm_sgx540_120.ko"
|
||||
${CROSS_COMPILE}strip --strip-unneeded \
|
||||
"$pkgdir/lib/modules/$pkgver/pvrsrvkm_sgx540_120.ko"
|
||||
|
||||
depmod -b "$pkgdir" $pkgver
|
||||
}
|
||||
|
||||
sha512sums="0cb163100dad093b56c208c17c021a8aa3a4ae133468701d4ece2fc7342661db8e118795a00fbc2d7921743039c00976ff0e361e41a68f8280bf6b630857b680 linux-motorola-maserati-2a348afc315c4ab32c4a1c8cb2c7e2ad0cedaec3.tar.gz
|
||||
961568d8f2cf2325292176f30542431e145594dacb817e87ecfab1b7c8d95fa93e61babca9779851c2d5b9bb8d9566f84665d96f22845e4a6602d9e314d8d785 android_hardware_ti_wlan-f75d24a45f68dfeabda86d2e8416990d796f9a7e.tar.gz
|
||||
a27237cff59b13740d4107bcfcac706ba5dfc204f51e39fb5b72fb1fbb1fb0ac13fc1a9c694dfc48c0883d359ff11fd7a67ca1e3f277bd086b5c63160fe0824c android_hardware_ti_omap4-0f456ee3a0d8cc79b708a11b505a9e376d467a2b.tar.gz
|
||||
4582ffede12e8c6546e8cd16eed088e94f8c7ba7e501a88c1b2a46b5ec6e750186e4f7259def9628465149459c4859ec8bff5b5bdbf2f751278c15cb6abd5eb5 config-motorola-maserati.armhf
|
||||
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h
|
||||
90c3a109600b00ce691d13cc19a1868cd9aea4033f99273a8cfc83e0f7beced31421303fa0418fb8a919843bf4c1310d4597e6c7d37c7776356036269810308f 01_maserati-fix-gcc6-compile.patch"
|
69
device/linux-motorola-maserati/compiler-gcc6.h
Normal file
69
device/linux-motorola-maserati/compiler-gcc6.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
// 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 */
|
||||
|
3247
device/linux-motorola-maserati/config-motorola-maserati.armhf
Normal file
3247
device/linux-motorola-maserati/config-motorola-maserati.armhf
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue