Bài này hướng dẫn sơ sơ cách tự renew mainline kernel để nâng cấp lên version cao hơn cho Nexus 7 2012 wifi grouper rev.E1565, hỗ trợ Waydroid và fix drm cho n7, bài mang tính chất tham khảo để ghi nhớ lại một số bước chính dựa trên hướng dẫn của trang postmarketos wiki, có thể áp dụng cho các thiết bị khác
https://wiki.postmarketos.org/wiki/Upgrade_kernel_aports
Bài đọc khá khó hiểu nhưng sẽ rõ ràng khi thao tác và hỏi đáp trên postmarketos matrix. Bắt đầu nào!!
Đầu tiên, bạn sẽ có mẫu APKBUILD trên gitlab là linux-postmarketos-grate (vì nexus 7 2012 đã sát nhập kernel vào bản kernel-5.15.0-rc4-postmarketos-grate từ đầu năm 2022) và config-postmarketos-grate.armv7
https://gitlab.com/postmarketOS/pmaports/-/blob/master/device/testing/linux-postmarketos-grate/APKBUILD
https://wiki.postmarketos.org/wiki/Upgrade_kernel_aports
Upgrade kernel aports - postmarketOS
wiki.postmarketos.org
Bài đọc khá khó hiểu nhưng sẽ rõ ràng khi thao tác và hỏi đáp trên postmarketos matrix. Bắt đầu nào!!
Đầu tiên, bạn sẽ có mẫu APKBUILD trên gitlab là linux-postmarketos-grate (vì nexus 7 2012 đã sát nhập kernel vào bản kernel-5.15.0-rc4-postmarketos-grate từ đầu năm 2022) và config-postmarketos-grate.armv7
https://gitlab.com/postmarketOS/pmaports/-/blob/master/device/testing/linux-postmarketos-grate/APKBUILD

device/testing/linux-postmarketos-grate/APKBUILD · master · postmarketOS / pmaports · GitLab
postmarketOS package build recipes
gitlab.com

Thay đổi 2 dòng pkgver=5.17.0 và pkgrel=1
dòng _commit="999564eab65e01ef0099b6e533b2c388b1f02439" phải lên github của grate-driver/linux tìm commit mới nhất trên master branch, mà đã thông qua tốt, điền vào. Đừng chọn dòng có đấu X đỏ
kernel-5.19.0-rc8 và pkgrel=0:
_commit="1adff051e7931baf427b7342acab81bc9aec7959"



Mở terminal cài pmbootstrap như hướng dẫn
Quảng cáo
https://wiki.postmarketos.org/wiki/Installing_pmbootstrap
pmbootstrap - postmarketOS
wiki.postmarketos.org
Đầu tiên chạy pmbootstrap init để lấy mẫu APKBUILD và config-postmarketos-grate.armv7 về máy local
$ pmbootstrap init
Channel []: edge
Vendor []: asus
Device codename []: grouper
Quảng cáo
Kernel []: e1565-mainline
Enable this package? (y/n) [y]: y
Username []: user
User interface []: xfce4 ← hoặc phosh thì đổi ở đây
Extra packages []: nano,thunar,xvkbd,matchbox-keyboard,iwd
Choose default locale installation [en_US.UTF-8]: en_US.UTF-8
Device hostname (short form, e.g ‘foo’) []: asus-grouper-xfce4
Build outdate packages during ‘pmbootstrap install’? (y/n) [y]: y
$ pmbootstrap status
Ở user, git clone linux kernel về:
$ git clone https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git linux
$ cd linux
$ git remote add grate-driver https://github.com/grate-driver/linux.git
Tải về patch mới:
$ git fetch grate-driver
Dùng git tag để tìm tag mới nhất, nếu trong tag có nhiều commit thì tìm commit cuối có thể hoạt động để build kernel
$ git tag | grep grate-grate_defconfig-default-gcc
$ git log grate-grate_defconfig-default-gcc
Điền commit vào APKBUILD, đổi pkgver=5.17.0, pkgrel=1
Kiểm tra phiên bản mới của các commit trong git log để tìm ra commit mới nhất có thể build kernel
$ git checkout -b postmarketos-upgrade
kernel-5.17.0
$ git reset --hard 999564eab65e01ef0099b6e533b2c388b1f02439
Điền commit vào APKBUILD, đổi pkgver=5.19.0_rc8, pkgrel=0
kernel-5.19.0-rc8
$ git reset --hard 1adff051e7931baf427b7342acab81bc9aec7959
Updating files: 100% (2009/2009), done.
HEAD is now at 1adff051e793 Revert "pwm: tegra: Optimize period calculation"
Thêm một số bản vá nếu có của mainline kernel
$ git am $(pmbootstrap -q config work)/cache_git/pmaports/device/testing/linux-postmarketos-grate/*.patch
fatal: could not open '/home/<username>/.local/var/pmbootstrap/cache_git/pmaports/device/main/linux-postmarketos-grate/*.patch' for reading: No such file or directory
$ pmbootstrap kconfig check linux-postmarketos-grate
Chạy pmbootstrap checksum để tạo mới APKBUILD
$ pmbootstrap checksum linux-postmarketos-grate
Update package index for x86_64 (4 file(s))
Download http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/apk-tools-static-2.12.9-r3.apk
(native) install alpine-base
(native) install abuild build-base ccache git [15:10:37] (native) generate abuild keys
(native) generate checksums for linux-postmarketos-grate
NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary)
DONE!
Thế là đã tạo mẫu APKBUILD mới trên local để build mainline kernel, new version
File config-postmarketos-grate.armv7 lấy config trong release của https://github.com/grate-driver/linux/releases
Releases · grate-driver/linux
Linux kernel with experimental patches for Tegra. Contribute to grate-driver/linux development by creating an account on GitHub.
github.com
Hoặc lấy APKBUILD và config-postmarketos-grate.armv7 trên repo gitlab của Svyatoslav Ryhel( aka Clamor-S)
APKBUILD: https://gitlab.com/postmarketOS/pmaports/-/blob/02855386c28d4ebe17d6589bc0e36f32d87ada1b/device/testing/linux-postmarketos-grate/APKBUILD

device/testing/linux-postmarketos-grate/APKBUILD · 02855386c28d4ebe17d6589bc0e36f32d87ada1b · postmarketOS / pmaports · GitLab
postmarketOS package build recipes
gitlab.com
config-postmarketos-grate.armv7: https://gitlab.com/postmarketOS/pmaports/-/blob/eed9f8e79091043b995c9ec7ef220585453c8a2a/device/testing/linux-postmarketos-grate/config-postmarketos-grate.armv7

device/testing/linux-postmarketos-grate/config-postmarketos-grate.armv7 · eed9f8e79091043b995c9ec7ef220585453c8a2a · postmarketOS / pmaports · GitLab
postmarketOS package build recipes
gitlab.com

Chọn bản build cho GCC (default), bản CLANG phải cài thêm: autoconf, automake, bash, clang, clang-dev, dpkg, gcc, git, lld, make, musl-dev
$ pmbootstrap chroot
~/# apk add abuild build-base ccache git devicepkg-dev mkbootimg postmarketos-base ccache-cross-symlinks gcc-aarch64 g++-aarch64 crossdirect ncurses-dev bash bc bison elfutils-dev flex gmp-dev installkernel linux-headers openssl-dev perl sed binutils-aarch64 gcc-armv7 g++-armv7 binutils-armv7
$ pmbootstrap --details-to-stdout build linux-postmarketos-grate --force
$ pmbootstrap --details-to-stdout install
Các bước cài đặt vào máy sẽ theo hướng dẫn bài này:
https://tinhte.vn/thread/postmarketos-nexus-7-2012-wifi-3g-rev-e1565-kernel-5-15-0-rc4-next-20121011-postmarketos-grate.3179205/

PostmarketOS Nexus 7 2012 wifi 3G rev.E1565 kernel-6.3.0-rc1-postmarketos-grate | Viết bởi LuxiTD
Không biết tại sao bài bị xoá, đăng lại link pdf cho ai cần
http://www.mediafire.com/file/r37ylhmk7wsb0a4
Link gốc bài bị xoá không rõ nguyên nhân:
https://tinhte.vn/threads/cai-postmarketos-len-nexus-7-2012-16gb.
tinhte.vn
pmbootstrap log:
https://pastebin.ubuntu.com/p/xjDsVtbFc6
Ubuntu Pastebin
pastebin.ubuntu.com
APKBUILD:
https://pastebin.ubuntu.com/p/HFSD33h5y3/
Ubuntu Pastebin
pastebin.ubuntu.com
config-postmarketos-grate.armv7
https://pastebin.ubuntu.com/p/pbzGFg5jsw/
Ubuntu Pastebin
pastebin.ubuntu.com
Link image trên Google drive: https://drive.google.com/drive/u/0/folders/1B27V9Od0g4pvKfWRIhK_CnJFXG8VCcXK
pmOS-asus-grouper - Google Drive
drive.google.com
Default user: user
Default passwd: 147147