Skip to content

Instantly share code, notes, and snippets.

@nmenon

nmenon/v5 to v6 Secret

Created August 25, 2023 12:57
Show Gist options
  • Save nmenon/6d934f4e1092aa293a771d26b0f2bff7 to your computer and use it in GitHub Desktop.
Save nmenon/6d934f4e1092aa293a771d26b0f2bff7 to your computer and use it in GitHub Desktop.
diff --git a/board/ti/am62x/am62x.env b/board/ti/am62x/am62x.env
index 68b26703bf7f..3b79ae1b3f0d 100644
--- a/board/ti/am62x/am62x.env
+++ b/board/ti/am62x/am62x.env
@@ -1,4 +1,5 @@
#include <env/ti/ti_common.env>
+#include <env/ti/default_findfdt.env>
#include <env/ti/mmc.env>
name_kern=Image
diff --git a/board/ti/am62x/beagleplay.env b/board/ti/am62x/beagleplay.env
index 73a078b93009..1d38effd7b9c 100644
--- a/board/ti/am62x/beagleplay.env
+++ b/board/ti/am62x/beagleplay.env
@@ -1,4 +1,5 @@
#include <env/ti/ti_common.env>
+#include <env/ti/default_findfdt.env>
#include <env/ti/mmc.env>
name_kern=Image
@@ -14,5 +15,5 @@ mmcdev=1
bootpart=1:1
bootdir=/boot
boot_targets=mmc1 mmc0 usb pxe
-bootmeths=extlinux efi
+bootmeths=script extlinux efi
rd_spec=-
diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
index 112125673699..a2729c1d0e36 100644
--- a/configs/am62x_evm_a53_defconfig
+++ b/configs/am62x_evm_a53_defconfig
@@ -25,6 +25,7 @@ CONFIG_SPL_FS_FAT=y
CONFIG_SPL_LIBDISK_SUPPORT=y
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI=y
+# CONFIG_PSCI_RESET is not set
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
CONFIG_SPL_LOAD_FIT=y
CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
diff --git a/doc/board/ti/am62x_beagleplay.rst b/doc/board/ti/am62x_beagleplay.rst
index 8fbeb715c4a8..39913b29ab2c 100644
--- a/doc/board/ti/am62x_beagleplay.rst
+++ b/doc/board/ti/am62x_beagleplay.rst
@@ -75,10 +75,10 @@ Copy the below images to an SD card and boot:
* tiboot3-am62x-gp-evm.bin from R5 build as tiboot3.bin
* tispl.bin_unsigned from Cortex-A build as tispl.bin
-* u-boot.img_unsigned from Cortex-A build as uboot.img
+* u-boot.img_unsigned from Cortex-A build as u-boot.img
-Image formats:
---------------
+Image formats
+-------------
- tiboot3.bin
@@ -90,6 +90,72 @@ Image formats:
.. image:: img/dm_tispl.bin.svg
:alt: tispl.bin image format
+Additional hardware for U-Boot development
+------------------------------------------
+
+* Serial Console is critical for U-Boot development on BeaglePlay. See
+ `BeaglePlay serial console documentation
+ <https://docs.beagleboard.org/latest/boards/beagleplay/demos-and-tutorials/using-serial-console.html>`_.
+* uSD is preferred option over eMMC, and a SD/MMC reader will be needed.
+* (optionally) JTAG is useful when working with very early stages of boot.
+
+Default storage options
+-----------------------
+
+There are multiple storage media options on BeaglePlay, but primarily:
+
+* Onboard eMMC (default) - reliable, fast and meant for deployment use.
+* SD/MMC card interface (hold 'USR' switch and power on) - Entirely
+ depends on the SD card quality.
+
+Flash to uSD card or how to deal with "bricked" Board
+--------------------------------------------------------
+
+When deploying or working on Linux, it's common to use the onboard
+eMMC. However, avoiding the eMMC and using the uSD card is safer when
+working with U-Boot.
+
+If you choose to hand format your own bootable uSD card, be
+aware that it can be difficult. The following information
+may be helpful, but remember that it is only sometimes
+reliable, and partition options can cause issues. These
+can potentially help:
+
+* https://git.ti.com/cgit/arago-project/tisdk-setup-scripts/tree/create-sdcard.sh
+* https://elinux.org/Beagleboard:Expanding_File_System_Partition_On_A_microSD
+
+The simplest option is to start with a standard distribution
+image like those in `BeagleBoard.org Distros Page
+<https://www.beagleboard.org/distros>`_ and download a disk image for
+BeaglePlay. Pick a 16GB+ uSD card to be on the safer side.
+
+With an SD/MMC Card reader and `Balena Etcher
+<https://etcher.balena.io/>`_, having a functional setup in minutes is
+a trivial matter, and it works on almost all Host Operating Systems.
+Yes Windows users, Windows Subsystem for Linux(WSL) based development
+with U-Boot and update uSD card is practical.
+
+Updating U-Boot is a matter of copying the tiboot3.bin, tispl.bin and
+u-boot.img to the "BOOT" partition of the uSD card. Remember to sync
+and unmount (or Eject - depending on the Operating System) the uSD
+card prior to physically removing from SD card reader.
+
+Also see following section on switch setting used for booting using
+uSD card.
+
+.. note::
+ Great news! If the board has not been damaged physically, there's no
+ need to worry about it being "bricked" on this platform. You only have
+ to flash an uSD card, plug it in, and reinstall the image on eMMC. This
+ means that even if you make a mistake, you can quickly fix it and rest
+ easy.
+
+ If you are frequently working with uSD cards, you might find the
+ following useful:
+
+ * `USB-SD-Mux <https://www.linux-automation.com/en/products/usb-sd-mux.html>`_
+ * `SD-Wire <https://wiki.tizen.org/SDWire>`_
+
Flash to eMMC
-------------
diff --git a/include/env/ti/default_findfdt.env b/include/env/ti/default_findfdt.env
new file mode 100644
index 000000000000..a2b51dd923bb
--- /dev/null
+++ b/include/env/ti/default_findfdt.env
@@ -0,0 +1,12 @@
+default_device_tree=CONFIG_DEFAULT_DEVICE_TREE
+default_device_tree_arch=ti
+#ifdef CONFIG_ARM64
+findfdt=
+ setenv name_fdt ${default_device_tree_arch}/${default_device_tree}.dtb;
+ setenv fdtfile ${name_fdt}
+#else
+default_device_tree_subarch=omap
+findfdt=
+ setenv name_fdt ${default_device_tree_arch}/${default_device_tree_subarch}/${default_device_tree}.dtb;
+ setenv fdtfile ${name_fdt}
+#endif
diff --git a/include/env/ti/mmc.env b/include/env/ti/mmc.env
index 6fb47fb26673..0256a2d2aaca 100644
--- a/include/env/ti/mmc.env
+++ b/include/env/ti/mmc.env
@@ -5,7 +5,9 @@ args_mmc=run finduuid;setenv bootargs console=${console}
${optargs}
root=PARTUUID=${uuid} rw
rootfstype=${mmcrootfstype}
+#ifndef CONFIG_BOOTSTD
loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr
+#endif
bootscript=echo Running bootscript from mmc${mmcdev} ...;
source ${loadaddr}
bootenvfile=uEnv.txt
@@ -15,10 +17,10 @@ loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile}
get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${name_fdt}
-envboot=mmc dev ${mmcdev};
+envboot=if mmc dev ${mmcdev}; then
if mmc rescan; then
echo SD/MMC found on device ${mmcdev};
- if run loadbootscript; then
+ if test -n "${loadbootscript}" && run loadbootscript; then
run bootscript;
else
if run loadbootenv; then
@@ -31,6 +33,7 @@ envboot=mmc dev ${mmcdev};
fi;
fi;
fi;
+ fi;
mmcloados=
if test ${boot_fdt} = yes || test ${boot_fdt} = try; then
if run get_fdt_mmc; then
@@ -45,7 +48,7 @@ mmcloados=
else
bootz;
fi;
-mmcboot=mmc dev ${mmcdev};
+mmcboot=if mmc dev ${mmcdev}; then
devnum=${mmcdev};
devtype=mmc;
if mmc rescan; then
@@ -58,7 +61,8 @@ mmcboot=mmc dev ${mmcdev};
run mmcloados;
fi;
fi;
-fi;
+ fi;
+ fi;
init_mmc=run args_all args_mmc
get_overlay_mmc=
diff --git a/include/env/ti/ti_common.env b/include/env/ti/ti_common.env
index 322f849a5560..e87a41a6590b 100644
--- a/include/env/ti/ti_common.env
+++ b/include/env/ti/ti_common.env
@@ -32,15 +32,3 @@ bootcmd_ti_mmc=
else;
run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern;
fi;
-default_device_tree=CONFIG_DEFAULT_DEVICE_TREE
-default_device_tree_arch=ti
-#ifdef CONFIG_ARM64
-findfdt=
- setenv name_fdt ${default_device_tree_arch}/${default_device_tree}.dtb;
- setenv fdtfile ${name_fdt}
-#else
-default_device_tree_subarch=omap
-findfdt=
- setenv name_fdt ${default_device_tree_arch}/${default_device_tree_subarch}/${default_device_tree}.dtb;
- setenv fdtfile ${name_fdt}
-#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment