From c960741ef5840306e12dd955a9524c4d534e3f4c Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Wed, 31 Jul 2013 03:56:28 +0000 Subject: [PATCH] added alarm/uboot-sunxi --- alarm/uboot-sunxi/PKGBUILD | 49 +++++++++++++++ alarm/uboot-sunxi/alarm.patch | 89 +++++++++++++++++++++++++++ alarm/uboot-sunxi/uboot-sunxi.install | 24 ++++++++ 3 files changed, 162 insertions(+) create mode 100644 alarm/uboot-sunxi/PKGBUILD create mode 100644 alarm/uboot-sunxi/alarm.patch create mode 100644 alarm/uboot-sunxi/uboot-sunxi.install diff --git a/alarm/uboot-sunxi/PKGBUILD b/alarm/uboot-sunxi/PKGBUILD new file mode 100644 index 000000000..72f57edbd --- /dev/null +++ b/alarm/uboot-sunxi/PKGBUILD @@ -0,0 +1,49 @@ +# U-Boot: sunXi +# Maintainer: Kevin Mihelich + +buildarch=4 + +pkgbase=uboot-sunxi +pkgname=('uboot-cubieboard2') +pkgver=2013.07 +pkgrel=1 +arch=('armv7h') +url="https://github.com/linux-sunxi/u-boot-sunxi/tree/sunxi-current" +license=('GPL') +makedepends=('sunxi-tools') +_commit=29689232f8a4d1640e551ef433176b81cecfa9c7 +source=("https://github.com/linux-sunxi/u-boot-sunxi/archive/${_commit}.tar.gz" + "alarm.patch" + "https://github.com/linux-sunxi/sunxi-boards/raw/5479306d42bc0854b184ce1bbc731ce18f4a8598/sys_config/a20/cubieboard2.fex") +md5sums=('7612f5c721a2804a36b41ba33925be02' + '8b95ce286b84f52928bc0b4b07edd00a' + '3cc25a45c1ec429f8a3ca67f922a846f') + +prepare() { + cd u-boot-sunxi-${_commit} + patch -p1 -i "${srcdir}"/alarm.patch +} + +build() { + cd u-boot-sunxi-${_commit} + + unset CFLAGS + unset CXXFLAGS + + for i in Cubieboard2; do + mkdir bin_${i} + make distclean + make ${i} + mv u-boot.bin spl/sunxi-spl.bin bin_${i} + done +} + +package_uboot-cubieboard2() { + pkgdesc="U-Boot for Cubieboard 2" + install=${pkgbase}.install + + mkdir -p "${pkgdir}"/boot + cp u-boot-sunxi-${_commit}/bin_Cubieboard2/{u-boot.bin,sunxi-spl.bin} "${pkgdir}"/boot + + fex2bin cubieboard2.fex "${pkgdir}"/boot/script.bin +} diff --git a/alarm/uboot-sunxi/alarm.patch b/alarm/uboot-sunxi/alarm.patch new file mode 100644 index 000000000..3650dd961 --- /dev/null +++ b/alarm/uboot-sunxi/alarm.patch @@ -0,0 +1,89 @@ +diff -urN a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h +--- a/include/configs/sunxi-common.h 2013-07-26 07:45:03.000000000 -0600 ++++ b/include/configs/sunxi-common.h 2013-07-30 21:50:31.691055539 -0600 +@@ -148,7 +148,7 @@ + #define CONFIG_SYS_NO_FLASH + + #define CONFIG_SYS_MONITOR_LEN (512 << 10) /* 512 KiB */ +-#define CONFIG_IDENT_STRING " Allwinner Technology" ++#define CONFIG_IDENT_STRING " Arch Linux ARM" + + #define CONFIG_ENV_OFFSET (544 << 10) /* (8 + 24 + 512) KiB */ + #define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */ +@@ -191,13 +191,7 @@ + "device=mmc\0" \ + "partition=0:1\0" \ + "setargs=" \ +- "if test -z \\\\\"$root\\\\\"; then"\ +- " if test \\\\\"$bootpath\\\\\" = \"boot/\"; then"\ +- " root=\"/dev/mmcblk0p1 rootwait\";"\ +- " else" \ +- " root=\"/dev/mmcblk0p2 rootwait\";"\ +- " fi;"\ +- " fi;"\ ++ " root=\"/dev/mmcblk0p1 rw rootwait\";"\ + " setenv bootargs console=${console} root=${root}" \ + " loglevel=${loglevel} ${panicarg} ${extraargs}" \ + "\0" \ +@@ -205,38 +199,20 @@ + "bootenv=uEnv.txt\0" \ + "bootscr=boot.scr\0" \ + "loadbootscr=" \ +- "fatload $device $partition $scriptaddr ${bootscr}" \ ++ "load $device $partition $scriptaddr boot/${bootscr}" \ + " || " \ +- "ext2load $device $partition $scriptaddr boot/${bootscr}" \ +- " ||" \ +- "ext2load $device $partition $scriptaddr ${bootscr}" \ ++ "load $device $partition $scriptaddr ${bootscr}" \ + "\0" \ + "loadbootenv=" \ +- "fatload $device $partition $scriptaddr ${bootenv}" \ ++ "load $device $partition $scriptaddr boot/${bootenv}" \ + " || " \ +- "ext2load $device $partition $scriptaddr boot/${bootenv}" \ +- " || " \ +- "ext2load $device $partition $scriptaddr ${bootenv}" \ ++ "load $device $partition $scriptaddr ${bootenv}" \ + "\0" \ + "loadkernel=" \ + "if "\ +- "bootpath=/boot/" \ +- " && " \ +- "ext2load $device $partition 0x43000000 ${bootpath}script.bin" \ +- " && " \ +- "ext2load $device $partition 0x48000000 ${bootpath}${kernel}" \ +- ";then true; elif " \ +- "bootpath=/" \ +- " && " \ +- "fatload $device $partition 0x43000000 script.bin" \ +- " && " \ +- "fatload $device $partition 0x48000000 ${kernel}" \ +- ";then true; elif " \ +- "bootpath=/" \ +- " && " \ +- "ext2load $device $partition 0x43000000 ${bootpath}script.bin" \ ++ "load $device $partition 0x43000000 /boot/script.bin" \ + " && " \ +- "ext2load $device $partition 0x48000000 ${bootpath}${kernel}" \ ++ "load $device $partition 0x48000000 /boot/${kernel}" \ + ";then true; else "\ + "false" \ + ";fi" \ +@@ -262,7 +238,7 @@ + "\0" \ + "" + +-#define CONFIG_BOOTDELAY 3 ++#define CONFIG_BOOTDELAY 1 + #define CONFIG_SYS_BOOT_GET_CMDLINE + #define CONFIG_AUTO_COMPLETE + +@@ -277,6 +253,7 @@ + #define CONFIG_FAT_WRITE /* enable write access */ + #define CONFIG_CMD_EXT2 /* with this we can access ext2 bootfs */ + #define CONFIG_CMD_EXT4 /* with this we can access ext4 bootfs */ ++#define CONFIG_CMD_FS_GENERIC + #define CONFIG_CMD_ZFS /* with this we can access ZFS bootfs */ + + #define CONFIG_SPL_FRAMEWORK diff --git a/alarm/uboot-sunxi/uboot-sunxi.install b/alarm/uboot-sunxi/uboot-sunxi.install new file mode 100644 index 000000000..bbff87ff2 --- /dev/null +++ b/alarm/uboot-sunxi/uboot-sunxi.install @@ -0,0 +1,24 @@ +flash_uboot() { + echo "A new U-Boot version needs to be flashed onto /dev/mmcblk0." + echo "Do you want to do this now? [y|N]" + read -r shouldwe + if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then + dd if=/boot/sunxi-spl.bin of=/dev/mmcblk0 bs=1024 seek=8 + dd if=/boot/u-boot.bin of=/dev/mmcblk0 bs=1024 seek=32 + else + echo "You can do this later by running:" + echo "# dd if=/boot/sunxi-spl.bin of=/dev/mmcblk0 bs=1024 seek=8" + echo "# dd if=/boot/u-boot.bin of=/dev/mmcblk0 bs=1024 seek=32" + fi +} + +## arg 1: the new package version +post_install() { + flash_uboot +} + +## arg 1: the new package version +## arg 2: the old package version +post_upgrade() { + flash_uboot +}