e11c3cbe26
Since the ubi/ubifs test has been introduced, it's not possible to
boot the same ubi image twice [1]:
"TODO: if you boot Qemu twice on the same UBI image, it fails to
attach the image the second time, with "ubi0 error:
ubi_read_volume_table: the layout volume was not found"."
For some reason, the kernel corrupt the ubi image if the ubifs
rootfs is mounted with write access. Use a custom config file
to mount the rootfs readonly (vol_type=static). Doing so requires
to add the flash size (vol_size=64MiB).
At least it allows to boot several times the same ubi image.
[1] bf4a6490e4
Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
import subprocess
|
|
import os
|
|
|
|
import infra.basetest
|
|
|
|
|
|
class TestUbi(infra.basetest.BRTest):
|
|
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
|
"""
|
|
BR2_TARGET_ROOTFS_UBIFS=y
|
|
BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x3ff80
|
|
BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x1
|
|
BR2_TARGET_ROOTFS_UBI=y
|
|
BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x40000
|
|
BR2_TARGET_ROOTFS_UBI_SUBSIZE=1
|
|
BR2_TARGET_ROOTFS_UBI_USE_CUSTOM_CONFIG=y
|
|
BR2_TARGET_ROOTFS_UBI_CUSTOM_CONFIG_FILE="{}"
|
|
""".format(
|
|
infra.filepath("tests/fs/test_ubi/ubinize_qemu_pflash_cfi01.cfg"))
|
|
|
|
def test_run(self):
|
|
img = os.path.join(self.builddir, "images", "rootfs.ubi")
|
|
out = infra.run_cmd_on_host(self.builddir, ["file", img])
|
|
out = out.splitlines()
|
|
self.assertIn("UBI image, version 1", out[0])
|
|
|
|
subprocess.call(["truncate", "-s 64M", img])
|
|
|
|
self.emulator.boot(arch="armv7",
|
|
kernel="builtin",
|
|
kernel_cmdline=["root=ubi0:rootfs",
|
|
"ubi.mtd=0",
|
|
"rootfstype=ubifs"],
|
|
options=["-drive", "file={},if=pflash,format=raw".format(img)])
|
|
self.emulator.login()
|
|
cmd = "mount | grep 'ubi0:rootfs on / type ubifs'"
|
|
_, exit_code = self.emulator.run(cmd)
|
|
self.assertEqual(exit_code, 0)
|