Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xiaomi Redmi 6 (cereus) port #1

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 35 additions & 0 deletions .ci/pmbinstall.expect
@@ -0,0 +1,35 @@
#!/usr/bin/expect

# Set the timeout for expect statements (in seconds)
# 30 minutes.
set timeout 1800

# Command to spawn and interact with
# spawn /home/jerin/code/redmi6-postmarketos/pwd-form.sh
spawn pmbootstrap --details-to-stdout -v install

# Expect the first prompt (e.g., "Enter password:")
expect "New password:" {
send "unsafepwd\r"
} timeout {
# Handle a timeout if the prompt doesn't appear
puts "Timed out waiting for the password prompt"
exit 1
}

# Expect the second prompt (e.g., "Confirm password:")
expect "Retype new password:" {
send "unsafepwd\r"
} timeout {
# Handle a timeout if the prompt doesn't appear
puts "Timed out waiting for the confirmation prompt"
exit 1
}

# Wait for the command to finish
expect eof

# Optionally, you can add more expect/send blocks for additional prompts

# Exit the script
exit 0
21 changes: 21 additions & 0 deletions .ci/xiaomi-cereus.prompt
jerinphilip marked this conversation as resolved.
Show resolved Hide resolved
@@ -0,0 +1,21 @@
pmws
edge
xiaomi
cereus
y
armv7
Xiaomi
Redmi 6
2018
handset
n
y
mtkclient
jp
console
n
vim
y
en_US
xiaomi-cereus
y
21 changes: 21 additions & 0 deletions .ci/xiaomi-cereus.prompt.keys
@@ -0,0 +1,21 @@
workspace
channel
vendor
codename
new-device?
arch
Manufacturer
Name
Year of Release
Type
Hardware Keyboard?
External Memory?
Flash method: fastboot, mtkclient, ?
user
UI: console, gnome..?
Additional change them?
Extra Packages
TimeZone use host?
Locale
Hostname
Build outdated packages?
61 changes: 61 additions & 0 deletions .github/workflows/main.yml
@@ -0,0 +1,61 @@
name: "main"
on:
push:
branches:
- master
tags:
- "v*.*.*"
pull_request:
branches:
- '**'

jobs:
e2e:
name: "e2e"
runs-on: "ubuntu-latest"

steps:


- name: Install dependencies
run: |
git clone https://git.sr.ht/~postmarketos/pmbootstrap
mkdir -p $HOME/.local/bin
sudo ln -s "$PWD/pmbootstrap/pmbootstrap.py" /usr/bin/pmbootstrap
pmbootstrap --version
sudo apt-get install expect

- name: Write configuration file
run: |
wget https://raw.githubusercontent.com/jerinphilip/pmaports/${{github.sha}}/.ci/xiaomi-cereus.prompt

- name: Initialize
run: |
cat xiaomi-cereus.prompt | pmbootstrap init
cat $HOME/.config/pmbootstrap.cfg

- name: Swap active branch in workspace pmaports
run: |
cd pmws/cache_git/pmaports
rm -rv device/testing/{linux,device}-xiaomi-cereus
git remote add jp https://github.com/${{github.repository}}
git fetch jp -a
git checkout xiaomi-cereus

- name: Build
run: |
pmbootstrap -v --details-to-stdout build linux-xiaomi-cereus

- name: Install
run: |
# pmbootstrap -v --details-to-stdout install
./pmws/cache_git/pmaports/.ci/pmbinstall.expect

- name: Upload logs
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: build-artifacts
path: |-
pmws/log.txt

33 changes: 33 additions & 0 deletions device/testing/device-xiaomi-cereus/APKBUILD
@@ -0,0 +1,33 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-xiaomi-cereus
pkgdesc="Xiaomi Redmi 6"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="
linux-xiaomi-cereus
mkbootimg
postmarketos-base
msm-fb-refresher
"
makedepends="devicepkg-dev"
source="
deviceinfo
modules-initfs
"

build() {
devicepkg_build $startdir $pkgname
}

package() {
devicepkg_package $startdir $pkgname
}

sha512sums="
5baa0ab15944fd10547bd47896fbcca78a42062e39458c062d609d2e97f75d5d22cfbb9fdee868d48ed7ae7c6bde67234f7bc369c3d4fca8c1438c3736a874ae deviceinfo
03cab135b4d8d249724a36e30af94404ad56fb14f30819838a2fa35a84ec4f65152a72db7534c97fcfe0aa4de16c112f556f799f66ec8134f76aba84efc3eafa modules-initfs
"
34 changes: 34 additions & 0 deletions device/testing/device-xiaomi-cereus/deviceinfo
@@ -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="Xiaomi Redmi 6"
deviceinfo_manufacturer="Xiaomi"
deviceinfo_codename="xiaomi-cereus"
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="mtkclient"
# 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_pagesize="2048"
deviceinfo_header_version="1"
deviceinfo_flash_offset_base="0x40000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x11b00000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x07880000"

6 changes: 6 additions & 0 deletions device/testing/device-xiaomi-cereus/modules-initfs
@@ -0,0 +1,6 @@
# Remove this comment after reading, or the file if unnecessary (CHANGEME!)
# This file can contain a list of modules to be included in the initramfs,
# so that they are available in early boot stages. It should have one
# module name per line. If there are multiple kernel variants with different
# requirements for modules into the initramfs, one modules-initfs.$variant
# file should be created for each of them.
@@ -0,0 +1,51 @@
From 1978be4d1641894fe7f1c6999d77a6a455b4c655 Mon Sep 17 00:00:00 2001
From: Jerin Philip <jerinphilip@live.in>
Date: Mon, 11 Sep 2023 02:15:18 +0530
Subject: [PATCH 1/2] gcc10 extern YYLOC global declaration

Based on https://lkml.org/lkml/2020/4/1/1206. In original patch, YYLOC declaration was removed.
However, using original patch, which removes yylloc declaration on 3.18.14 kernel version results in 'yylloc not declared' error.
See part of the original description below:

gcc 10 will default to -fno-common, which causes this error at link
time:

(.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here

This is because both dtc-lexer as well as dtc-parser define the same
global symbol yyloc. Before with -fcommon those were merged into one
defintion. The proper solution would be to to mark this as "extern",
---
scripts/dtc/dtc-lexer.l | 2 +-
scripts/dtc/dtc-lexer.lex.c_shipped | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
index 790fbf6cf2d7..e7eab4d7c5a9 100644
--- a/scripts/dtc/dtc-lexer.l
+++ b/scripts/dtc/dtc-lexer.l
@@ -38,7 +38,7 @@ LINECOMMENT "//".*\n
#include "srcpos.h"
#include "dtc-parser.tab.h"

-YYLTYPE yylloc;
+extern YYLTYPE yylloc;
extern bool treesource_error;

/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped
index ba525c2f9fc2..a2fe8dbc0fd3 100644
--- a/scripts/dtc/dtc-lexer.lex.c_shipped
+++ b/scripts/dtc/dtc-lexer.lex.c_shipped
@@ -637,7 +637,7 @@ char *yytext;
#include "srcpos.h"
#include "dtc-parser.tab.h"

-YYLTYPE yylloc;
+extern YYLTYPE yylloc;
extern bool treesource_error;

/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
--
2.42.0