Compare commits

..

7 commits

Author SHA1 Message Date
Lux Aliaga 0da8141e89 linux: Change commit to master branch
I'm planning to organize the sm6125-mainline project with the following
branch scheme:

- master: Stable release, commits here will be sent to LKML
- upstream: For pulling changes from torvalds/linux, testing and fixing
  prior to merging into master
- Any other branches will be used to implement new features to master

This commit switches the previously used commit in favor of the master branch.
2022-05-01 11:33:19 -04:00
Lux Aliaga 4037f3d328 linux: Updated commit hash
After merging the changes from torvalds/linux, the latest commit changed its hash. This commit updates it to the one that's currently in use. (Maybe in the future we could make it so the master branch implements the latest changes and work on merging this stuff on a develop branch?)
2022-05-01 01:16:26 -04:00
Lux Aliaga f508ae13f1 readme: New kernel version! 2022-05-01 01:15:03 -04:00
Lux Aliaga dd8dfccb1f device: Rename from laurel_sprout to laurel
pmbootstrap doesn't consider underscores as part of codenames, so we'll
rename the device package to "laurel" instead of "laurel_sprout". Kernel
DTBs will keep the actual device name, since (at least from my
knowledge) it's accepted.
2022-05-01 01:12:21 -04:00
Lux Aliaga a22ac23ba6 fixup! linux: Rename to SoC-specific package 2022-05-01 01:10:35 -04:00
Lux Aliaga cdf247ae13 linux: Rename to SoC-specific package
Since one of the goals of the postmarketOS project is to eventually use generic
kernels for most devices, renaming the linux package to use the name for
the SoC instead of the device name makes more sense in the long run and
for other people porting postmarketOS to other devices.
2022-05-01 01:06:21 -04:00
Lux Aliaga 02aa5c8405 mainline! 2022-03-18 18:51:23 -03:00
13 changed files with 9609 additions and 6150 deletions

View file

@ -1,7 +1,7 @@
# pmOS for laurel_sprout (WIP)
# pmOS for laurel_sprout
![Mi A3 on Fastboot](device.png)
![Mi A3 booting postmarketOS](device.jpg)
Packages for Xiaomi Mi A3 (laurel_sprout). **NOT BOOTING** as of now, so if anyone wants to contribute you're free to commit potential fixes.
Device packages for Xiaomi Mi A3 (laurel_sprout). Booting on kernel 5.18.0-rc4!
[pmOS wiki page](https://wiki.postmarketos.org/wiki/Xiaomi_Mi_A3_\(xiaomi-laurel_sprout\))

View file

@ -1,14 +1,14 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-xiaomi-laurel_sprout
pkgname=device-xiaomi-laurel
pkgdesc="Xiaomi Mi A3"
pkgver=0.1
pkgrel=0
pkgrel=3
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
linux-xiaomi-laurel_sprout
linux-postmarketos-qcom-sm6125
mesa-dri-gallium
mkbootimg
postmarketos-base
@ -25,5 +25,5 @@ package() {
}
sha512sums="
b665ab8d583a4d261b9aed7c9442db519827fe32a66346b770bd12e958ac5e72531e0117dc4f3af99296c097c5e80d5a5e6b71b5c6e91b4576f95feebf48b78b deviceinfo
1f0183d38e8f169319b6bdd49948a8368227d7e6d7c68df6c288ca241b70c73cd4efd16f4b518a8288ef3e3a6874b8ffd4ce1a4527ed7a531f26d7a59fe4e4c1 deviceinfo
"

View file

@ -7,7 +7,7 @@ deviceinfo_name="Xiaomi Mi A3"
deviceinfo_manufacturer="Xiaomi"
deviceinfo_codename="xiaomi-laurel_sprout"
deviceinfo_year="2019"
deviceinfo_dtb=""
deviceinfo_dtb="qcom/sm6125-xiaomi-laurel_sprout"
deviceinfo_modules_initfs=""
deviceinfo_arch="aarch64"
@ -15,25 +15,21 @@ deviceinfo_arch="aarch64"
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1560"
deviceinfo_screen_height="720"
deviceinfo_no_framebuffer="true"
deviceinfo_getty="ttyMSM0;115200"
deviceinfo_screen_width="720"
deviceinfo_screen_height="1560"
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_flash_fastboot_partition_vbmeta="vbmeta"
deviceinfo_flash_fastboot_partition_dtbo="dtbo"
deviceinfo_flash_sparse="true"
deviceinfo_kernel_cmdline="console=ttyMSM0,115200,n8 androidboot.hardware=qcom androidboot.console=ttyMSM0 user_debug=31 androidboot.memcg=1 lpm_levels.sleep_disabled=1 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 service_locator.enable=1 swiotlb=1 earlycon=msm_geni_serial,0x4a90000 loop.max_part=7 cgroup.memory=nokmem,nosocket androidboot.selinux=permissive buildvariant=eng"
deviceinfo_kernel_cmdline="clk_ignore_unused"
deviceinfo_generate_bootimg="true"
deviceinfo_flash_fastboot_partition_vbmeta="vbmeta"
deviceinfo_bootimg_qcdt="false"
deviceinfo_bootimg_mtk_mkimage="false"
deviceinfo_bootimg_dtb_second="false"
deviceinfo_append_dtb="true"
deviceinfo_flash_pagesize="4096"
deviceinfo_flash_offset_base="0x00000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_rootfs_image_sector_size="4096"

BIN
device.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

View file

@ -0,0 +1,68 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/(CHANGEME!)
pkgname=linux-postmarketos-qcom-sm6125
pkgver=5.18.0
pkgrel=0
pkgdesc="Mainline Kernel fork for SM6125 devices"
arch="aarch64"
_carch="arm64"
_flavor="postmarketos-qcom-sm6125"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="
bash
bc
bison
devicepkg-dev
flex
openssl-dev
perl
"
# Source
_repository="linux"
_commit="master"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://gitlab.com/sm6125-mainline/$_repository/-/archive/$_commit.tar.gz
$_config
"
builddir="$srcdir/$_repository-$_commit"
prepare() {
default_prepare
cp "$srcdir/config-$_flavor.$arch" .config
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-$_flavor"
}
package() {
mkdir -p "$pkgdir"/boot
install -Dm644 "$builddir/arch/$_carch/boot/Image.gz" \
"$pkgdir/boot/vmlinuz"
make modules_install dtbs_install \
ARCH="$_carch" \
INSTALL_PATH="$pkgdir"/boot/ \
INSTALL_MOD_PATH="$pkgdir" \
INSTALL_MOD_STRIP=1 \
INSTALL_DTBS_PATH="$pkgdir"/usr/share/dtb
rm -f "$pkgdir"/lib/modules/*/build "$pkgdir"/lib/modules/*/source
install -D "$builddir"/include/config/kernel.release \
"$pkgdir"/usr/share/kernel/$_flavor/kernel.release
}
sha512sums="
a7f3278990e837143337e37f9d2fac1bb0fd6b859681de0e8226fae2addae2cfaa2d44d6bddf43004a887e189d22223a4debd2891cbf580d61b6b8fa184c5c2a linux-xiaomi-laurel_sprout-3398a1d7daeca76a3adef6e64e8f0f516f95195e.tar.gz
695be42583078511a180cc2bc36f70a038ff1a3c5e81e084c70ee9341936159ee695884d3e43e5afd6be717ab35e3445ac577c04f4847670040d0c6ab28651fa config-xiaomi-laurel_sprout.aarch64
"

File diff suppressed because it is too large Load diff

View file

@ -1,24 +0,0 @@
From 4995be221047acf5b40610e5c4eacf4b75434500 Mon Sep 17 00:00:00 2001
From: NeKit <nekit1000@gmail.com>
Date: Mon, 18 Mar 2019 22:02:40 +0100
Subject: [PATCH] (hybris) always boot to initramfs
---
init/initramfs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/init/initramfs.c b/init/initramfs.c
index 52059169..54768fd3 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -612,7 +612,9 @@ static int __init skip_initramfs_param(char *str)
{
if (*str)
return 0;
- do_skip_initramfs = 1;
+ // Halium: always boot to initramfs
+ //do_skip_initramfs = 1;
+ do_skip_initramfs = 0;
return 1;
}
__setup("skip_initramfs", skip_initramfs_param);

View file

@ -1,18 +0,0 @@
diff --git a/init/initramfs.c b/init/initramfs.c
index bf3af10c500a..1c74b6d70e5e 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -622,11 +622,11 @@ static int __init populate_rootfs(void)
{
char *err;
- if (do_skip_initramfs) {
+ /*if (do_skip_initramfs) {
if (initrd_start)
free_initrd();
return default_rootfs();
- }
+ }*/
err = unpack_to_rootfs(__initramfs_start, __initramfs_size);
if (err)

View file

@ -1,80 +0,0 @@
From 92e3310d2db157deacb86ef5db8c8c8d38251312 Mon Sep 17 00:00:00 2001
From: Alexey Min <alexey.min@gmail.com>
Date: Wed, 11 Sep 2019 21:51:40 +0300
Subject: [PATCH 3/6] Add config option to fix bootloader cmdline args
Android bootloader passes some arguments in kernel command
line, that make booting custom OSes harder:
* skip_initramfs
* root=PARTUUID=...
* init=/init
Those parameters override default boot partition to hardcoded,
set init binary to /init, disable booting from initramfs.
If enabled, those parameters will be erased from bootloader's
command line, and custom OS can boot the way it likes.
Signed-off-by: Alexey Min <alexey.min@gmail.com>
---
arch/arm64/Kconfig | 17 +++++++++++++++++
drivers/of/fdt.c | 14 ++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 2829edba6aa5..bd9f05f83c7e 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1125,6 +1125,23 @@ config CMDLINE_FORCE
command-line options your boot loader passes to the kernel.
endchoice
+config CMDLINE_DROP_DANGEROUS_ANDROID_OPTIONS
+ bool "Drop certain dangerous options from cmdline"
+ default n
+ help
+ Android bootloader passes some arguments in kernel command
+ line, that make booting custom OSes harder:
+
+ * skip_initramfs
+ * root=PARTUUID=...
+ * init=/init
+
+ Those parameters override default boot partition to hardcoded,
+ set init binary to /init, disable booting from initramfs.
+
+ If enabled, those parameters will be erased from bootloader's
+ command line, and custom OS can boot the way it likes.
+
config EFI_STUB
bool
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index ca175710c4c8..fd8257589648 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1012,6 +1012,20 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
pr_debug("Command line is: %s\n", (char*)data);
+#ifdef CONFIG_CMDLINE_DROP_DANGEROUS_ANDROID_OPTIONS
+ pr_err("Replacing dangerous cmdline options...");
+ cmdline = strstr((const char *)data, "skip_initramfs");
+ if (cmdline)
+ *cmdline = '_';
+ cmdline = strstr((const char *)data, "root=");
+ if (cmdline)
+ *cmdline = '_';
+ cmdline = strstr((const char *)data, "init=");
+ if (cmdline)
+ *cmdline = '_';
+ pr_err("Command line now is: %s\n", (char*)data);
+#endif
+
/* break now */
return 1;
}
--
2.24.1

View file

@ -1,33 +0,0 @@
Arm64 has generated headers that other arches don't, didn't investigate why this
is able to compile in downstream (our upstream). Possibly due to out-of-tree build.
Note the hacky relative include. May not work in more complicated setups.
diff --git a/scripts/selinux/genheaders/Makefile b/scripts/selinux/genheaders/Makefile
index e8c533140..62475f060 100644
--- a/scripts/selinux/genheaders/Makefile
+++ b/scripts/selinux/genheaders/Makefile
@@ -2,6 +2,8 @@
hostprogs-y := genheaders
HOST_EXTRACFLAGS += \
-I$(srctree)/include/uapi -I$(srctree)/include \
- -I$(srctree)/security/selinux/include
+ -I$(srctree)/security/selinux/include \
+ -I./arch/$(ARCH)/include/generated/uapi \
+ -I$(srctree)/arch/$(ARCH)/include/uapi
always := $(hostprogs-y)
diff --git a/scripts/selinux/mdp/Makefile b/scripts/selinux/mdp/Makefile
index e9c92db7e..09e626fa4 100644
--- a/scripts/selinux/mdp/Makefile
+++ b/scripts/selinux/mdp/Makefile
@@ -2,7 +2,9 @@
hostprogs-y := mdp
HOST_EXTRACFLAGS += \
-I$(srctree)/include/uapi -I$(srctree)/include \
- -I$(srctree)/security/selinux/include
+ -I$(srctree)/security/selinux/include \
+ -I./arch/$(ARCH)/include/generated/uapi \
+ -I$(srctree)/arch/$(ARCH)/include/uapi
always := $(hostprogs-y)
clean-files := policy.* file_contexts

View file

@ -1,76 +0,0 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/(CHANGEME!)
pkgname=linux-xiaomi-laurel_sprout
pkgver=4.14.184
pkgrel=0
pkgdesc="Xiaomi Mi A3 kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="xiaomi-laurel_sprout"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="
android-mkdtimg
bash
bc
bison
clang
devicepkg-dev
dtc
flex
openssl-dev
linux-headers
perl
"
# Source
_repository="android_kernel_xiaomi_laurel_sprout"
_commit="18cce7c37b08cf3b8cb013ac648f03a7361ac215"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/AOSPA/$_repository/archive/$_commit.tar.gz
$_config
0001-always_boot_to_initramfs.patch
0002-disable_skip_initramfs.patch
0003-remove_bootloader_cmdline_opts.patch
0004-selinux_include_generated_headers.patch
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"
prepare() {
default_prepare
REPLACE_GCCH=0
. downstreamkernel_prepare
}
build() {
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CC="clang" HOSTCC="clang" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir"
dtbodir="$builddir/$_outdir/arch/arm64/boot/dts/qcom"
mkdtimg create "$pkgdir/boot/dtbo.img" --page_size=4096 \
"$dtbodir/laurel_sprout-qrd-overlay.dtbo"
# Modules
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CC="clang" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" \
INSTALL_MOD_PATH="$pkgdir" modules_install
}
sha512sums="
2cebedae30ffc2ff16b5f8d6b93f7edeb7d28e88cbecdf7835dcdd3ceaabc61a3b5aee3085fea385e4644aaadd371e0109356eb0a21135d97fcfe6bf6a4c8b04 linux-xiaomi-laurel_sprout-18cce7c37b08cf3b8cb013ac648f03a7361ac215.tar.gz
99e17b15f9682a0a5ac2c52bfddf236a8c5db041c58308d95542e96e631840776bb2fd2b91f51cc2cf7e638461a68553fea3e6bc4a538bda86ccb2de030ede1f config-xiaomi-laurel_sprout.aarch64
e2a7a404a7bd404dbda08663ca5f96c38e04e58bd781024c6904115a4775e089775a552583347ab8e2f745d5ab5653a63c08070b3b43b8b4a2f23696e747311e 0001-always_boot_to_initramfs.patch
65048fb6474fd543b14bc99d9d95cfe5297da239af211d327a8509f7777d489bd01dd911364e0c62ec0e68f4c22ebb3b145eabfe01cad2abf57cf46896a1e58f 0002-disable_skip_initramfs.patch
9ce867c4254b537ef5d2485780c26b72da8a3a8767ba71557f3b48d6c550e0e14c8c3e575b31bf65d2878f08a8a4926e48a1c2f1be534bf80a7a57f58313b0fd 0003-remove_bootloader_cmdline_opts.patch
6ab9db01d35f7f5cc2c19ebe5f65a7dc479a1c68de587300cdde9a6c759d34610666c72f0f321cd450cf56c13df3b54a774e0f7ebdbf0f8608fbfd66b49d04e7 0004-selinux_include_generated_headers.patch
"

File diff suppressed because it is too large Load diff