nokia-frt: add device

This commit is contained in:
Piotr Halama 2019-02-26 15:43:27 +00:00 committed by Martijn Braam
parent 021640f04b
commit 3ed0baa39a
10 changed files with 4298 additions and 0 deletions

View file

@ -0,0 +1,29 @@
# Reference: <https://postmarketos.org/devicepkg>
maintainer="Piotr Halama <skrzynka@halamix2.pl>"
pkgname="device-nokia-frt"
pkgdesc="Nokia 1"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="postmarketos-base linux-nokia-frt mkbootimg mesa-dri-swrast"
makedepends="devicepkg-dev"
source="
deviceinfo
fb.modes
"
build() {
devicepkg_build $startdir $pkgname
}
package() {
install -Dm644 "$srcdir"/fb.modes "$pkgdir"/etc/fb.modes
devicepkg_package $startdir $pkgname
}
sha512sums="2e597de63e275b133027288f10920f731d2a0b3b97ef7fafe13de1915f4bcf6abb7971cf220019042a8ff8a0361730957e5fd8510715620dac5177943cb3c0ae deviceinfo
0a0237d639566cdd283182f17ea3f0fb8349c2fbc2c289eae418eac6837b9f2f4acf4a3c18c540d59c19dcbf30e12ac4e83c4f8303bbb4cd7e54b66c78ecfbcb fb.modes"

View file

@ -0,0 +1,33 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="Nokia 1"
deviceinfo_manufacturer="Nokia"
deviceinfo_codename="nokia-frt"
deviceinfo_date="2018"
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_arch="armv7"
# Device related
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="480"
deviceinfo_screen_height="854"
deviceinfo_dev_touchscreen="/dev/input/event2"
deviceinfo_dev_touchscreen_calibration=""
deviceinfo_dev_keyboard=""
# Bootloader related
deviceinfo_flash_method="fastboot"
#makefile suggests buildvariant=userdebug
deviceinfo_kernel_cmdline="bootopt=64S3,32N2,32N2 buildvariant=user"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_flash_offset_base="0x40000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x04000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x0e000000"
deviceinfo_flash_pagesize="2048"

View file

@ -0,0 +1,7 @@
mode "480x854-0"
# D: 0.000 MHz, H: 0.000 kHz, V: 0.001 Hz
geometry 480 854 480 854 16
timings 4294967295 4294967295 4294967295 4294967295 4294967295 4294967295 4294967295
accel false
rgba 8/0,8/8,8/16,8/24
endmode

View file

@ -0,0 +1,16 @@
On some Mediatek kernel this seems to help with incorrect path "./tools/tools"
---
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index 8abbef164b4e..7a2f1510a630 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -2,7 +2,7 @@ ifneq ($(O),)
ifeq ($(origin O), command line)
dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),)
ABSOLUTE_O := $(shell cd $(O) ; pwd)
- OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)
+ OUTPUT := $(ABSOLUTE_O)/
COMMAND_O := O=$(ABSOLUTE_O)
ifeq ($(objtree),)
objtree := $(O)

View file

@ -0,0 +1,17 @@
This program cannot be used as it uses glibc, it doesn't seem to break anything
diff --git a/scripts/drvgen/drvgen.mk b/scripts/drvgen/drvgen.mk
index 17f5f7b7273d..a40efd974f3f 100644
--- a/scripts/drvgen/drvgen.mk
+++ b/scripts/drvgen/drvgen.mk
@@ -92,7 +92,8 @@ $(DTB_OVERLAY_IMAGE_TAGERT) : $(PRIVATE_MULTIPLE_DTB_OVERLAY_OBJ) dtbs $(PRIVATE
@echo Singing the generated overlay dtbo.
cat $(PRIVATE_DTB_OVERLAY_OBJ) > $(PRIVATE_MULTIPLE_DTB_OVERLAY_OBJ) || (rm -f $(PRIVATE_MULTIPLE_DTB_OVERLAY_OBJ); false)
python $(PRIVATE_MULTIPLE_DTB_OVERLAY_HDR) $(PRIVATE_MULTIPLE_DTB_OVERLAY_OBJ) $(PRIVATE_MULTIPLE_DTB_OVERLAY_IMG)
- $(PRIVATE_MKIMAGE_TOOL) $(PRIVATE_MULTIPLE_DTB_OVERLAY_IMG) $(PRIVATE_MKIMAGE_CFG) > $@
+ # Not needed, requires glibc
+ #$(PRIVATE_MKIMAGE_TOOL) $(PRIVATE_MULTIPLE_DTB_OVERLAY_IMG) $(PRIVATE_MKIMAGE_CFG) > $@
.PHONY: odmdtboimage dtbs
odmdtboimage : $(DTB_OVERLAY_IMAGE_TAGERT)

View file

@ -0,0 +1,60 @@
Fixes for wrong includes paths, probably missing symlinks
---
diff --git a/drivers/misc/mediatek/cmdq/v2/cmdq_def.h b/drivers/misc/mediatek/cmdq/v2/cmdq_def.h
index 9383c5860a00..b01dfddab473 100644
--- a/drivers/misc/mediatek/cmdq/v2/cmdq_def.h
+++ b/drivers/misc/mediatek/cmdq/v2/cmdq_def.h
@@ -22,7 +22,7 @@
#ifdef CMDQ_COMMON_ENG_SUPPORT
#include "cmdq_engine_common.h"
#else
-#include "cmdq_engine.h"
+#include "mt6735/cmdq_engine.h"
#endif
#define CMDQ_SPECIAL_SUBSYS_ADDR (99)
diff --git a/drivers/misc/mediatek/ext_disp/extd_factory.c b/drivers/misc/mediatek/ext_disp/extd_factory.c
index 92c137980092..505dd793ab61 100644
--- a/drivers/misc/mediatek/ext_disp/extd_factory.c
+++ b/drivers/misc/mediatek/ext_disp/extd_factory.c
@@ -17,7 +17,7 @@
#include "extd_log.h"
#include "extd_factory.h"
#include "extd_info.h"
-#include "external_display.h"
+#include "mt6735m/external_display.h"
#include "dpi_dvt_test.h"
diff --git a/drivers/misc/mediatek/ext_disp/extd_multi_control.c b/drivers/misc/mediatek/ext_disp/extd_multi_control.c
index 52dd1f77b6b5..e6277c4eb37c 100644
--- a/drivers/misc/mediatek/ext_disp/extd_multi_control.c
+++ b/drivers/misc/mediatek/ext_disp/extd_multi_control.c
@@ -16,8 +16,8 @@
#include "extd_multi_control.h"
#include "disp_drv_platform.h"
-#include "external_display.h"
-#include "extd_platform.h"
+#include "mt6735m/external_display.h"
+#include "mt6735m/extd_platform.h"
#include "extd_log.h"
#include "mtk_ovl.h"
diff --git a/drivers/misc/mediatek/m4u/mt6735/m4u_priv.h b/drivers/misc/mediatek/m4u/mt6735/m4u_priv.h
index ec1f9d6a2993..9b5fd8ba67d3 100644
--- a/drivers/misc/mediatek/m4u/mt6735/m4u_priv.h
+++ b/drivers/misc/mediatek/m4u/mt6735/m4u_priv.h
@@ -25,9 +25,9 @@
#endif
#include "m4u.h"
-#include "m4u_reg.h"
+#include "mt6735m/m4u_reg.h"
#include "../2.0/m4u_pgtable.h"
-#include "m4u_platform.h"
+#include "mt6735m/m4u_platform.h"
#define M4UMSG(string, args...) pr_err("M4U"string, ##args)
#define M4UINFO(string, args...) pr_debug("M4U"string, ##args)

View file

@ -0,0 +1,180 @@
Downstream version required various glibc functions,
this patch contains version from upstream kernel 4.19
---
diff --git a/arch/arm/vdso/vdsomunge.c b/arch/arm/vdso/vdsomunge.c
index 9005b07296c8..f6455273b2f8 100644
--- a/arch/arm/vdso/vdsomunge.c
+++ b/arch/arm/vdso/vdsomunge.c
@@ -45,13 +45,10 @@
* it does.
*/
-#define _GNU_SOURCE
-
-#include <byteswap.h>
#include <elf.h>
#include <errno.h>
-#include <error.h>
#include <fcntl.h>
+#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -61,6 +58,16 @@
#include <sys/types.h>
#include <unistd.h>
+#define swab16(x) \
+ ((((x) & 0x00ff) << 8) | \
+ (((x) & 0xff00) >> 8))
+
+#define swab32(x) \
+ ((((x) & 0x000000ff) << 24) | \
+ (((x) & 0x0000ff00) << 8) | \
+ (((x) & 0x00ff0000) >> 8) | \
+ (((x) & 0xff000000) >> 24))
+
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define HOST_ORDER ELFDATA2LSB
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
@@ -82,27 +89,41 @@
#define EF_ARM_ABI_FLOAT_HARD 0x400
#endif
+static int failed;
+static const char *argv0;
static const char *outfile;
+static void fail(const char *fmt, ...)
+{
+ va_list ap;
+
+ failed = 1;
+ fprintf(stderr, "%s: ", argv0);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(EXIT_FAILURE);
+}
+
static void cleanup(void)
{
- if (error_message_count > 0 && outfile != NULL)
+ if (failed && outfile != NULL)
unlink(outfile);
}
static Elf32_Word read_elf_word(Elf32_Word word, bool swap)
{
- return swap ? bswap_32(word) : word;
+ return swap ? swab32(word) : word;
}
static Elf32_Half read_elf_half(Elf32_Half half, bool swap)
{
- return swap ? bswap_16(half) : half;
+ return swap ? swab16(half) : half;
}
static void write_elf_word(Elf32_Word val, Elf32_Word *dst, bool swap)
{
- *dst = swap ? bswap_32(val) : val;
+ *dst = swap ? swab32(val) : val;
}
int main(int argc, char **argv)
@@ -119,68 +140,66 @@ int main(int argc, char **argv)
int infd;
atexit(cleanup);
+ argv0 = argv[0];
if (argc != 3)
- error(EXIT_FAILURE, 0, "Usage: %s [infile] [outfile]", argv[0]);
+ fail("Usage: %s [infile] [outfile]\n", argv[0]);
infile = argv[1];
outfile = argv[2];
infd = open(infile, O_RDONLY);
if (infd < 0)
- error(EXIT_FAILURE, errno, "Cannot open %s", infile);
+ fail("Cannot open %s: %s\n", infile, strerror(errno));
if (fstat(infd, &stat) != 0)
- error(EXIT_FAILURE, errno, "Failed stat for %s", infile);
+ fail("Failed stat for %s: %s\n", infile, strerror(errno));
inbuf = mmap(NULL, stat.st_size, PROT_READ, MAP_PRIVATE, infd, 0);
if (inbuf == MAP_FAILED)
- error(EXIT_FAILURE, errno, "Failed to map %s", infile);
+ fail("Failed to map %s: %s\n", infile, strerror(errno));
close(infd);
inhdr = inbuf;
if (memcmp(&inhdr->e_ident, ELFMAG, SELFMAG) != 0)
- error(EXIT_FAILURE, 0, "Not an ELF file");
+ fail("Not an ELF file\n");
if (inhdr->e_ident[EI_CLASS] != ELFCLASS32)
- error(EXIT_FAILURE, 0, "Unsupported ELF class");
+ fail("Unsupported ELF class\n");
swap = inhdr->e_ident[EI_DATA] != HOST_ORDER;
if (read_elf_half(inhdr->e_type, swap) != ET_DYN)
- error(EXIT_FAILURE, 0, "Not a shared object");
+ fail("Not a shared object\n");
- if (read_elf_half(inhdr->e_machine, swap) != EM_ARM) {
- error(EXIT_FAILURE, 0, "Unsupported architecture %#x",
- inhdr->e_machine);
- }
+ if (read_elf_half(inhdr->e_machine, swap) != EM_ARM)
+ fail("Unsupported architecture %#x\n", inhdr->e_machine);
e_flags = read_elf_word(inhdr->e_flags, swap);
if (EF_ARM_EABI_VERSION(e_flags) != EF_ARM_EABI_VER5) {
- error(EXIT_FAILURE, 0, "Unsupported EABI version %#x",
- EF_ARM_EABI_VERSION(e_flags));
+ fail("Unsupported EABI version %#x\n",
+ EF_ARM_EABI_VERSION(e_flags));
}
if (e_flags & EF_ARM_ABI_FLOAT_HARD)
- error(EXIT_FAILURE, 0,
- "Unexpected hard-float flag set in e_flags");
+ fail("Unexpected hard-float flag set in e_flags\n");
clear_soft_float = !!(e_flags & EF_ARM_ABI_FLOAT_SOFT);
outfd = open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (outfd < 0)
- error(EXIT_FAILURE, errno, "Cannot open %s", outfile);
+ fail("Cannot open %s: %s\n", outfile, strerror(errno));
if (ftruncate(outfd, stat.st_size) != 0)
- error(EXIT_FAILURE, errno, "Cannot truncate %s", outfile);
+ fail("Cannot truncate %s: %s\n", outfile, strerror(errno));
outbuf = mmap(NULL, stat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED,
outfd, 0);
if (outbuf == MAP_FAILED)
- error(EXIT_FAILURE, errno, "Failed to map %s", outfile);
+ fail("Failed to map %s: %s\n", outfile, strerror(errno));
close(outfd);
@@ -195,7 +214,7 @@ int main(int argc, char **argv)
}
if (msync(outbuf, stat.st_size, MS_SYNC) != 0)
- error(EXIT_FAILURE, errno, "Failed to sync %s", outfile);
+ fail("Failed to sync %s: %s\n", outfile, strerror(errno));
return EXIT_SUCCESS;
}

View file

@ -0,0 +1,82 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm/configs/FRT_defconfig
maintainer="Piotr Halama <skrzynka@halamix2.pl>"
pkgname="linux-nokia-frt"
pkgver=3.18.79
pkgrel=0
pkgdesc="Nokia 1 kernel fork"
arch="armv7"
_carch="arm"
_flavor="nokia-frt"
url="https://www.nokia.com/phones/en_int/opensource/"
license="GPL-2.0-only"
options="!strip !check !tracedeps"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev python"
# Compiler: latest GCC from Alpine
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
# Source
_repository="android_kernel_nokia_1"
_commit="f17e3dc43479ed748f85080e5be04be228ed754d"
_config="config-${_flavor}.${arch}"
source="
$pkgname-$_commit.tar.gz::https://github.com/pmsourcedump/${_repository}/archive/${_commit}.tar.gz
$_config
gcc8-fix-put-user.patch
00_makefile_path.patch
01_drvgen_mk.patch
02_path_fixes.patch
03_vdsomunge_upstream.patch
"
#gcc7-give-up-on-ilog2-const-optimizations.patch
builddir="$srcdir/${_repository}-${_commit}"
prepare() {
default_prepare
downstreamkernel_prepare "$srcdir" "$builddir" "$_config" "$_carch" "$HOSTCC"
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}
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
# Modules
cd "$builddir"
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1))-postmarketOS" \
INSTALL_MOD_PATH="$pkgdir" INSTALL_MOD_STRIP=1 \
modules_install
}
sha512sums="d9026958c7f9cb7dbc56b27baab3362d6a34e975ebf933e8ee404dc76638d17fd3d2508f262f10190f646a0881d68ab0e0a40f2fce15a55409527f3af8ea9d19 linux-nokia-frt-f17e3dc43479ed748f85080e5be04be228ed754d.tar.gz
4e4c05f4095c0490bb04b262b19033adda7d95fdec5c6c5bf1ba4b2cfa812ff159c9637f9cb6a3e854b46923467e9559d39b8b2b81f6fe6d038a6dbf5961c303 config-nokia-frt.armv7
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
ef8b9da80ca67424a02acfbf99924e3ea06574c83c6a737031f6ac41b718742ef0bd66b968b14118cac021067e29184e2199f238ace2a43dc2176d9cce796bc5 00_makefile_path.patch
aaf7e208f307db3126202f3f3410d4f8a74b450ef719717a064c817258cb428a150a798494f57e43f9e1f747ad83527e565f8d81c3c746d1fb0b4e42e6e30d50 01_drvgen_mk.patch
bba77598f2fc5615b21f98db7e6a43a35d9cfae0e10fb8754d3b3c198ed36def390937c766550e251ae6c9867145e13dd0d1977bc8cc259ac53e48fedc4d0fee 02_path_fixes.patch
2bd2706f7b42a313e81bf27726ef697f0292f8f2c53ded5d344d410d25fc02375ea9659c7dab93500d4966e91efb0658d6ecf3292196350159e2cd54ed78441e 03_vdsomunge_upstream.patch"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc8-fix-put-user.patch