Commit 5fff9e5a authored by K-laus's avatar K-laus
Browse files

odroid-n2plus: New device, initial support

* booting with near-mainline kernel works after running
/etc/postmarketos-mkinitfs/hooks/99-create_uboot_uimg.sh
to create /boot/initramfs.uimg from /boot/initramfs.
TODO: Auto-creating /boot/initramfs.uimg via hook does not work, as
https://gitlab.com/postmarketOS/pmaports/-/blob/master/main/postmarketos-mkinitfs/init.sh
is calling the hooks before /boot is mounted.

* kernel: github.com/tobetter/linux linux-5.14.3,
with hardkernel tfts disabled, as they had compile errors

* Bootlogo only 1280x720, full-hd logo not shown properly out of the box.

* Firmware for odroid-n2plus contains u-boot.bin, installed to
/boot/ and to /usr/share/u-boot/odroid_n2plus/ for sd-fusing
via deviceinfo_sd_embed_firmware
parent f58e9d91
#!/bin/sh
/usr/bin/mkimage -A arm64 -T ramdisk -C none -n uInitrd -d /boot/initramfs /boot/initramfs.uimg
# Reference: <https://postmarketos.org/devicepkg>
# Maintainer: Klaus H. <k-laus@mailbox.org>
pkgname=device-odroid-n2plus
pkgdesc="Odroid N2plus"
pkgver=0.3
pkgrel=1
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
linux-odroid-n2plus
mesa-dri-gallium
postmarketos-base
u-boot-odroid
u-boot-tools
"
makedepends="devicepkg-dev"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
#install="$pkgname.post-install"
source="deviceinfo boot.ini boot-logo.bmp.gz 00-create_uboot_uimg.sh"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
install -Dm644 "$srcdir"/boot.ini \
"$pkgdir"/boot/boot.ini
install -Dm644 "$srcdir"/boot-logo.bmp.gz \
"$pkgdir"/boot/boot-logo.bmp.gz
install -Dm744 "$srcdir"/00-create_uboot_uimg.sh \
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/00-create_uboot_uimg.sh
}
nonfree_firmware() {
pkgdesc="U-Boot required for a bootable system"
depends="firmware-odroid-n2plus"
mkdir "$subpkgdir"
}
sha512sums="
517c462365b01f243e63fe31953cf522dc4393ae861a20d0649c4eeb695bcdf559bbf65d4465ce16f62ae56d7c234b1a605ea549927d919c928e29bf0c243bba deviceinfo
e7401324ba5afe8dd9be6db9c44ec3ec84d0bcf06021f9e854a1251c07ab8f6a8e35bd1d3a51d5dfad93d7f103e76fcf3ceb20e49b7b0d4086a96cadd1b98786 boot.ini
0cba37945807efdf5cefe5b64d8e89af4a3090832f30931ccb04c9e6cd0b3ed52a68696843528c6a6c39bc0bfbd7d751c9ebe777f6bccd9014758ee21f8e1a10 boot-logo.bmp.gz
f0a230a8b6c19c543cd3767e6f8da9f1004e6262d033a5d6db601a05ead660290e24138e617fe4fa3d8a47186e992effc0ac776998565a483396a00405c977de 00-create_uboot_uimg.sh
"
ODROIDN2-UBOOT-CONFIG
# DO Not Edit this line: KERNEL: mainline
setenv board "odroidn2"
# Show logo as soon as possible
showlogo
# System Label
setenv bootlabel "postmarketOS"
# Default Console Device Setting
setenv condev "console=ttyAML0,115200n8 console=tty1"
# Boot Args
setenv bootargs "root=/dev/mmcblk${devno}p2 rootwait rw mitigations=off ${condev} ${amlogic} logo=osd0,loaded no_console_suspend fsck.repair=yes net.ifnames=0 cma=800M clk_ignore_unused video=HDMI-A-1:1920x1080@60"
# Set load addresses
setenv dtb_loadaddr "0x20000000"
setenv loadaddr "0x1080000"
setenv initrd_loadaddr "0x4080000"
# Load kernel, dtb and initrd
load mmc ${devno}:1 ${loadaddr} /vmlinuz
if test "${variant}" = "n2_plus"; then
load mmc ${devno}:1 ${dtb_loadaddr} /meson64_odroidn2_plus.dtb
else
load mmc ${devno}:1 ${dtb_loadaddr} /meson64_odroidn2.dtb
fi
load mmc ${devno}:1 ${initrd_loadaddr} /initramfs.uimg
# boot
booti ${loadaddr} ${initrd_loadaddr} ${dtb_loadaddr}
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell
# scripts.
deviceinfo_format_version="0"
deviceinfo_name="Odroid N2plus"
deviceinfo_manufacturer="Odroid"
deviceinfo_codename="odroid-n2plus"
deviceinfo_year="2020"
deviceinfo_dtb="amlogic/meson64_odroidn2_plus"
deviceinfo_append_dtb="false"
deviceinfo_modules_initfs=""
deviceinfo_arch="aarch64"
deviceinfo_disable_dhcpd="true"
# Device related
deviceinfo_chassis="embedded"
deviceinfo_gpu_accelerated="true"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1920"
deviceinfo_screen_height="1080"
# Bootloader related
deviceinfo_flash_method="none"
deviceinfo_sd_embed_firmware="u-boot/odroid-n2plus/u-boot.bin:1"
deviceinfo_sd_embed_firmware_step_size=512
deviceinfo_boot_part_start="2048"
deviceinfo_mkinitfs_postprocess="/etc/postmarketos-mkinitfs/hooks/99-create_uboot_uimg.sh"
# Maintainer: Klaus H. <k-laus@mailbox.org>
pkgname=firmware-odroid-n2plus
pkgver=1
pkgrel=1
pkgdesc="Firmware for ODROID N2plus"
url="https://github.com/hardkernel/u-boot"
arch="aarch64"
license="proprietary"
options="!check !strip !archcheck !tracedeps pmb:cross-native"
_commit="42ac93dcfbbb8a08c2bdc02e19f96eb35a81891a"
_u_boot_revision=189
source="https://github.com/hardkernel/u-boot/releases/download/travis/odroidc4-${_u_boot_revision}/u-boot-odroidn2-${_u_boot_revision}.tar.gz"
package() {
# Install firmware. need u-boot.bin in /boot for booting
# and below /usr/share/u-boot for fusing via sd_embed_firmware
install -D -m644 ${srcdir}/sd_fuse/u-boot.bin \
"$pkgdir"/boot/u-boot.bin
install -D -m644 ${srcdir}/sd_fuse/u-boot.bin \
"$pkgdir"/usr/share/u-boot/odroid-n2plus/u-boot.bin
}
sha512sums="
c0a1833cd610a86fdb16576c6cd47aaa202458f38c91c1306f07627ce5c60fe7c4e44ccc9e8f2df7c46a266304ee256bd7c304b6ba84312c6b44afc6e7b6f529 u-boot-odroidn2-189.tar.gz
"
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/odroidn2plus_archlinux_defconfig
# Maintainer: Klaus H. <k-laus@mailbox.org>
pkgname=linux-odroid-n2plus
pkgver=5.14.3
pkgrel=0
pkgdesc="ODROID N2plus kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="odroid-n2plus"
# close to mainline kernel.org linux sources:
url="https://github.com/tobetter/linux"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native pmb:kconfigcheck-nftables"
makedepends="
bash
bc
bison
devicepkg-dev
diffutils
elfutils-dev
findutils
flex
gmp-dev
installkernel
libelf
mpc1-dev
mpfr-dev
openssl-dev
perl
rsync
xz
linux-headers
"
# Source
_pkgname="linux"
_config="config-$_flavor.$arch"
_commit="54e94777e6712061846a800f07b8845f9cbd8aa5"
source="
$_pkgname-$pkgver.tar.gz::$url/archive/$_commit.tar.gz
$_config
"
subpackages="$pkgname-dev"
builddir="$srcdir/$_pkgname-$_commit"
_outdir="."
prepare() {
default_prepare
REPLACE_GCCH=0 \
. downstreamkernel_prepare
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" \
"$_flavor" "$_outdir"
make modules_install dtbs_install \
ARCH="$_carch" \
INSTALL_MOD_STRIP=1 \
INSTALL_MOD_PATH="$pkgdir" \
INSTALL_DTBS_PATH="$pkgdir/usr/share/dtb"
}
dev() {
provides="linux-headers"
replaces="linux-headers"
cd $builddir
# https://github.com/torvalds/linux/blob/master/Documentation/kbuild/headers_install.rst
make -j1 headers_install \
ARCH="$_carch" \
INSTALL_HDR_PATH="$subpkgdir"/usr
}
sha512sums="
436a4c38a2dd53fe3582449b754895e45d699da27f700edaa54b398122ba78c82e6b30cb06d53fc4b7cea98bd37afe4c0a2e634737a1e98e8b4f3a2ebda02f03 linux-5.14.3.tar.gz
1b60ef445f0765a0972b817d379c493ebd8dcf9243f12801928560a676cb1a6383c24d9f19590234d3dcb342d896fff8841397db1c1d8b0b09786024091ce28c config-odroid-n2plus.aarch64
"
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment