6f9e83f5f7
The size of the cfi flash device emulated by Qemu is 64M not 128M [1]. Since Qemu >= 4.0, the size of the device must match the size of the block backend [2]. Fixes: qemu-system-arm: device requires 67108864 bytes, block backend provides 134217728 bytes [1] https://git.qemu.org/?p=qemu.git;a=blob;f=hw/arm/vexpress.c;h=58481c07629aedb09864dcc72757ff7947e733bb;hb=f9baca549e44791be0dd98de15add3d8452a8af0#l50 [2] https://git.qemu.org/?p=qemu.git;a=commitdiff;h=06f1521795207359a395996c253c306f4ab7586e Signed-off-by: Romain Naour <romain.naour@gmail.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
40 lines
1.4 KiB
Python
40 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=0x7ff80
|
|
BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x1
|
|
BR2_TARGET_ROOTFS_UBI=y
|
|
BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x80000
|
|
BR2_TARGET_ROOTFS_UBI_SUBSIZE=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".
|
|
# To be investigated.
|
|
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(img)])
|
|
self.emulator.login()
|
|
cmd = "mount | grep 'ubi0:rootfs on / type ubifs'"
|
|
_, exit_code = self.emulator.run(cmd)
|
|
self.assertEqual(exit_code, 0)
|