From: "Pali Rohár" <pali@kernel.org>
To: u-boot@lists.denx.de
Subject: [PATCH 9/9] Nokia RX-51: Add booting from UBI into test script
Date: Sun, 4 Sep 2022 03:29:06 +0200 [thread overview]
Message-ID: <20220904012906.17718-10-pali@kernel.org> (raw)
In-Reply-To: <20220904012906.17718-1-pali@kernel.org>
Compile U-Boot with UBI/UBIFS support according to doc/board/nokia/rx51.rst
instructions and add test case for loading kernel image from UBI volume.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
test/nokia_rx51_test.sh | 89 +++++++++++++++++++++++++++++++++--------
1 file changed, 73 insertions(+), 16 deletions(-)
diff --git a/test/nokia_rx51_test.sh b/test/nokia_rx51_test.sh
index fc5fe1c911a9..c392f4784f0f 100755
--- a/test/nokia_rx51_test.sh
+++ b/test/nokia_rx51_test.sh
@@ -34,7 +34,18 @@ echo "========== Compiling U-Boot for Nokia RX-51 board =========="
echo "============================================================"
echo
-# First compile u-boot.bin binary for Nokia RX-51 board
+# First compile u-boot-ubifs.bin binary with UBI/UBIFS support for Nokia RX-51 board according to doc/board/nokia/rx51.rst
+make nokia_rx51_config
+cat >> .config << EOF
+CONFIG_CMD_UBI=y
+CONFIG_CMD_UBIFS=y
+CONFIG_MTD_UBI_BEB_LIMIT=10
+EOF
+make olddefconfig
+make -j4 u-boot.bin CROSS_COMPILE=arm-linux-gnueabi-
+mv u-boot.bin u-boot-ubifs.bin
+
+# Then compile standard u-boot.bin binary for Nokia RX-51 board
make nokia_rx51_config
make -j4 u-boot.bin CROSS_COMPILE=arm-linux-gnueabi-
@@ -44,6 +55,7 @@ cd nokia_rx51_tmp
test -f mkimage || ln -s ../tools/mkimage .
test -f u-boot.bin || ln -s ../u-boot.bin .
+test -f u-boot-ubifs.bin || ln -s ../u-boot-ubifs.bin .
echo
echo "=========================================================================="
@@ -123,20 +135,7 @@ echo
EOF
chmod +x rootfs/sbin/preinit
-# Generate ubi config file for ubi rootfs image
-cat > ubi.ini << EOF
-[rootfs]
-mode=ubi
-image=ubifs.img
-vol_id=0
-vol_size=230MiB # 1870 LEBs
-vol_type=dynamic
-vol_name=rootfs
-vol_alignment=1
-vol_flags=autoresize
-EOF
-
-# Generate ubi rootfs image from rootfs directory
+# Generate ubifs image from rootfs directory
# NOTE: Character device on host filesystem can be created only by root
# But we do not need it on host filesystem, just in ubifs image
# So run mknod and mkfs.ubifs commands under fakeroot program
@@ -149,8 +148,35 @@ fakeroot sh -c '
mknod rootfs/dev/console c 5 1;
/usr/sbin/mkfs.ubifs -m 2048 -e 129024 -c 2047 -r rootfs ubifs.img;
'
+
+# Generate ubi image with rootfs on first volume
+cat > ubi.ini << EOF
+[rootfs]
+mode=ubi
+image=ubifs.img
+vol_id=0
+vol_size=230MiB # 1870 LEBs
+vol_type=dynamic
+vol_name=rootfs
+vol_alignment=1
+vol_flags=autoresize
+EOF
/usr/sbin/ubinize -o ubi.img -p 128KiB -m 2048 -s 512 ubi.ini
+# Generate ubi image with rootfs on first volume and kernel in zImage format on second volume for UBI booting
+cp ubi.ini ubi_with_kernel.ini
+cat >> ubi_with_kernel.ini << EOF
+[kernel]
+mode=ubi
+image=zImage-2.6.28-omap1
+vol_id=1
+vol_size=2MiB
+vol_type=dynamic
+vol_name=kernel
+vol_alignment=1
+EOF
+/usr/sbin/ubinize -o ubi_with_kernel.img -p 128KiB -m 2048 -s 512 ubi_with_kernel.ini
+
# Generate bootmenu for U-Boot serial console testing
cat > bootmenu_uboot << EOF
setenv bootmenu_0 'Serial console test=echo; echo "Testing serial console"; echo; echo "Successfully booted"; echo; poweroff';
@@ -187,6 +213,15 @@ 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 UBI booting (zImage)
+cat > bootmenu_ubi << EOF
+setenv bootmenu_0 'zImage-2.6.28-omap1 from UBI=setenv bootargs; setenv setup_omap_atag 1; ubi part rootfs && ubi read \${kernaddr} kernel && bootz \${kernaddr}';
+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_ubi -d bootmenu_ubi bootmenu_ubi.scr
+
# Generate bootmenu for default booting
cat > bootmenu_default << EOF
setenv bootmenu_delay 1;
@@ -226,6 +261,11 @@ 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 UBI booting (zImage)
+truncate -s 50MiB emmc_ubi.img
+mformat -m 0xf8 -F -h 4 -s 16 -c 1 -t $((50*1024*1024/(4*16*512))) :: -i emmc_ubi.img
+mcopy bootmenu_ubi.scr ::/bootmenu.scr -i emmc_ubi.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
@@ -251,6 +291,10 @@ rm -f mtd_emmc.img
rm -f mtd_nand.img
./qflasher -v -x xloader-qemu.bin -s secondary-qemu.bin -k combined_hack.bin -r ubi.img -m rx51 -p k=4094,i=2 -o mtd_nand.img
+# Generate MTD image for UBI booting from bootloader nolo images, u-boot image with UBI/UBIFS support and rootfs image with kernel volume
+rm -f mtd_ubi.img
+./qflasher -v -x xloader-qemu.bin -s secondary-qemu.bin -k u-boot-ubifs.bin -r ubi_with_kernel.img -m rx51 -o mtd_ubi.img
+
echo
echo "======================================================"
echo "========== Running test images in n900 qemu =========="
@@ -329,6 +373,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 kernel from UBI is correctly booted
+rm -f qemu_ubi.log
+./qemu-system-arm -M n900 -mtdblock mtd_ubi.img -sd emmc_ubi.img -serial /dev/stdout -display none > qemu_ubi.log &
+qemu_pid=$!
+tail -F qemu_ubi.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
+
echo
echo "============================="
echo "========== Results =========="
@@ -341,10 +397,11 @@ if grep -q 'Successfully booted' qemu_ram2.log; then echo "Kernel (zImage) was s
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
+if grep -q 'Successfully booted' qemu_ubi.log; then echo "Kernel (zImage) was successfully booted from UBI"; else echo "Failed to boot kernel (zImage) from UBI"; fi
echo
-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
+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 && grep -q 'Successfully booted' qemu_ubi.log; then
echo "All tests passed"
exit 0
else
--
2.20.1
next prev parent reply other threads:[~2022-09-04 1:31 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-04 1:28 [PATCH 0/9] Nokia RX-51: Small cleanups and UBI boot test case Pali Rohár
2022-09-04 1:28 ` [PATCH 1/9] Nokia RX-51: Remove label copy_kernel_start from lowlevel_init.S Pali Rohár
2022-09-15 21:54 ` Tom Rini
2022-09-04 1:28 ` [PATCH 2/9] Nokia RX-51: Do not clear unknown memory in lowlevel_init.S Pali Rohár
2022-09-15 21:54 ` Tom Rini
2022-09-04 1:29 ` [PATCH 3/9] Nokia RX-51: Set default SYS_LOAD_ADDR to 0x80008000 Pali Rohár
2022-09-15 21:54 ` Tom Rini
2022-09-04 1:29 ` [PATCH 4/9] Nokia RX-51: Change UBIFS volume size to 1870 LEBs in test script Pali Rohár
2022-09-15 21:55 ` Tom Rini
2022-09-04 1:29 ` [PATCH 5/9] Nokia RX-51: Call bootm in test script only when image is valid Pali Rohár
2022-09-15 21:55 ` Tom Rini
2022-09-04 1:29 ` [PATCH 6/9] Nokia RX-51: Fix documentation how to enable UBI support Pali Rohár
2022-09-15 21:55 ` Tom Rini
2022-09-04 1:29 ` [PATCH 7/9] Nokia RX-51: Do not set useless ARCH= in test script Pali Rohár
2022-09-15 21:55 ` Tom Rini
2022-09-04 1:29 ` [PATCH 8/9] Nokia RX-51: Add comment describing kernel image type into " Pali Rohár
2022-09-15 21:55 ` Tom Rini
2022-09-04 1:29 ` Pali Rohár [this message]
2022-09-15 18:34 ` [PATCH 9/9] Nokia RX-51: Add booting from UBI " Tom Rini
2022-09-15 18:57 ` Pali Rohár
2022-09-15 18:59 ` [PATCH v2] " Pali Rohár
2022-09-15 21:55 ` Tom Rini
2022-09-04 3:01 ` [PATCH 0/9] Nokia RX-51: Small cleanups and UBI boot test case Tony Dinh
2022-09-04 9:37 ` Pali Rohár
2022-09-04 19:28 ` Tony Dinh
2022-09-04 19:56 ` Tony Dinh
2022-09-04 21:58 ` Daniel Golle
2022-09-04 22:10 ` Pali Rohár
2022-09-05 21:35 ` Tony Dinh
2022-09-19 11:12 ` Alexander Dahl
2022-09-19 11:23 ` Pali Rohár
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220904012906.17718-10-pali@kernel.org \
--to=pali@kernel.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.