diff --git a/alarm/uboot-odroid-n2/0001-sd_fusing-tweaks.patch b/alarm/uboot-odroid-n2/0001-sd_fusing-tweaks.patch new file mode 100644 index 000000000..0cc7b2860 --- /dev/null +++ b/alarm/uboot-odroid-n2/0001-sd_fusing-tweaks.patch @@ -0,0 +1,32 @@ +From 769091d09aa4a83ff91d2db2f7a1311f8b97c737 Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Thu, 7 Mar 2019 19:27:59 -0700 +Subject: [PATCH 1/2] sd_fusing tweaks + +--- + sd_fuse/sd_fusing.sh | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/sd_fuse/sd_fusing.sh b/sd_fuse/sd_fusing.sh +index 451013f119..538fdfa3b5 100755 +--- a/sd_fuse/sd_fusing.sh ++++ b/sd_fuse/sd_fusing.sh +@@ -12,12 +12,11 @@ abort() { + } + + [ -z $1 ] && abort "usage: $0 " +-[ -z ${UBOOT} ] && UBOOT=${PWD}/u-boot.bin +-[ ! -f ${UBOOT} ] && abort "error: ${UBOOT} is not exist" ++[ -z ${UBOOT} ] && UBOOT=/boot/u-boot.bin ++[ ! -f ${UBOOT} ] && abort "Error: ${UBOOT} doesn't exist" + +-sudo dd if=$UBOOT of=$1 conv=fsync,notrunc bs=512 seek=1 ++dd if=$UBOOT of=$1 conv=fsync,notrunc bs=512 seek=1 + + sync + +-sudo eject $1 + echo Finished. +-- +2.20.1 + diff --git a/alarm/uboot-odroid-n2/0002-arch-linux-arm-modifications.patch b/alarm/uboot-odroid-n2/0002-arch-linux-arm-modifications.patch new file mode 100644 index 000000000..0b4c7b86f --- /dev/null +++ b/alarm/uboot-odroid-n2/0002-arch-linux-arm-modifications.patch @@ -0,0 +1,28 @@ +From d072eef919589311595f482131e4fffef76b47a3 Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Thu, 7 Mar 2019 19:31:55 -0700 +Subject: [PATCH 2/2] arch linux arm modifications + +--- + include/configs/odroid-g12-common.h | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/include/configs/odroid-g12-common.h b/include/configs/odroid-g12-common.h +index ca674a8f73..f732895071 100644 +--- a/include/configs/odroid-g12-common.h ++++ b/include/configs/odroid-g12-common.h +@@ -459,6 +459,11 @@ + #define CONFIG_CMD_BDI 1 + #define CONFIG_CMD_FS_GENERIC 1 + ++/* Arch Linux ARM */ ++#define CONFIG_IDENT_STRING " Arch Linux ARM" ++#define CONFIG_CMD_PART ++#define CONFIG_PARTITION_UUIDS ++ + /*file system*/ + #define CONFIG_DOS_PARTITION 1 + #define CONFIG_EFI_PARTITION 1 +-- +2.20.1 + diff --git a/alarm/uboot-odroid-n2/91-uboot-uimg.hook b/alarm/uboot-odroid-n2/91-uboot-uimg.hook new file mode 100644 index 000000000..33530a925 --- /dev/null +++ b/alarm/uboot-odroid-n2/91-uboot-uimg.hook @@ -0,0 +1,11 @@ +[Trigger] +Type = File +Operation = Install +Operation = Upgrade +Target = boot/Image +Target = usr/lib/initcpio/* + +[Action] +Description = Updating uimg initcpios... +When = PostTransaction +Exec = /usr/bin/mkimage -n "Ramdisk Image" -A arm64 -O linux -T ramdisk -C none -d /boot/initramfs-linux.img /boot/initramfs-linux.uimg diff --git a/alarm/uboot-odroid-n2/PKGBUILD b/alarm/uboot-odroid-n2/PKGBUILD new file mode 100644 index 000000000..df0e5061d --- /dev/null +++ b/alarm/uboot-odroid-n2/PKGBUILD @@ -0,0 +1,56 @@ +# U-Boot: ODROID-N2 +# Maintainer: Kevin Mihelich + +# Note: must be built on x86 with an old cross toolchain + +buildarch=8 +noautobuild=1 + +pkgname=uboot-odroid-n2 +pkgver=2015.01 +pkgrel=1 +pkgdesc="U-Boot for ODROID-N2" +arch=('aarch64') +url="https://github.com/hardkernel/u-boot" +license=('GPL') +install=$pkgname.install +depends=('uboot-tools') +makedepends=('git' 'bc') +backup=('boot/boot.ini') +_commit=f93bc0cdd0ec017e5b735e3ea0485ffc41ffc230 +source=("https://github.com/hardkernel/u-boot/archive/${_commit}.tar.gz" + 'boot.ini' + '0001-sd_fusing-tweaks.patch' + '0002-arch-linux-arm-modifications.patch' + '91-uboot-uimg.hook') +md5sums=('5ba5b6771fa9ecab620ce50ae07c33ef' + '8e6c650d29974f5a2d19eb672d0dfdbd' + 'cc18cda0bc75936e602341efd5a2fe93' + '4d14405ba98f09c002505cbe53e2f6cb' + '1931c8dfde7088530f173ca59fdb8989') + +prepare() { + cd u-boot-${_commit} + + git apply ../0001-sd_fusing-tweaks.patch + git apply ../0002-arch-linux-arm-modifications.patch +} + +build() { + cd u-boot-${_commit} + + unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS + + make distclean mrproper + make odroidn2_config + make -j1 EXTRAVERSION=-${pkgrel} +} + +package() { + cd u-boot-${_commit}/sd_fuse + + mkdir -p "${pkgdir}"/boot + cp sd_fusing.sh u-boot.bin "${pkgdir}"/boot + cp "${srcdir}"/boot.ini "${pkgdir}"/boot + install -Dm644 "${srcdir}/91-uboot-uimg.hook" "${pkgdir}/usr/share/libalpm/hooks/91-uboot-uimg.hook" +} diff --git a/alarm/uboot-odroid-n2/boot.ini b/alarm/uboot-odroid-n2/boot.ini new file mode 100644 index 000000000..3307d3540 --- /dev/null +++ b/alarm/uboot-odroid-n2/boot.ini @@ -0,0 +1,104 @@ +ODROIDN2-UBOOT-CONFIG + +# Default Console Device Setting +setenv condev "console=ttyS0,115200n8" # on both + +# Auto Detection of Monitor settings based on your Screen information +setenv display_autodetect "true" + +# HDMI Mode +# Resolution Configuration +# Symbol | Resolution +# ----------------------+------------- +# "480x320p60hz" | 480x320 Progressive 60Hz +# "480p60hz" | 720x480 Progressive 60Hz +# "576p50hz" | 720x576 Progressive 50Hz +# "720p60hz" | 1280x720 Progressive 60Hz +# "720p50hz" | 1280x720 Progressive 50Hz +# "1080p60hz" | 1920x1080 Progressive 60Hz +# "1080p50hz" | 1920x1080 Progressive 50Hz +# "1080p30hz" | 1920x1080 Progressive 30Hz +# "1080p24hz" | 1920x1080 Progressive 24Hz +# "1080i60hz" | 1920x1080 Interlaced 60Hz +# "1080i50hz" | 1920x1080 Interlaced 50Hz +# "2160p60hz" | 3840x2160 Progressive 60Hz +# "2160p50hz" | 3840x2160 Progressive 50Hz +# "2160p30hz" | 3840x2160 Progressive 30Hz +# "2160p25hz" | 3840x2160 Progressive 25Hz +# "2160p24hz" | 3840x2160 Progressive 24Hz +# "smpte24hz" | 3840x2160 Progressive 24Hz SMPTE +# "2160p60hz420" | 3840x2160 Progressive 60Hz YCbCr 4:2:0 +# "2160p50hz420" | 3840x2160 Progressive 50Hz YCbCr 4:2:0 +# "640x480p60hz" | 640x480 Progressive 60Hz +# "800x480p60hz" | 800x480 Progressive 60Hz +# "800x600p60hz" | 800x600 Progressive 60Hz +# "1024x600p60hz" | 1024x600 Progressive 60Hz +# "1024x768p60hz" | 1024x768 Progressive 60Hz +# "1280x800p60hz" | 1280x800 Progressive 60Hz +# "1280x1024p60hz" | 1280x1024 Progressive 60Hz +# "1360x768p60hz" | 1360x768 Progressive 60Hz +# "1440x900p60hz" | 1440x900 Progressive 60Hz +# "1600x900p60hz" | 1600x900 Progressive 60Hz +# "1600x1200p60hz" | 1600x1200 Progressive 60Hz +# "1680x1050p60hz" | 1680x1050 Progressive 60Hz +# "1920x1200p60hz" | 1920x1200 Progressive 60Hz +# "2560x1080p60hz" | 2560x1080 Progressive 60Hz +# "2560x1440p60hz" | 2560x1440 Progressive 60Hz +# "2560x1600p60hz" | 2560x1600 Progressive 60Hz +# "3440x1440p60hz" | 3440x1440 Progressive 60Hz +setenv hdmimode "1080p60hz" + +# Overscan percentage +# This value scales down the actual screen size by the percentage below +# valid range is 80 to 100 +setenv overscan "100" + +### voutmode : hdmi or dvi +setenv voutmode "hdmi" +# setenv voutmode "dvi" + +# HPD enable/disable option +setenv disablehpd "false" + +# max cpu frequency for big core, A73 in MHz unit +# setenv max_freq_a73 "2004" # 2.004 GHz +# setenv max_freq_a73 "1992" # 1.992 GHz +# setenv max_freq_a73 "1908" # 1.908 GHz +setenv max_freq_a73 "1800" # 1.8 GHz, default value +# setenv max_freq_a73 "1704" # 1.704 GHz + +# max cpu frequency for little core, A53 in MHz unit +# setenv max_freq_a53 "1992" # 1.992 GHz +setenv max_freq_a53 "1896" # 1.896 GHz, default value +# setenv max_freq_a53 "1704" # 1.704 GHz + + +# max cpu-cores +# Note: +# CPU's 0 and 1 are the A53 (small cores) +# CPU's 2 to 5 are the A73 (big cores) +# Lowering this value disables only the bigger cores (the last cores). +# setenv maxcpus "4" +# setenv maxcpus "5" +setenv maxcpus "6" + +### Normal HDMI Monitors +if test "${display_autodetect}" = "true"; then hdmitx edid; fi +if test "${hdmimode}" = "custombuilt"; then setenv cmode "modeline=${modeline}"; fi + +# Boot Args +setenv bootargs "root=/dev/mmcblk${devno}p2 rootwait rw ${condev} ${amlogic} no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=576cvbs max_freq_a53=${max_freq_a53} max_freq_a73=${max_freq_a73} maxcpus=${maxcpus} voutmode=${voutmode} ${cmode} disablehpd=${disablehpd} cvbscable=${cvbscable} overscan=${overscan}" + +# Set load addresses +setenv dtb_loadaddr "0x1000000" +setenv loadaddr "0x1B00000" +setenv initrd_loadaddr "0x3700000" + +# Load kernel, dtb and initrd +load mmc ${devno}:1 ${loadaddr} /Image +load mmc ${devno}:1 ${dtb_loadaddr} /dtbs/amlogic/meson64_odroidn2.dtb +load mmc ${devno}:1 ${initrd_loadaddr} /initramfs-linux.uimg +fdt addr ${dtb_loadaddr} + +# boot +booti ${loadaddr} ${initrd_loadaddr} ${dtb_loadaddr} diff --git a/alarm/uboot-odroid-n2/uboot-odroid-n2.install b/alarm/uboot-odroid-n2/uboot-odroid-n2.install new file mode 100644 index 000000000..a168a100b --- /dev/null +++ b/alarm/uboot-odroid-n2/uboot-odroid-n2.install @@ -0,0 +1,34 @@ +sd_fuse() { + if [ ! -b $1 ]; then + echo "No MMC device to flash, exiting." + exit 0 + fi + + echo "U-Boot fusing" + dd if=/boot/u-boot.bin of=$1 conv=fsync,notrunc bs=512 seek=1 +} + +flash_uboot() { + major=$(mountpoint -d / | cut -f 1 -d ':') + minor=$(mountpoint -d / | cut -f 2 -d ':') + device=$(cat /proc/partitions | awk {'if ($1 == "'${major}'" && $2 == "'${minor}'") print $4 '}) + device="/dev/${device%%p*}" + + echo "A new U-Boot version needs to be flashed onto ${device}." + echo "Do you want to do this now? [y|N]" + read -r shouldwe + if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then + sd_fuse ${device} + else + echo "You can do this later by running:" + echo "# cd /boot; ./sd_fusing.sh ${device}" + fi +} + +post_install() { + flash_uboot +} + +post_upgrade() { + flash_uboot +}