From cc434fccba4ccf8e3645346f3ae49e7b33733dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Fri, 18 Jun 2021 15:27:03 +0200 Subject: Nokia RX-51: Add support for booting kernel in zImage format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Lokesh Vutla Link: https://lore.kernel.org/r/20210618132704.32066-1-pali@kernel.org --- test/nokia_rx51_test.sh | 76 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/nokia_rx51_test.sh b/test/nokia_rx51_test.sh index ff840c1e6c..a1436543fb 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 -- cgit v1.2.3 From 652982309d316b14aae5805d09239f89eb89f038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Fri, 18 Jun 2021 15:31:08 +0200 Subject: Nokia RX-51: Add check for /lib/ld-linux.so.2 in test script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unfortunately for testing is required qflasher which works only in 32-bit x86 mode. Apparently 64-bit x86 Azure CI has no problems as it has preinstalled 32-bit libraries and can execute also 32-bit x86 executables. This change just show human readable output why nokia_rx51_test.sh test script fails. Signed-off-by: Pali Rohár Signed-off-by: Lokesh Vutla Link: https://lore.kernel.org/r/20210618133108.32497-1-pali@kernel.org --- test/nokia_rx51_test.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/nokia_rx51_test.sh b/test/nokia_rx51_test.sh index a1436543fb..28aa554ed8 100755 --- a/test/nokia_rx51_test.sh +++ b/test/nokia_rx51_test.sh @@ -18,6 +18,7 @@ echo ' mformat (from mtools, homepage http://www.gnu.org/software/mtools/) /usr/sbin/mkfs.ubifs (from mtd-utils, homepage http://www.linux-mtd.infradead.org/) /usr/sbin/ubinize (from mtd-utils, homepage http://www.linux-mtd.infradead.org/) + /lib/ld-linux.so.2 (32-bit x86 version of LD loader, needed for qflasher) ' | while read tool info; do if test -z "$tool"; then continue; fi if ! which $tool 1>/dev/null 2>&1; then -- cgit v1.2.3