wiko-lenny5: new device (MR 2641)

[ci:skip-build] Already built on CI in MR
This commit is contained in:
Tojo Rakotoarison 2021-10-25 14:50:49 +02:00 committed by Alexey Minnekhanov
parent f125901979
commit eddbe11b52
No known key found for this signature in database
GPG key ID: 6FE3B029D9D9FAFF
8 changed files with 4233 additions and 0 deletions

View file

@ -0,0 +1,29 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-wiko-lenny5
pkgdesc="Wiko Lenny 5"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="
linux-wiko-lenny5
mesa-dri-gallium
mkbootimg
postmarketos-base
"
makedepends="devicepkg-dev"
source="deviceinfo"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
sha512sums="
6387db4a981364585ab917ee01ca9eddf7e0a222828e63dadd54e200b9b1cdb9959f681566c7f31d8f78a0d360acacd966635a0e607857ee9869f24c6bb142aa deviceinfo
"

View file

@ -0,0 +1,34 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell
# scripts.
deviceinfo_format_version="0"
deviceinfo_name="Wiko Lenny 5"
deviceinfo_manufacturer="Wiko"
deviceinfo_codename="wiko-lenny5"
deviceinfo_year="2018"
deviceinfo_arch="armv7"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="720"
deviceinfo_screen_height="1440"
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="bootopt=64S3,32S1,32S1 buildvariant=user"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_bootimg_mtk_mkimage="false"
deviceinfo_bootimg_dtb_second="false"
deviceinfo_flash_sparse="true"
deviceinfo_flash_pagesize="2048"
deviceinfo_flash_offset_base="0x80000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x04000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x0e000000"

View file

@ -0,0 +1,77 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm/configs/k400_defconfig
pkgname=linux-wiko-lenny5
pkgver=3.18.79
pkgrel=0
pkgdesc="Wiko Lenny 5 Kernel"
arch="armv7"
_carch="arm"
_flavor="wiko-lenny5"
url="https://wikomobile.com"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="
bash
bc
bison
devicepkg-dev
flex
linux-headers
openssl
perl
gcc6
python2
libc6-compat
"
if [ "${CC:0:5}" != "gcc6-" ]; then
CC="gcc6-$CC"
HOSTCC="gcc6-gcc"
CROSS_COMPILE="gcc6-$CROSS_COMPILE"
fi
# Source
_download_url="http://www.wikogeek.com/index.php?tel="
_download_id="73278a4a86960eeb576a8fd4c9ec6997"
_config="config-$_flavor.$arch"
source="
$pkgname-$_download_id.zip::$_download_url$_download_id
$_config
fix_dts_headers.patch
vdsomunge_upstream.patch
gcc8-fix-put-user.patch
gcc10-extern_YYLOC_global_declaration.patch
"
builddir="$srcdir/kernel-3.18"
# Workaround to extract the kernel-3.18.tar.gz archive file in the $srcdir
_src_subpath="WK300_Jerry3-WK400_Lenny5_OpenSource/Jerry3-Lenny5-OpenSource/"
_kernel_zip="$srcdir/$_src_subpath/kernel-3.18.tar.gz"
_outdir="out"
prepare() {
tar xzkf $_kernel_zip -C $srcdir
default_prepare
. downstreamkernel_prepare
}
build() {
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir"
}
sha512sums="
87e9c0d2b7d06f84fa4185eabd224036529bb033fdfab5ba48125534765a169dfd904476f8c25cf53565c6fa416d668a008ac8d1cd98af6d5e4956ff386d1b09 linux-wiko-lenny5-73278a4a86960eeb576a8fd4c9ec6997.zip
efdb0d3ba7a6e0525bf278db628affd881d2e67f7cc454e8921daa42b9921d46764c2bd304bf533e00f7332f02c523ac7c2eaf6982808d8db9d10ca278573b34 config-wiko-lenny5.armv7
2287abb30b410f5ba13ee6dc1bb603789f9eeda9eda4a982263354aa303501b37742d8f8758b92d1edc32622505ce05e6c545257534b8c65dc8093606195d825 fix_dts_headers.patch
19a6c3445bfd8057e4fabe1709f3d2344f3a99fef49b44636c07a18ba8791fab1bcff77f93aadff887946ae6f83c9d86e1c28f9b88d03c6ba156704d430b4470 vdsomunge_upstream.patch
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb gcc10-extern_YYLOC_global_declaration.patch
"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,14 @@
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index b40e5154..a17af78d 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -158,7 +158,8 @@ ld_flags = $(LDFLAGS) $(ldflags-y)
dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \
-I$(srctree)/arch/$(SRCARCH)/boot/dts \
-Iarch/$(SRCARCH)/boot/dts \
- -I$(srctree)/arch/$(SRCARCH)/boot/dts/include \
+ -I$(srctree)/arch/$(SRCARCH)/boot/dts/include \
+ -I$(srctree)/include/ \
-I$(objtree)/include/ \
-I$(srctree)/drivers/of/testcase-data \
-I$(objtree)/include \

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc10-extern_YYLOC_global_declaration.patch

View file

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

View file

@ -0,0 +1,178 @@
Fixes compilation under gcc8 without glibc
---
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;
}