odroid-hc2: new device (MR 2249)

[ci:skip-build]: already built successfully in CI
This commit is contained in:
Dylan Van Assche 2021-06-13 11:56:45 +02:00 committed by Oliver Smith
parent e67fca2b12
commit bdf5c5116d
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
7 changed files with 7522 additions and 0 deletions

View file

@ -0,0 +1,50 @@
# Reference: <https://postmarketos.org/devicepkg>
# Maintainer: Dylan Van Assche <me@dylanvanassche.be>
pkgname=device-odroid-hc2
pkgdesc="ODROID HC2"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="postmarketos-base linux-odroid-hc2 u-boot-odroid u-boot-tools"
makedepends="devicepkg-dev"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
_commit="42ac93dcfbbb8a08c2bdc02e19f96eb35a81891a"
source="deviceinfo uboot-script.cmd network-interfaces"
build() {
devicepkg_build $startdir $pkgname
mkimage \
-A arm \
-O linux \
-T script \
-C none \
-a 0 \
-e 0 \
-n postmarketos \
-d "$srcdir"/uboot-script.cmd \
"$srcdir"/boot.scr
}
package() {
devicepkg_package $startdir $pkgname
install -Dm644 "$srcdir"/boot.scr \
"$pkgdir"/boot/boot.scr
install -Dm644 "$srcdir"/network-interfaces \
"$pkgdir"/etc/network/interfaces
}
nonfree_firmware() {
pkgdesc="U-Boot and Realtek firmware, required for a bootable system"
depends="firmware-odroid-hc2 linux-firmware-rtl_nic"
mkdir "$subpkgdir"
}
sha512sums="
1d300d7b11661da782ef7a4be0f47ec465a80e1ce3df07c5f7d07c9c5b7e656bb88c14ee179e98d91dbc18f5ba1002c334d9c5eaf48194d04e497b752a87552f deviceinfo
83a4bcc34d20c2e5e6f1c3412c291baa90a8137df7925c02d8e46d922d45615cc957d79d37a23982bed7e1cfa92f2be22fa5f11cc59d3706b79ba62a2d550263 uboot-script.cmd
d510ca304066840aa5e6c4fc71ded1b7e83012c93837fa39e37bdb873b3636230030d56f7aa50c93fc688f563cb4cb96c02ad333bbc45a400c1ebee1792a9dd4 network-interfaces
"

View file

@ -0,0 +1,27 @@
# 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 HC2"
deviceinfo_manufacturer="Odroid"
deviceinfo_codename="odroid-hc2"
deviceinfo_year="2018"
deviceinfo_dtb="exynos5422-odroidhc1"
deviceinfo_append_dtb="false"
deviceinfo_arch="armv7"
deviceinfo_no_framebuffer="true"
deviceinfo_generate_legacy_uboot_initfs="true"
deviceinfo_getty="ttySAC2;115200"
deviceinfo_disable_dhcpd="true"
# Device related
deviceinfo_chassis="embedded"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
# Bootloader related
deviceinfo_flash_method="none"
deviceinfo_sd_embed_firmware="u-boot/odroid-hc2/bl1.bin:1,u-boot/odroid-hc2/bl2.bin:31,u-boot/odroid-xu3/u-boot.bin:63,u-boot/odroid-hc2/tzsw.bin:1503"
deviceinfo_sd_embed_firmware_step_size=512
deviceinfo_boot_part_start=8192

View file

@ -0,0 +1,5 @@
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp

View file

@ -0,0 +1,26 @@
setenv kernel_addr_r "0x40008000"
setenv initrd_addr_r "0x42000000"
setenv fdt_addr_r "0x44000000"
setenv kernel_image "vmlinuz-odroid-hc2"
setenv initrd_image "uInitrd-odroid-hc2"
setenv dtb_file "exynos5422-odroidhc1.dtb"
printenv
echo Setting bootargs
setenv bootargs init=/init.sh rw console=tty0 console=ttySAC2,115200 panic=10 consoleblank=0 loglevel=9 cma=256M PMOS_NO_OUTPUT_REDIRECT PMOS_FORCE_PARTITION_RESIZE pmos_boot=/dev/mmcblk0p1 pmos_root=/dev/mmcblk0p2
echo Loading Kernel
load mmc ${mmcbootdev}:${mmcbootpart} ${kernel_addr_r} ${kernel_image}
echo Loading Initramfs
load mmc ${mmcbootdev}:${mmcbootpart} ${initrd_addr_r} ${initrd_image}
echo Loading DTB
load mmc ${mmcbootdev}:${mmcbootpart} ${fdt_addr_r} ${dtb_file}
echo Resizing FDT
fdt addr ${fdt_addr_r}
echo Booting kernel
bootz ${kernel_addr_r} ${initrd_addr_r} ${fdt_addr_r}

View file

@ -0,0 +1,34 @@
# Maintainer: Dylan Van Assche <me@dylanvanassche.be>
pkgname=firmware-odroid-hc2
pkgver=1
pkgrel=0
pkgdesc="Firmware for ODROID HC2"
url="https://github.com/hardkernel/u-boot"
arch="armv7"
license="proprietary"
options="!check !strip !archcheck"
_commit="42ac93dcfbbb8a08c2bdc02e19f96eb35a81891a"
source="bl1.bin.hardkernel::https://github.com/hardkernel/u-boot/raw/$_commit/sd_fuse/bl1.bin.hardkernel
bl2.bin.hardkernel::https://github.com/hardkernel/u-boot/raw/$_commit/sd_fuse/bl2.bin.hardkernel.720k_uboot
tzsw.bin.hardkernel::https://github.com/hardkernel/u-boot/raw/$_commit/sd_fuse/tzsw.bin.hardkernel
"
package() {
# Trim bl1.bin.hardkernel to 15360 bytes
# See https://forum.odroid.com/viewtopic.php?f=93&t=42724
truncate -s15360 "$srcdir"/bl1.bin.hardkernel
# Install firmware
install -D -m644 "$srcdir"/bl1.bin.hardkernel \
"$pkgdir"/usr/share/u-boot/odroid-hc2/bl1.bin
install -D -m644 "$srcdir"/bl2.bin.hardkernel \
"$pkgdir"/usr/share/u-boot/odroid-hc2/bl2.bin
install -D -m644 "$srcdir"/tzsw.bin.hardkernel \
"$pkgdir"/usr/share/u-boot/odroid-hc2/tzsw.bin
}
sha512sums="
db2d53673a36c8c186804996354ca3dea8621444596751a1cf51140149a9cce2cdb368417290046393828e943af256bb609a65d30569c95c51105ee82e6cac20 bl1.bin.hardkernel
0c6fb8b0cccfafe7d0d5ace2a18eaaa8f70ca4d87d7899ddb310462d2daf50dc0c9fca55392a46817153f797eef0262b1ffb6eb2ddbae8ba9dd3d20ff7b241f4 bl2.bin.hardkernel
434f6b479ead6b5d25877bb615df4281f95d1637d4171354f4bf324f8a1d7df3855e0a696aa204285c3298b45bf7d1e0ad4c27a88bc705f4cff1f082754f444f tzsw.bin.hardkernel
"

View file

@ -0,0 +1,78 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm/configs/odroidxu4_defconfig
# Maintainer: Dylan Van Assche <me@dylanvanassche.be>
pkgname=linux-odroid-hc2
pkgver=5.12.9
pkgrel=0
pkgdesc="ODROID XU3/XU4/HC1/HC2/MC1 kernel fork"
arch="armv7"
_carch="arm"
_flavor="odroid-hc2"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native pmb:kconfigcheck-nftables"
makedepends="
bison
devicepkg-dev
findutils
flex
gmp-dev
installkernel
mpc1-dev
mpfr-dev
openssl-dev
perl
rsync
xz
linux-headers
"
# Source
_config="config-$_flavor.$arch"
_pkgname="linux"
_commit="4f75c10941ab9e2856598f82bbd417545bd41681"
source="
$_pkgname-$pkgver.tar.gz::https://github.com/tobetter/linux/archive/$_commit.tar.gz
$_config
"
subpackages="$pkgname-dev"
builddir="$srcdir/$_pkgname-$_commit"
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="
f19a86a4b33e744f8ee397781558c71040faa747f499b1069faa124d2e316aaae4a849ce1b35b8ae72bc80d06cff4185a9e6ac9d767024b11f0c72808ffe706b linux-5.12.9.tar.gz
58d3c60b1fbfefa94dabe14182b3401d08666a6bedefa0abe26afdf09f3871381d9b68ab18a7cbcec7328f939be0dfd0b424ed09bbf12aef62f0095917dd970d config-odroid-hc2.armv7
"

File diff suppressed because it is too large Load diff