added alarm/uboot-odroid-c2-mainline

This commit is contained in:
Kevin Mihelich 2017-05-06 01:06:08 +00:00
parent 30b14380a4
commit 424015dd81
5 changed files with 161 additions and 0 deletions

View file

@ -0,0 +1,59 @@
# U-Boot: ODROID-C2
# Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>
buildarch=8
pkgname=uboot-odroid-c2-mainline
pkgver=2017.05rc3
pkgrel=1
pkgdesc="Mainline U-Boot for ODROID-C2"
arch=('aarch64')
url='http://www.denx.de/wiki/U-Boot/WebHome'
license=('GPL')
install=$pkgname.install
makedepends=('git' 'bc' 'dtc' 'meson-tools')
backup=('boot/boot.txt' 'boot/boot.scr')
_commit=3eb97d48991decdd5dea537c8c2325cbb0611089
source=("ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver/rc/-rc}.tar.bz2"
"https://github.com/hardkernel/u-boot/archive/${_commit}.tar.gz"
'sd_fusing.sh'
'boot.txt'
'mkscr')
md5sums=('2448e8ccf3e140c7a3506e0c1f68fc37'
'448f16a7f15871a2c5686689c0be5ef0'
'c1222a54697dc5025f059024d41b9659'
'4258258571f02d00d4b38d03b563dc2b'
'021623a04afd29ac3f368977140cfbfd')
build() {
cd u-boot-${pkgver/rc/-rc}
unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
make distclean
make odroid-c2_defconfig
echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> .config
make EXTRAVERSION=-${pkgrel}
cd ../u-boot-${_commit}
make -C tools/fip_create
}
package() {
install -d "${pkgdir}"/boot
u-boot-${_commit}/tools/fip_create/fip_create \
--bl30 u-boot-${_commit}/fip/gxb/bl30.bin \
--bl301 u-boot-${_commit}/fip/gxb/bl301.bin \
--bl31 u-boot-${_commit}/fip/gxb/bl31.bin \
--bl33 u-boot-${pkgver/rc/-rc}/u-boot.bin \
fip.bin
cat u-boot-${_commit}/fip/gxb/bl2.package fip.bin > boot_new.bin
amlbootsig boot_new.bin u-boot.img
dd if=u-boot.img of=u-boot.gxbb bs=512 skip=96
cp u-boot-${_commit}/sd_fuse/bl1.bin.hardkernel u-boot.gxbb "${pkgdir}"/boot
u-boot-${pkgver/rc/-rc}/tools/mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt "${pkgdir}"/boot/boot.scr
cp boot.txt mkscr sd_fusing.sh "${pkgdir}"/boot
}

View file

@ -0,0 +1,15 @@
# After modifying, run ./mkscr
test -n "${distro_bootpart}" || setenv distro_bootpart 1
part uuid ${devtype} ${devnum}:${distro_bootpart} uuid
setenv bootargs "console=ttyAML0,115200n8 root=PARTUUID=${uuid} rw rootwait earlycon"
if load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} /boot/Image; then
if load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
if load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
else
booti ${kernel_addr_r} - ${fdt_addr_r};
fi;
fi;
fi

View file

@ -0,0 +1,9 @@
#!/bin/bash
if [[ ! -x /usr/bin/mkimage ]]; then
echo "mkimage not found. Please install uboot-tools:"
echo " pacman -S uboot-tools"
exit 1
fi
mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr

View file

@ -0,0 +1,35 @@
#!/bin/sh
#
# Copyright (C) 2015 Hardkernel Co,. Ltd
# Dongjin Kim <tobetter@gmail.com>
#
# Modified for Arch Linux ARM package uboot-odroid-c2-mainline
#
# SPDX-License-Identifier: GPL-2.0+
#
BL1=bl1.bin.hardkernel
UBOOT=u-boot.gxbb
if [ -z $1 ]; then
echo "Usage ./sd_fusing.sh <SD card reader's device>"
exit 1
fi
if [ ! -f $BL1 ]; then
echo "error: $BL1 does not exist"
exit 1
fi
if [ ! -f $UBOOT ]; then
echo "error: $UBOOT does not exist"
exit 1
fi
dd if=$BL1 of=$1 conv=fsync bs=1 count=442
dd if=$BL1 of=$1 conv=fsync bs=512 skip=1 seek=1
dd if=$UBOOT of=$1 conv=fsync bs=512 seek=97
sync
echo Finished.

View file

@ -0,0 +1,43 @@
sd_fuse() {
device=$1
if [ ! -b /dev/${device} ]; then
echo "No MMC device to flash, exiting."
exit 0
fi
echo "BL1 fusing"
dd if=/boot/bl1.bin.hardkernel of=/dev/${device} conv=fsync bs=1 count=442
dd if=/boot/bl1.bin.hardkernel of=/dev/${device} conv=fsync bs=512 skip=1 seek=1
echo "u-boot fusing"
dd if=/boot/u-boot.gxbb of=/dev/${device} conv=fsync bs=512 seek=97
}
flash_uboot() {
if mountpoint -d /boot > /dev/null 2>&1; then
base=/boot
else
base=/
fi
major=$(mountpoint -d $base | cut -f 1 -d ':')
minor=$(expr $(mountpoint -d $base | cut -f 2 -d ':') - 1)
device=$(cat /proc/partitions | awk {'if ($1 == "'${major}'" && $2 == "'${minor}'") print $4 '})
echo "A new U-Boot version needs to be flashed onto /dev/${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 /dev/${device}"
fi
}
post_install() {
flash_uboot
}
post_upgrade() {
flash_uboot
}