From patchwork Fri Jun 18 13:27:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1494280 X-Patchwork-Delegate: lokeshvutla@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=MKscxQEp; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G609J2r48z9sPf for ; Fri, 18 Jun 2021 23:28:04 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0F14B82BC3; Fri, 18 Jun 2021 15:27:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="MKscxQEp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3E22B82A17; Fri, 18 Jun 2021 15:27:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C54B682A17 for ; Fri, 18 Jun 2021 15:27:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id CA6A4613EC; Fri, 18 Jun 2021 13:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624022858; bh=AqVMqJsRCNiSYQijzuRebR/FID6vSuhVrTxy2NRripQ=; h=From:To:Cc:Subject:Date:From; b=MKscxQEp3gZb/k1DyZBn39zkTZ3cmnf7vSYV6iiU/e6BK+P53WOj2jBX+XZyCSqdF 7jsdCivRdxOAuWNnUR3TIEmeyZiiFANTgq7W+PmGckm5LYgqmi2RQhdm59YcfOlIx0 V4mYNVlZjodozNlQPWli9uZPRHCtFmkvEBsKkCTKoT0sIYibFQiihZGZGUE9/aM4iN yxzQ7zrLO1GqOnkXk1fGkyPCGhaexiqPRskfGWpcXqMm+Kjmbs3UFlZyiojD3DZwxd eYaO6YaNDzh5wqjnyT5gFiyjNvgRO4KlgpiXmehkwGOwVbnPbKuo+3xzvkOqEEpID7 FOFTikOGbgBdg== Received: by pali.im (Postfix) id 51ACA849; Fri, 18 Jun 2021 15:27:35 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Lokesh Vutla Cc: Ivaylo Dimitrov , Merlijn Wajer , maemo-leste@lists.dyne.org, u-boot@lists.denx.de Subject: [PATCH 1/2] Nokia RX-51: Add support for booting kernel in zImage format Date: Fri, 18 Jun 2021 15:27:03 +0200 Message-Id: <20210618132704.32066-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Enable U-Boot bootz command and update env scripts to try loading also zImage file and to try booting via bootz command. Update also lowlevel_init.S code for checking validity of zImage magic to correctly relocate kernel in zImage format. This change allows U-Boot to directly boot Linux kernel without need for converting kernel image into U-Boot uImage format. Signed-off-by: Pali Rohár --- board/nokia/rx51/lowlevel_init.S | 12 ++++- configs/nokia_rx51_defconfig | 1 + doc/README.nokia_rx51 | 10 +++-- include/configs/nokia_rx51.h | 11 +++-- test/nokia_rx51_test.sh | 76 +++++++++++++++++++++++++++----- 5 files changed, 91 insertions(+), 19 deletions(-) diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S index 1466d976fc4b..11c2cbef89a6 100644 --- a/board/nokia/rx51/lowlevel_init.S +++ b/board/nokia/rx51/lowlevel_init.S @@ -27,6 +27,9 @@ imagesize: /* maximal size of image */ ih_magic: /* IH_MAGIC in big endian from include/image.h */ .word 0x56190527 +z_magic: /* LINUX_ARM_ZIMAGE_MAGIC */ + .word 0x016f2818 + /* * Routine: save_boot_params (called after reset from start.S) * Description: Copy attached kernel to address KERNEL_ADDRESS @@ -75,6 +78,12 @@ copy_kernel_start: ldr r4, [r0] /* r4 - 4 bytes header of kernel */ ldr r5, ih_magic /* r5 - IH_MAGIC */ cmp r4, r5 + beq copy_kernel_loop + + /* check for valid kernel zImage */ + ldr r4, [r0, #36] /* r4 - 4 bytes header of kernel at offset 36 */ + ldr r5, z_magic /* r5 - LINUX_ARM_ZIMAGE_MAGIC */ + cmp r4, r5 bne copy_kernel_end /* skip if invalid image */ copy_kernel_loop: @@ -85,7 +94,8 @@ copy_kernel_loop: copy_kernel_end: mov r5, #0 - str r5, [r0] /* remove 4 bytes header of kernel */ + str r5, [r0] /* remove 4 bytes header of kernel uImage */ + str r5, [r0, #36] /* remove 4 bytes header of kernel zImage */ /* Fix u-boot code */ diff --git a/configs/nokia_rx51_defconfig b/configs/nokia_rx51_defconfig index 061f5c357c46..981e6f95cb1f 100644 --- a/configs/nokia_rx51_defconfig +++ b/configs/nokia_rx51_defconfig @@ -18,6 +18,7 @@ CONFIG_CONSOLE_MUX=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="Nokia RX-51 # " # CONFIG_CMD_BDI is not set +CONFIG_CMD_BOOTZ=y # CONFIG_BOOTM_NETBSD is not set # CONFIG_BOOTM_PLAN9 is not set # CONFIG_BOOTM_RTEMS is not set diff --git a/doc/README.nokia_rx51 b/doc/README.nokia_rx51 index 84d1912ddd2b..7f22ed49bd75 100644 --- a/doc/README.nokia_rx51 +++ b/doc/README.nokia_rx51 @@ -11,13 +11,14 @@ a kernel. In order to transparently boot the original kernel, it will be appended to u-boot.bin at 0x40000. NOLO will load the entire image into (random) memory and execute u-boot, which saves hw revision, boot reason and boot mode ATAGs set by NOLO. Then the bootscripts will attempt to load -uImage or boot.scr from a fat, ext2/ext3 or ext4 filesystem in external +uImage, zImage or boot.scr from a fat or ext2/3/4 filesystem on external SD card or internal eMMC memory. If this fails or keyboard is closed then the appended kernel image will be booted using some generated and some stored ATAGs (see boot order). -For generating combined image of u-boot and kernel there is a simple script -called u-boot-gen-combined. It is available in following repository: +For generating combined image of u-boot and kernel (either in uImage or zImage +format) there is a simple script called u-boot-gen-combined. It is available in +following repository: https://github.com/pali/u-boot-maemo @@ -41,7 +42,8 @@ Boot from SD or eMMC in this order: * 1. * 1.1 find boot.scr on first fat partition * 1.2 find uImage on first fat partition - * 1.3 same order for 2. - 4. fat partition + * 1.3 find zImage on first fat partition + * 1.4 same order for 2. - 4. fat partition * 2. same as 1. but for ext2/3 partition * 3. same as 1. but for ext4 partition diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h index fe991ea03991..742c1a646545 100644 --- a/include/configs/nokia_rx51.h +++ b/include/configs/nokia_rx51.h @@ -129,12 +129,14 @@ int rx51_kp_getc(struct stdio_dev *sdev); "scriptboot=echo Running ${mmcscriptfile} from mmc " \ "${mmcnum}:${mmcpart} ...; source ${scriptaddr}\0" \ "kernboot=echo Booting ${mmckernfile} from mmc " \ - "${mmcnum}:${mmcpart} ...; bootm ${kernaddr}\0" \ + "${mmcnum}:${mmcpart} ...; bootm ${kernaddr} || " \ + "bootz ${kernaddr}\0" \ "kerninitrdboot=echo Booting ${mmckernfile} ${mmcinitrdfile} from mmc "\ - "${mmcnum}:${mmcpart} ...; bootm ${kernaddr} ${initrdaddr}\0" \ + "${mmcnum}:${mmcpart} ...; bootm ${kernaddr} ${initrdaddr} || " \ + "bootz ${kernaddr} ${initrdaddr}\0" \ "attachboot=echo Booting attached kernel image ...;" \ "setenv setup_omap_atag 1;" \ - "bootm ${attkernaddr};" \ + "bootm ${attkernaddr} || bootz ${attkernaddr};" \ "setenv setup_omap_atag\0" \ "trymmcscriptboot=if run switchmmc; then " \ "if run scriptload; then " \ @@ -154,7 +156,8 @@ int rx51_kp_getc(struct stdio_dev *sdev); "fi; " \ "fi\0" \ "trymmcpartboot=setenv mmcscriptfile boot.scr; run trymmcscriptboot;" \ - "setenv mmckernfile uImage; run trymmckernboot\0" \ + "setenv mmckernfile uImage; run trymmckernboot;" \ + "setenv mmckernfile zImage; run trymmckernboot\0" \ "trymmcallpartboot=setenv mmcpart 1; run trymmcpartboot;" \ "setenv mmcpart 2; run trymmcpartboot;" \ "setenv mmcpart 3; run trymmcpartboot;" \ diff --git a/test/nokia_rx51_test.sh b/test/nokia_rx51_test.sh index ee45e8d6dd58..176719e28b7e 100755 --- a/test/nokia_rx51_test.sh +++ b/test/nokia_rx51_test.sh @@ -159,7 +159,7 @@ setenv bootdelay 1; EOF ./mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n bootmenu_uboot -d bootmenu_uboot bootmenu_uboot.scr -# Generate bootmenu for eMMC booting +# Generate bootmenu for eMMC booting (uImage) cat > bootmenu_emmc << EOF setenv bootmenu_0 'uImage-2.6.28-omap1 from eMMC=setenv mmcnum 1; setenv mmcpart 1; setenv mmctype fat; setenv bootargs; setenv setup_omap_atag 1; setenv mmckernfile uImage-2.6.28-omap1; run trymmckernboot'; setenv bootmenu_1; @@ -168,6 +168,15 @@ setenv bootdelay 1; EOF ./mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n bootmenu_emmc -d bootmenu_emmc bootmenu_emmc.scr +# Generate bootmenu for eMMC booting (zImage) +cat > bootmenu_emmc2 << EOF +setenv bootmenu_0 'zImage-2.6.28-omap1 from eMMC=setenv mmcnum 1; setenv mmcpart 1; setenv mmctype fat; setenv bootargs; setenv setup_omap_atag 1; setenv mmckernfile zImage-2.6.28-omap1; run trymmckernboot'; +setenv bootmenu_1; +setenv bootmenu_delay 1; +setenv bootdelay 1; +EOF +./mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n bootmenu_emmc2 -d bootmenu_emmc2 bootmenu_emmc2.scr + # Generate bootmenu for OneNAND booting cat > bootmenu_nand << EOF setenv bootmenu_0 'uImage-2.6.28-omap1 from OneNAND=mtd read initfs \${kernaddr}; setenv bootargs; setenv setup_omap_atag 1; bootm \${kernaddr}'; @@ -177,10 +186,18 @@ setenv bootdelay 1; EOF ./mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n bootmenu_nand -d bootmenu_nand bootmenu_nand.scr +# Generate bootmenu for default booting +cat > bootmenu_default << EOF +setenv bootmenu_delay 1; +setenv bootdelay 1; +EOF +./mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n bootmenu_default -d bootmenu_default bootmenu_default.scr + # Generate combined image from u-boot and Maemo fiasco kernel dd if=kernel_2.6.28/boot/zImage-2.6.28-20103103+0m5.fiasco of=zImage-2.6.28-omap1 skip=95 bs=1 +./u-boot-gen-combined u-boot.bin zImage-2.6.28-omap1 combined_zimage.bin ./mkimage -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n zImage-2.6.28-omap1 -d zImage-2.6.28-omap1 uImage-2.6.28-omap1 -./u-boot-gen-combined u-boot.bin uImage-2.6.28-omap1 combined.bin +./u-boot-gen-combined u-boot.bin uImage-2.6.28-omap1 combined_uimage.bin # Generate combined hack image from u-boot and Maemo fiasco kernel (kernel starts at 2MB offset and qflasher puts 2kB header before supplied image) cp u-boot.bin combined_hack.bin @@ -191,24 +208,37 @@ truncate -s 50MiB emmc_uboot.img mformat -m 0xf8 -F -h 4 -s 16 -c 1 -t $((50*1024*1024/(4*16*512))) :: -i emmc_uboot.img mcopy bootmenu_uboot.scr ::/bootmenu.scr -i emmc_uboot.img -# Generate FAT32 eMMC image for eMMC booting +# Generate FAT32 eMMC image for eMMC booting (uImage) truncate -s 50MiB emmc_emmc.img mformat -m 0xf8 -F -h 4 -s 16 -c 1 -t $((50*1024*1024/(4*16*512))) :: -i emmc_emmc.img mcopy uImage-2.6.28-omap1 ::/uImage-2.6.28-omap1 -i emmc_emmc.img mcopy bootmenu_emmc.scr ::/bootmenu.scr -i emmc_emmc.img +# Generate FAT32 eMMC image for eMMC booting (zImage) +truncate -s 50MiB emmc_emmc2.img +mformat -m 0xf8 -F -h 4 -s 16 -c 1 -t $((50*1024*1024/(4*16*512))) :: -i emmc_emmc2.img +mcopy zImage-2.6.28-omap1 ::/zImage-2.6.28-omap1 -i emmc_emmc2.img +mcopy bootmenu_emmc2.scr ::/bootmenu.scr -i emmc_emmc2.img + # Generate FAT32 eMMC image for OneNAND booting truncate -s 50MiB emmc_nand.img mformat -m 0xf8 -F -h 4 -s 16 -c 1 -t $((50*1024*1024/(4*16*512))) :: -i emmc_nand.img mcopy bootmenu_nand.scr ::/bootmenu.scr -i emmc_nand.img +# Generate FAT32 eMMC image for default booting +truncate -s 50MiB emmc_default.img +mformat -m 0xf8 -F -h 4 -s 16 -c 1 -t $((50*1024*1024/(4*16*512))) :: -i emmc_default.img +mcopy bootmenu_default.scr ::/bootmenu.scr -i emmc_default.img + # Generate MTD image for U-Boot serial console testing rm -f mtd_uboot.img ./qflasher -v -x xloader-qemu.bin -s secondary-qemu.bin -k u-boot.bin -m rx51 -o mtd_uboot.img # Generate MTD image for RAM booting from bootloader nolo images, compiled image and rootfs image rm -f mtd_ram.img -./qflasher -v -x xloader-qemu.bin -s secondary-qemu.bin -k combined.bin -r ubi.img -m rx51 -o mtd_ram.img +./qflasher -v -x xloader-qemu.bin -s secondary-qemu.bin -k combined_uimage.bin -r ubi.img -m rx51 -o mtd_ram.img +rm -f mtd_ram2.img +./qflasher -v -x xloader-qemu.bin -s secondary-qemu.bin -k combined_zimage.bin -r ubi.img -m rx51 -o mtd_ram2.img # Generate MTD image for eMMC booting from bootloader nolo images, u-boot image and rootfs image rm -f mtd_emmc.img @@ -238,7 +268,7 @@ wait -n $sleep_pid $qemu_pid || true kill -9 $tail_pid $sleep_pid $qemu_pid 2>/dev/null || true wait || true -# Run MTD image in qemu and wait for 300s if kernel from RAM is correctly booted +# Run MTD image in qemu and wait for 300s if uImage kernel from RAM is correctly booted rm -f qemu_ram.log ./qemu-system-arm -M n900 -mtdblock mtd_ram.img -serial /dev/stdout -display none > qemu_ram.log & qemu_pid=$! @@ -250,7 +280,19 @@ wait -n $sleep_pid $qemu_pid || true kill -9 $tail_pid $sleep_pid $qemu_pid 2>/dev/null || true wait || true -# Run MTD image in qemu and wait for 300s if kernel from eMMC is correctly booted +# Run MTD image in qemu and wait for 300s if zImage kernel from RAM is correctly booted +rm -f qemu_ram2.log +./qemu-system-arm -M n900 -mtdblock mtd_ram2.img -sd emmc_default.img -serial /dev/stdout -display none > qemu_ram2.log & +qemu_pid=$! +tail -F qemu_ram2.log & +tail_pid=$! +sleep 300 & +sleep_pid=$! +wait -n $sleep_pid $qemu_pid || true +kill -9 $tail_pid $sleep_pid $qemu_pid 2>/dev/null || true +wait || true + +# Run MTD image in qemu and wait for 300s if uImage kernel from eMMC is correctly booted rm -f qemu_emmc.log ./qemu-system-arm -M n900 -mtdblock mtd_emmc.img -sd emmc_emmc.img -serial /dev/stdout -display none > qemu_emmc.log & qemu_pid=$! @@ -262,6 +304,18 @@ wait -n $sleep_pid $qemu_pid || true kill -9 $tail_pid $sleep_pid $qemu_pid 2>/dev/null || true wait || true +# Run MTD image in qemu and wait for 300s if zImage kernel from eMMC is correctly booted +rm -f qemu_emmc2.log +./qemu-system-arm -M n900 -mtdblock mtd_emmc.img -sd emmc_emmc2.img -serial /dev/stdout -display none > qemu_emmc2.log & +qemu_pid=$! +tail -F qemu_emmc2.log & +tail_pid=$! +sleep 300 & +sleep_pid=$! +wait -n $sleep_pid $qemu_pid || true +kill -9 $tail_pid $sleep_pid $qemu_pid 2>/dev/null || true +wait || true + # Run MTD image in qemu and wait for 300s if kernel from OneNAND is correctly booted rm -f qemu_nand.log ./qemu-system-arm -M n900 -mtdblock mtd_nand.img -sd emmc_nand.img -serial /dev/stdout -display none > qemu_nand.log & @@ -281,13 +335,15 @@ echo "=============================" echo if grep -q 'Successfully booted' qemu_uboot.log; then echo "U-Boot serial console is working"; else echo "U-Boot serial console test failed"; fi -if grep -q 'Successfully booted' qemu_ram.log; then echo "Kernel was successfully booted from RAM"; else echo "Failed to boot kernel from RAM"; fi -if grep -q 'Successfully booted' qemu_emmc.log; then echo "Kernel was successfully booted from eMMC"; else echo "Failed to boot kernel from eMMC"; fi -if grep -q 'Successfully booted' qemu_nand.log; then echo "Kernel was successfully booted from OneNAND"; else echo "Failed to boot kernel from OneNAND"; fi +if grep -q 'Successfully booted' qemu_ram.log; then echo "Kernel (uImage) was successfully booted from RAM"; else echo "Failed to boot kernel (uImage) from RAM"; fi +if grep -q 'Successfully booted' qemu_ram2.log; then echo "Kernel (zImage) was successfully booted from RAM"; else echo "Failed to boot kernel (zImage) from RAM"; fi +if grep -q 'Successfully booted' qemu_emmc.log; then echo "Kernel (uImage) was successfully booted from eMMC"; else echo "Failed to boot kernel (uImage) from eMMC"; fi +if grep -q 'Successfully booted' qemu_emmc2.log; then echo "Kernel (zImage) was successfully booted from eMMC"; else echo "Failed to boot kernel (zImage) from eMMC"; fi +if grep -q 'Successfully booted' qemu_nand.log; then echo "Kernel (uImage) was successfully booted from OneNAND"; else echo "Failed to boot kernel (uImage) from OneNAND"; fi echo -if grep -q 'Successfully booted' qemu_uboot.log && grep -q 'Successfully booted' qemu_ram.log && grep -q 'Successfully booted' qemu_emmc.log && grep -q 'Successfully booted' qemu_nand.log; then +if grep -q 'Successfully booted' qemu_uboot.log && grep -q 'Successfully booted' qemu_ram.log && grep -q 'Successfully booted' qemu_ram2.log && grep -q 'Successfully booted' qemu_emmc.log && grep -q 'Successfully booted' qemu_emmc2.log && grep -q 'Successfully booted' qemu_nand.log; then echo "All tests passed" exit 0 else From patchwork Fri Jun 18 13:27:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1494279 X-Patchwork-Delegate: lokeshvutla@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=SXihQhTt; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G609B3KqZz9sPf for ; Fri, 18 Jun 2021 23:27:56 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E26BF82B89; Fri, 18 Jun 2021 15:27:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="SXihQhTt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E76DA82BBC; Fri, 18 Jun 2021 15:27:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E146182B64 for ; Fri, 18 Jun 2021 15:27:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 5AD71613F0; Fri, 18 Jun 2021 13:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624022859; bh=An0KA/ZgWkETB9EtVeZ+D2EDslymAwG9jSOM4eTje50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SXihQhTtefK/4KMoQB2vyCtY5NZsbiqFFkED/LLARGvYJ39UV5REAEdA0Ep0xxFF5 5K14M5+4NUwtvB+l8KGj+N+5nali/AmN6GdeXclIH97AaK3jZTyMqQeAmWe1HNmcFk tuhrybJiLS4MmUbvr4QdRNmoCm/hn7t5/tlJNavEr8rn3zSAouomzie57Yish7piRy Fqb+rXrWwGOkCgv9HYeIlVfen7rHkZui5hmt7MwNjSBPwBBpc7hp33ysi8VqoDl/jy OhvcpKcxffJpxqDstyE/DjpD9X56661rXLVQJMuArGOMhYbY5rLspFU05RpdET5TIq bNIu5t6PR11AA== Received: by pali.im (Postfix) id 8111EB0B; Fri, 18 Jun 2021 15:27:37 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Lokesh Vutla Cc: Ivaylo Dimitrov , Merlijn Wajer , maemo-leste@lists.dyne.org, u-boot@lists.denx.de Subject: [PATCH 2/2] Nokia RX-51: Load bootmenu also from uSD card Date: Fri, 18 Jun 2021 15:27:04 +0200 Message-Id: <20210618132704.32066-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210618132704.32066-1-pali@kernel.org> References: <20210618132704.32066-1-pali@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean By default bootmenu is loaded only from eMMC. After this change U-Boot first tries to load bootmenu from uSD card and if it fails then fallback to eMMC. People want to boot alternative OS from removable uSD without need to modify eMMC content. So this backward compatible change allows it. Part of this change is also optimization of trymmc* macros so they can be used in preboot macro for loading bootmenu. Signed-off-by: Pali Rohár --- include/configs/nokia_rx51.h | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h index 742c1a646545..7ef25ea8389c 100644 --- a/include/configs/nokia_rx51.h +++ b/include/configs/nokia_rx51.h @@ -138,23 +138,10 @@ int rx51_kp_getc(struct stdio_dev *sdev); "setenv setup_omap_atag 1;" \ "bootm ${attkernaddr} || bootz ${attkernaddr};" \ "setenv setup_omap_atag\0" \ - "trymmcscriptboot=if run switchmmc; then " \ - "if run scriptload; then " \ - "run scriptboot;" \ - "fi;" \ - "fi\0" \ - "trymmckernboot=if run switchmmc; then " \ - "if run kernload; then " \ - "run kernboot;" \ - "fi;" \ - "fi\0" \ - "trymmckerninitrdboot=if run switchmmc; then " \ - "if run initrdload; then " \ - "if run kernload; then " \ - "run kerninitrdboot;" \ - "fi;" \ - "fi; " \ - "fi\0" \ + "trymmcscriptboot=run switchmmc && run scriptload && run scriptboot\0" \ + "trymmckernboot=run switchmmc && run kernload && run kernboot\0" \ + "trymmckerninitrdboot=run switchmmc && run initrdload && " \ + "run kernload && run kerninitrdboot\0" \ "trymmcpartboot=setenv mmcscriptfile boot.scr; run trymmcscriptboot;" \ "setenv mmckernfile uImage; run trymmckernboot;" \ "setenv mmckernfile zImage; run trymmckernboot\0" \ @@ -170,15 +157,11 @@ int rx51_kp_getc(struct stdio_dev *sdev); "fi\0" \ "emmcboot=setenv mmcnum 1; run trymmcboot\0" \ "sdboot=setenv mmcnum 0; run trymmcboot\0" \ - "preboot=setenv mmcnum 1; setenv mmcpart 1;" \ - "setenv mmcscriptfile bootmenu.scr;" \ - "if run switchmmc; then " \ - "setenv mmctype fat;" \ - "if run scriptload; then run scriptboot; else " \ - "setenv mmctype ext4;" \ - "if run scriptload; then run scriptboot; fi;" \ - "fi;" \ - "fi;" \ + "trymmcbootmenu=setenv mmctype fat && run trymmcscriptboot || " \ + "setenv mmctype ext4 && run trymmcscriptboot\0" \ + "preboot=setenv mmcpart 1; setenv mmcscriptfile bootmenu.scr;" \ + "setenv mmcnum 0 && run trymmcbootmenu || " \ + "setenv mmcnum 1 && run trymmcbootmenu;" \ "if run slide; then true; else " \ "setenv bootmenu_delay 0;" \ "setenv bootdelay 0;" \