summaryrefslogtreecommitdiff
path: root/libre
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2019-11-09 02:32:44 +0100
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2019-11-10 18:00:59 +0100
commit69c40ed6ef171875f403d13ce3701069a56aac42 (patch)
treee07e88f894bf2f7d772f1cc8485884a534ff51ea /libre
parent8d54a88c53e6a50a40f77b572e10d51bcbe0b24e (diff)
downloadabslibre-69c40ed6ef171875f403d13ce3701069a56aac42.tar.gz
abslibre-69c40ed6ef171875f403d13ce3701069a56aac42.tar.bz2
abslibre-69c40ed6ef171875f403d13ce3701069a56aac42.zip
libre: u-boot: Add uboot4extlinux-omap3
In u-boot, the BeagleBoard type is now autodetected in beagle.c, so we can now support all the previously supported revisions with only one package. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Diffstat (limited to 'libre')
-rw-r--r--libre/uboot4extlinux-omap3/0001-omap34xx-SPL-enable-MMC-raw-boot-with-u-boot.img.patch44
-rw-r--r--libre/uboot4extlinux-omap3/PKGBUILD80
-rw-r--r--libre/uboot4extlinux-omap3/extlinux.conf51
-rw-r--r--libre/uboot4extlinux-omap3/uboot4extlinux-omap3.install37
4 files changed, 212 insertions, 0 deletions
diff --git a/libre/uboot4extlinux-omap3/0001-omap34xx-SPL-enable-MMC-raw-boot-with-u-boot.img.patch b/libre/uboot4extlinux-omap3/0001-omap34xx-SPL-enable-MMC-raw-boot-with-u-boot.img.patch
new file mode 100644
index 000000000..d746bde6e
--- /dev/null
+++ b/libre/uboot4extlinux-omap3/0001-omap34xx-SPL-enable-MMC-raw-boot-with-u-boot.img.patch
@@ -0,0 +1,44 @@
+From a49275a3cc03970939585610ebcf3b3d7e547037 Mon Sep 17 00:00:00 2001
+From: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+Date: Sat, 9 Nov 2019 18:53:40 +0100
+Subject: [PATCH] omap34xx: SPL: enable MMC raw boot with u-boot.img
+
+The following commit enabled raw SPL booting:
+ 22d90d560a omap3: Use raw SPL by default for mmc1
+but it was reverted by the following commit:
+ 821c89d38c Revert "omap3: Use raw SPL by default for mmc1"
+because SPL is unable to distinguish between RAW images and
+garbage.
+
+However if CONFIG_SPL_RAW_IMAGE_SUPPORT is disabled, SPL does
+identify if there is a valid image with spl_parse_image_header.
+
+With this change, and CONFIG_SPL_RAW_IMAGE_SUPPORT disabled,
+raw MMC boot will be tried first, and if it fails, it FS will
+be tried.
+
+The two scenarios have been tested on a BeagleBoard XM Revision C1.
+
+Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+---
+ arch/arm/mach-omap2/boot-common.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/arm/mach-omap2/boot-common.c b/arch/arm/mach-omap2/boot-common.c
+index 734fa9d9e6..a48244e1c5 100644
+--- a/arch/arm/mach-omap2/boot-common.c
++++ b/arch/arm/mach-omap2/boot-common.c
+@@ -132,8 +132,10 @@ void save_omap_boot_params(void)
+ (boot_device <= MMC_BOOT_DEVICES_END)) {
+ switch (boot_device) {
+ case BOOT_DEVICE_MMC1:
++#ifdef CONFIG_SPL_RAW_IMAGE_SUPPORT
+ boot_mode = MMCSD_MODE_FS;
+ break;
++#endif
+ case BOOT_DEVICE_MMC2:
+ boot_mode = MMCSD_MODE_RAW;
+ break;
+--
+2.24.0
+
diff --git a/libre/uboot4extlinux-omap3/PKGBUILD b/libre/uboot4extlinux-omap3/PKGBUILD
new file mode 100644
index 000000000..0f619dee2
--- /dev/null
+++ b/libre/uboot4extlinux-omap3/PKGBUILD
@@ -0,0 +1,80 @@
+# U-Boot: BeagleBoard
+# Maintainer: André Silva <emulatorman@hyperbola.info>
+# Contributor: Jookia <166291@gmail.com>
+# Contributor: Márcio Silva <coadde@hyperbola.info>
+
+pkgbase=uboot4extlinux-omap3
+pkgname=('uboot4extlinux-omap3_beagle')
+pkgver=2019.10
+pkgrel=1
+arch=('armv7h')
+url="http://git.denx.de/u-boot.git/"
+license=('GPL')
+makedepends=('bc' 'bison' 'dtc' 'flex' 'python' 'python2' 'swig')
+backup=(boot/extlinux/extlinux.conf)
+source=("ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver}.tar.bz2"
+ '0001-omap34xx-SPL-enable-MMC-raw-boot-with-u-boot.img.patch'
+ 'extlinux.conf')
+sha256sums=('8d6d6070739522dd236cba7055b8736bfe92b4fac0ea18ad809829ca79667014'
+ 'SKIP'
+ 'd8ca994d80f05a99963b92736860d0a7f420d0771a6e5da9add0c6eac40034b6')
+
+boards=('omap3_beagle')
+
+prepare() {
+ cd u-boot-${pkgver}
+
+ # The default is 0x300 512b blocks which forces u-boot.img to be locarted at
+ # 384k on the microSD. As u-boot.img is big, it often goes over the 1MB empty
+ # space that is created by default when partitioning block devices. That
+ # corrupts the first partition. Using 0x200 leaves more space to u-boot.img
+ # and is well aligned to 128k.
+ echo 'CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200' >> configs/omap3_beagle_defconfig
+
+ # See the 0001-omap34xx-SPL-enable-MMC-raw-boot-with-u-boot.img.patch for
+ # rationale for this configuration
+ echo '# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set' >> configs/omap3_beagle_defconfig
+
+ # We want to enable users to use both RAW mode and filesystems to install
+ # u-boot, but as filesystems are more complicated due to constraints that
+ # need to be respected for it to work we default to raw block. This patch
+ # restores the ability of using RAW block mode. RAW partitions have not been
+ # tested yet and may or may not work but they have constraints as well.
+ patch -Np1 -i ../0001-omap34xx-SPL-enable-MMC-raw-boot-with-u-boot.img.patch
+}
+
+build() {
+ cd u-boot-${pkgver}
+
+ unset CFLAGS CXXFLAGS LDFLAGS
+
+ for i in ${boards[@]}; do
+ mkdir -p ../bin_${i}
+ make distclean
+ make ${i}_defconfig
+ echo 'CONFIG_IDENT_STRING=" Parabola GNU/Linux-libre"' >> .config
+ make EXTRAVERSION=-${pkgrel}
+ mv -f MLO u-boot.img ../bin_${i}
+ done
+}
+
+package_uboot4extlinux-omap3_beagle() {
+ pkgdesc="U-Boot with Extlinux support for various BeagleBoards"
+
+ install=${pkgbase}.install
+ provides=('uboot4extlinux-omap3')
+ conflicts=('grub-omap3_beagle'
+ 'grub-omap3_beagle_xm'
+ 'grub-omap3_beagle_xm_ab'
+ 'uboot-omap3_beagle')
+
+ install -d "${pkgdir}"/boot/extlinux
+ install -d "${pkgdir}"/boot/u-boot/images/
+
+ install -Dm644 \
+ bin_omap3_beagle/MLO \
+ bin_omap3_beagle/u-boot.img \
+ "${pkgdir}"/boot/u-boot/images/
+
+ install -Dm644 extlinux.conf "${pkgdir}"/boot/extlinux
+}
diff --git a/libre/uboot4extlinux-omap3/extlinux.conf b/libre/uboot4extlinux-omap3/extlinux.conf
new file mode 100644
index 000000000..e31c975d7
--- /dev/null
+++ b/libre/uboot4extlinux-omap3/extlinux.conf
@@ -0,0 +1,51 @@
+menu title Welcome to U-Boot with Extlinux support!
+
+timeout 50
+
+label Parabola GNU/Linux-libre, linux-libre kernel
+ kernel /boot/vmlinuz-linux-libre
+ initrd /boot/initramfs-linux-libre-fallback.img
+ append console=ttyO2,115200 root=/dev/mmcblk0p1 rw rootwait
+ fdtdir /boot/dtbs/linux-libre
+
+label Parabola GNU/Linux-libre, linux-libre-lts kernel
+ kernel /boot/vmlinuz-linux-libre-lts
+ initrd /boot/initramfs-linux-libre-lts-fallback.img
+ append console=ttyO2,115200 root=/dev/mmcblk0p1 rw rootwait
+ fdtdir /boot/dtbs/linux-libre-lts
+
+label Parabola GNU/Linux-libre, linux-libre-lts-knock kernel
+ kernel /boot/vmlinuz-linux-libre-lts-knock
+ initrd /boot/initramfs-linux-libre-lts-knock-fallback.img
+ append console=ttyO2,115200 root=/dev/mmcblk0p1 rw rootwait
+ fdtdir /boot/dtbs/linux-libre-lts-knock
+
+label Parabola GNU/Linux-libre, linux-libre-hardened kernel
+ kernel /boot/vmlinuz-linux-libre-hardened
+ initrd /boot/initramfs-linux-libre-hardened-fallback.img
+ append console=ttyO2,115200 root=/dev/mmcblk0p1 rw rootwait
+ fdtdir /boot/dtbs/linux-libre-hardened
+
+label Parabola GNU/Linux-libre, linux-libre-lts-apparmor kernel
+ kernel /boot/vmlinuz-linux-libre-lts-apparmor
+ initrd /boot/initramfs-linux-libre-lts-apparmor-fallback.img
+ append console=ttyO2,115200 root=/dev/mmcblk0p1 rw rootwait
+ fdtdir /boot/dtbs/linux-libre-lts-apparmor
+
+label Parabola GNU/Linux-libre, linux-libre-pck kernel
+ kernel /boot/vmlinuz-linux-libre-pck
+ initrd /boot/initramfs-linux-libre-pck-fallback.img
+ append console=ttyO2,115200 root=/dev/mmcblk0p1 rw rootwait
+ fdtdir /boot/dtbs/linux-libre-pck
+
+label Parabola GNU/Linux-libre, linux-libre-rt kernel
+ kernel /boot/vmlinuz-linux-libre-rt
+ initrd /boot/initramfs-linux-libre-rt-fallback.img
+ append console=ttyO2,115200 root=/dev/mmcblk0p1 rw rootwait
+ fdtdir /boot/dtbs/linux-libre-rt
+
+label Parabola GNU/Linux-libre, linux-libre-xtreme kernel
+ kernel /boot/vmlinuz-linux-libre-xtreme
+ initrd /boot/initramfs-linux-libre-xtreme-fallback.img
+ append console=ttyO2,115200 root=/dev/mmcblk0p1 rw rootwait
+ fdtdir /boot/dtbs/linux-libre-xtreme
diff --git a/libre/uboot4extlinux-omap3/uboot4extlinux-omap3.install b/libre/uboot4extlinux-omap3/uboot4extlinux-omap3.install
new file mode 100644
index 000000000..f33e8c1e3
--- /dev/null
+++ b/libre/uboot4extlinux-omap3/uboot4extlinux-omap3.install
@@ -0,0 +1,37 @@
+flash_instructions() {
+ echo "# dd if=/boot/u-boot/images/MLO of=/dev/mmcblk0 count=1 seek=1 conv=notrunc bs=128k"
+ echo "# dd if=/boot/u-boot/images/u-boot.img of=/dev/mmcblk0 count=6 seek=2 conv=notrunc bs=128k"
+}
+
+extlinux_warning() {
+ echo "==> WARNING: Remember to set up your kernels in /boot/extlinux/extlinux.conf"
+}
+
+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 you want to do this now? [y|N]"
+ read -r shouldwe
+ if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then
+ dd if=/boot/u-boot/images/MLO of=$root bs=128k seek=1 count=1 conv=notrunc
+ dd if=/boot/u-boot/images/u-boot.img of=$root bs=128k seek=2 count=6 conv=notrunc
+ 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
+ extlinux_warning
+}
+
+post_install() {
+ flash_uboot
+}
+
+post_upgrade() {
+ flash_uboot
+}