summaryrefslogtreecommitdiff
path: root/libre-testing/uboot4grub-am335x_bone
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2015-10-14 08:28:04 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2015-10-14 08:30:23 -0300
commitb9de19ba52d54a7e608656254bb43c2441707853 (patch)
treeefeec15469e4e8e926cbf38fb63b4c71e9b7ae98 /libre-testing/uboot4grub-am335x_bone
parent776999f7876ddc85f4212202fc4ec3b4389dd784 (diff)
rename uboot-grub-beaglebone to uboot4grub-am335x_bone
Diffstat (limited to 'libre-testing/uboot4grub-am335x_bone')
-rw-r--r--libre-testing/uboot4grub-am335x_bone/0001-parabola-arm-modifications+grub-support.patch183
-rw-r--r--libre-testing/uboot4grub-am335x_bone/PKGBUILD43
-rw-r--r--libre-testing/uboot4grub-am335x_bone/uboot4grub-am335x_bone.install36
3 files changed, 262 insertions, 0 deletions
diff --git a/libre-testing/uboot4grub-am335x_bone/0001-parabola-arm-modifications+grub-support.patch b/libre-testing/uboot4grub-am335x_bone/0001-parabola-arm-modifications+grub-support.patch
new file mode 100644
index 000000000..351d31be8
--- /dev/null
+++ b/libre-testing/uboot4grub-am335x_bone/0001-parabola-arm-modifications+grub-support.patch
@@ -0,0 +1,183 @@
+diff -Nur u-boot-2015.04.orig/configs/am335x_evm_defconfig u-boot-2015.04/configs/am335x_evm_defconfig
+--- u-boot-2015.04.orig/configs/am335x_evm_defconfig 2015-04-13 11:53:03.000000000 -0300
++++ u-boot-2015.04/configs/am335x_evm_defconfig 2015-10-07 01:51:34.454670270 -0300
+@@ -1,7 +1,6 @@
+ CONFIG_SPL=y
+ CONFIG_SPL_STACK_R=y
+ CONFIG_SPL_STACK_R_ADDR=0x82000000
+-CONFIG_SYS_EXTRA_OPTIONS="NAND"
+-CONFIG_CONS_INDEX=1
++CONFIG_SYS_EXTRA_OPTIONS="SERIAL1,CONS_INDEX=1"
+ CONFIG_ARM=y
+ CONFIG_TARGET_AM335X_EVM=y
+diff -Nur u-boot-2015.04.orig/include/configs/am335x_evm.h u-boot-2015.04/include/configs/am335x_evm.h
+--- u-boot-2015.04.orig/include/configs/am335x_evm.h 2015-04-13 11:53:03.000000000 -0300
++++ u-boot-2015.04/include/configs/am335x_evm.h 2015-10-07 02:51:55.094878459 -0300
+@@ -17,6 +17,7 @@
+ #define __CONFIG_AM335X_EVM_H
+
+ #include <configs/ti_am335x_common.h>
++#define CONFIG_ENV_IS_NOWHERE
+
+ #ifndef CONFIG_SPL_BUILD
+ #ifndef CONFIG_FIT
+@@ -45,6 +46,13 @@
+ /* Enhance our eMMC support / experience. */
+ #define CONFIG_CMD_GPT
+ #define CONFIG_EFI_PARTITION
++#define CONFIG_CMD_PART
++#define CONFIG_PARTITION_UUIDS
++#define CONFIG_CMD_SETEXPR
++
++/* GRUB support */
++#define CONFIG_API
++#define CONFIG_SYS_MMC_MAX_DEVICE 1
+
+ #ifdef CONFIG_NAND
+ #define NANDARGS \
+@@ -70,127 +78,21 @@
+ #ifndef CONFIG_SPL_BUILD
+ #define CONFIG_EXTRA_ENV_SETTINGS \
+ DEFAULT_LINUX_BOOT_ENV \
+- "boot_fdt=try\0" \
+- "bootpart=0:2\0" \
++ "bootpart=0:1\0" \
+ "bootdir=/boot\0" \
+- "bootfile=zImage\0" \
+- "fdtfile=undefined\0" \
+- "console=ttyO0,115200n8\0" \
++ "grubfile=grub/arm-uboot/core.img\0" \
+ "partitions=" \
+ "uuid_disk=${uuid_gpt_disk};" \
+ "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
+- "optargs=\0" \
+- "mmcdev=0\0" \
+- "mmcroot=/dev/mmcblk0p2 ro\0" \
+- "mmcrootfstype=ext4 rootwait\0" \
+- "rootpath=/export/rootfs\0" \
+- "nfsopts=nolock\0" \
+- "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
+- "::off\0" \
+- "ramroot=/dev/ram0 rw\0" \
+- "ramrootfstype=ext2\0" \
+- "mmcargs=setenv bootargs console=${console} " \
+- "${optargs} " \
+- "root=${mmcroot} " \
+- "rootfstype=${mmcrootfstype}\0" \
+- "spiroot=/dev/mtdblock4 rw\0" \
+- "spirootfstype=jffs2\0" \
+- "spisrcaddr=0xe0000\0" \
+- "spiimgsize=0x362000\0" \
+- "spibusno=0\0" \
+- "spiargs=setenv bootargs console=${console} " \
+- "${optargs} " \
+- "root=${spiroot} " \
+- "rootfstype=${spirootfstype}\0" \
+- "netargs=setenv bootargs console=${console} " \
+- "${optargs} " \
+- "root=/dev/nfs " \
+- "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
+- "ip=dhcp\0" \
+- "bootenv=uEnv.txt\0" \
+- "loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \
+- "bootscript=echo Running bootscript from mmc${mmcdev} ...; " \
+- "source ${loadaddr}\0" \
+- "loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
+- "importbootenv=echo Importing environment from mmc ...; " \
+- "env import -t -r $loadaddr $filesize\0" \
+- "ramargs=setenv bootargs console=${console} " \
+- "${optargs} " \
+- "root=${ramroot} " \
+- "rootfstype=${ramrootfstype}\0" \
+- "loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
+- "loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
+- "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
+- "mmcloados=run mmcargs; " \
+- "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+- "if run loadfdt; then " \
+- "bootz ${loadaddr} - ${fdtaddr}; " \
+- "else " \
+- "if test ${boot_fdt} = try; then " \
+- "bootz; " \
+- "else " \
+- "echo WARN: Cannot load the DT; " \
+- "fi; " \
+- "fi; " \
+- "else " \
+- "bootz; " \
+- "fi;\0" \
+- "mmcboot=mmc dev ${mmcdev}; " \
+- "if mmc rescan; then " \
+- "echo SD/MMC found on device ${mmcdev};" \
+- "if run loadbootscript; then " \
+- "run bootscript;" \
+- "else " \
+- "if run loadbootenv; then " \
+- "echo Loaded environment from ${bootenv};" \
+- "run importbootenv;" \
+- "fi;" \
+- "if test -n $uenvcmd; then " \
+- "echo Running uenvcmd ...;" \
+- "run uenvcmd;" \
+- "fi;" \
+- "if run loadimage; then " \
+- "run mmcloados;" \
+- "fi;" \
+- "fi ;" \
+- "fi;\0" \
+- "spiboot=echo Booting from spi ...; " \
+- "run spiargs; " \
+- "sf probe ${spibusno}:0; " \
+- "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
+- "bootz ${loadaddr}\0" \
+- "netboot=echo Booting from network ...; " \
+- "setenv autoload no; " \
+- "dhcp; " \
+- "tftp ${loadaddr} ${bootfile}; " \
+- "tftp ${fdtaddr} ${fdtfile}; " \
+- "run netargs; " \
+- "bootz ${loadaddr} - ${fdtaddr}\0" \
+- "ramboot=echo Booting from ramdisk ...; " \
+- "run ramargs; " \
+- "bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
+- "findfdt="\
+- "if test $board_name = A335BONE; then " \
+- "setenv fdtfile am335x-bone.dtb; fi; " \
+- "if test $board_name = A335BNLT; then " \
+- "setenv fdtfile am335x-boneblack.dtb; fi; " \
+- "if test $board_name = A33515BB; then " \
+- "setenv fdtfile am335x-evm.dtb; fi; " \
+- "if test $board_name = A335X_SK; then " \
+- "setenv fdtfile am335x-evmsk.dtb; fi; " \
+- "if test $fdtfile = undefined; then " \
+- "echo WARNING: Could not determine device tree to use; fi; \0" \
++ "grubboot=for devtype in mmc usb; do " \
++ "load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${grubfile}" \
++ "done;\0" \
+ NANDARGS \
+ DFUARGS
+ #endif
+
+ #define CONFIG_BOOTCOMMAND \
+- "run findfdt; " \
+- "run mmcboot;" \
+- "setenv mmcdev 1; " \
+- "setenv bootpart 1:2; " \
+- "run mmcboot;" \
+- "run nandboot;"
++ "run grubboot;"
+
+ /* NS16550 Configuration */
+ #define CONFIG_SYS_NS16550_COM1 0x44e09000 /* Base EVM has UART0 */
+@@ -329,9 +231,8 @@
+ #endif
+
+ #ifdef CONFIG_MUSB_GADGET
+-#define CONFIG_USB_ETHER
+-#define CONFIG_USB_ETH_RNDIS
+-#define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00"
++#define CONFIG_CMD_USB_MASS_STORAGE
++#define CONFIG_USB_GADGET_MASS_STORAGE
+
+ /* USB TI's IDs */
+ #define CONFIG_G_DNL_VENDOR_NUM 0x0451
diff --git a/libre-testing/uboot4grub-am335x_bone/PKGBUILD b/libre-testing/uboot4grub-am335x_bone/PKGBUILD
new file mode 100644
index 000000000..c32adac42
--- /dev/null
+++ b/libre-testing/uboot4grub-am335x_bone/PKGBUILD
@@ -0,0 +1,43 @@
+# U-Boot: BeagleBone and BeagleBone Black
+# Maintainer: André Silva <emulatorman@parabola.nu>
+
+buildarch=4
+
+pkgname=uboot4grub-am335x_bone
+pkgver=2015.04
+pkgrel=1
+pkgdesc="U-Boot with GRUB support for BeagleBone and BeagleBone Black"
+arch=('armv7h')
+url="http://git.denx.de/u-boot.git/"
+depends=('grub-am335x_bone')
+replaces=('uboot-beaglebone' 'uboot-grub-beaglebone')
+conflicts=('uboot-beaglebone' 'uboot4grub' 'uboot-grub-beaglebone')
+provides=('uboot-beaglebone' 'uboot4grub')
+makedepends=('bc')
+license=('GPL')
+install=${pkgname}.install
+source=("ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver}.tar.bz2"
+ '0001-parabola-arm-modifications+grub-support.patch')
+md5sums=('570bdc2c47270c2a98ca60ff6c5c74cd'
+ 'd8c8e9fea003cd06ef04fe1cd841d686')
+
+prepare() {
+ cd u-boot-${pkgver}
+ patch -Np1 -i ../0001-parabola-arm-modifications+grub-support.patch
+}
+
+build() {
+ cd u-boot-${pkgver}
+
+ unset CFLAGS CXXFLAGS LDFLAGS
+
+ make distclean
+ make am335x_evm_config
+ make
+}
+
+package() {
+ cd u-boot-${pkgver}
+ mkdir -p "${pkgdir}"/boot
+ cp MLO u-boot.img "${pkgdir}"/boot
+}
diff --git a/libre-testing/uboot4grub-am335x_bone/uboot4grub-am335x_bone.install b/libre-testing/uboot4grub-am335x_bone/uboot4grub-am335x_bone.install
new file mode 100644
index 000000000..0ab634efe
--- /dev/null
+++ b/libre-testing/uboot4grub-am335x_bone/uboot4grub-am335x_bone.install
@@ -0,0 +1,36 @@
+flash_instructions() {
+ echo "# dd if=/boot/MLO of=/dev/mmcblk0 count=1 seek=1 conv=notrunc bs=128k"
+ echo "# dd if=/boot/u-boot.img of=/dev/mmcblk0 count=2 seek=1 conv=notrunc bs=384k"
+ echo "# grub-install /dev/mmcblk0"
+ echo "# grub-mkconfig -o /boot/grub/grub.cfg"
+}
+
+flash_uboot() {
+ root=$(mount | awk '/ on \/ / { print $1; }')
+ if [[ $root =~ ^/dev/mmcblk.*$ ]]; then
+ root=${root:0:12}
+ echo "A new U-Boot version needs to be flashed onto $root."
+ echo "Do this now? [y|N]"
+ read -r shouldwe
+ if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then
+ dd if=/boot/MLO of=$root count=1 seek=1 conv=notrunc bs=128k
+ dd if=/boot/u-boot.img of=$root count=2 seek=1 conv=notrunc bs=384k
+ grub-install /dev/mmcblk0
+ grub-mkconfig -o /boot/grub/grub.cfg
+ else
+ echo "You can do this later by running:"
+ flash_instructions
+ fi
+ else
+ echo "Flash the new U-Boot version onto your boot device. For example:"
+ flash_instructions
+ fi
+}
+
+post_install() {
+ flash_uboot
+}
+
+post_upgrade() {
+ flash_uboot
+}