From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Kridner Date: Wed, 7 Mar 2018 05:40:42 -0500 Subject: [U-Boot] [PATCH 2/4] am335x_evm: scan more partitions and use uname_r In-Reply-To: <20180307104044.4739-1-jdk@ti.com> References: <20180307104044.4739-1-jdk@ti.com> Message-ID: <20180307104044.4739-3-jdk@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This enables mainline u-boot to boot the BeagleBoard.org Debian distribution builds without extensive environment modifications. Some boot layouts only have a single partition on the MMC/eMMC. This will scan those partitions after the second partition that was already being scanned. Some layouts use uname_r to define the kernel being used for the boot to support multiple kernels stored within the boot file system without using symlinks. See http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0 for more details on the BeagleBoard.org Debian image layout. Signed-off-by: Jason Kridner Cc: Robert Nelson Cc: Tom Rini --- include/configs/am335x_evm.h | 5 ++++- include/environment/ti/mmc.h | 13 +++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index 8d45b6fade..32fe0e0cd5 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -61,7 +61,10 @@ #define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \ "bootcmd_" #devtypel #instance "=" \ "setenv mmcdev " #instance"; "\ - "setenv bootpart " #instance":2 ; "\ + "setenv bootpart " #instance":2; "\ + "run mmcboot;"\ + "setenv mmcdev " #instance"; "\ + "setenv bootpart " #instance":1; "\ "run mmcboot\0" #define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \ diff --git a/include/environment/ti/mmc.h b/include/environment/ti/mmc.h index 4305ebdaaf..b803ecccb7 100644 --- a/include/environment/ti/mmc.h +++ b/include/environment/ti/mmc.h @@ -23,9 +23,10 @@ "bootenvfile=uEnv.txt\0" \ "importbootenv=echo Importing environment from mmc${mmcdev} ...; " \ "env import -t ${loadaddr} ${filesize}\0" \ - "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}\0" \ - "loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \ - "loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \ + "loadbootenv=if fatload mmc ${mmcdev} ${loadaddr} ${bootdir}/${bootenvfile}; then echo Found ${bootdir}/${bootenvfile} in FAT partition; else load mmc ${mmcdev} ${loadaddr} ${bootdir}/${bootenvfile}; fi\0" \ + "loadimage=if test -n ${uname_r}; then load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/vmlinuz-${uname_r}; run loadrd; else load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}; fi\0" \ + "loadrd=load ${devtype} ${bootpart} ${rdaddr} ${bootdir}/initrd.img-${uname_r}; setenv rdsize ${filesize}\0" \ + "loadfdt=if test -n ${uname_r}; then load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/dtbs/${uname_r}/${fdtfile}; else load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}; fi;\0" \ "envboot=mmc dev ${mmcdev}; " \ "if mmc rescan; then " \ "echo SD/MMC found on device ${mmcdev};" \ @@ -45,7 +46,11 @@ "mmcloados=run args_mmc; " \ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ "if run loadfdt; then " \ - "bootz ${loadaddr} - ${fdtaddr}; " \ + "if test -n ${uname_r}; then " \ + "bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}; " \ + "else " \ + "bootz ${loadaddr} - ${fdtaddr}; " \ + "fi; " \ "else " \ "if test ${boot_fdt} = try; then " \ "bootz; " \ -- 2.15.1