0

我有一个带有 Barebox(部分)功能的定制 iMX 6UL 板。我有一个 Semper s25hs512t Flash 被检测到(在添加必要的设备 ID indrivers/mtd/spi-nor/spi-nor.c 之后)

问题 - 我的主板没有以太网或可移动 SD。我需要在 s25hs512 上刻录引导加载程序/闪存。我需要相应地格式化闪存并复制上面的文件。

我的 dtsi 有

&qspi {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_qspi>;
        status = "okay";

        flash0: s25hs512t@0 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "spansion,s25hs512t", "jedec,spi-nor";
                spi-max-frequency = <40000000>;
                spi-rx-bus-width = <4>;
                spi-tx-bus-width = <4>;
                reg = <0>;
                spi-mode = <0>;
                m25p,fast-read;
                status = "okay";

                partition@0 {
                        label = "barebox";
                        reg = <0x00000000 0x00100000>;
                };
                partition@1 {
                        label = "barebox-env";
                        reg = <0x00100000 0x00040000>;
                };
                partition@2 {
                        label = "barebox-of";
                        reg = <0x00140000 0x00040000>;
                };
                partition@3 {
                        label = "kernel";
                        reg = <0x00180000 0x00800000>;
                };
                partition@4 {
                        label = "root";
                        reg = <0x00980000 0x03640000>;
                };

        };
};

在启动时,barebox 检测到闪存

Board: Freescale i.MX6 UltraLite Caisteal Board
detected i.MX6 UltraLite revision 1.0
i.MX6 UltraLite unique ID: 241e09d4e317402a
m25p80 s25hs512t@00: s25hs512t (65536 Kbytes).  <=====
imx-esdhc 2194000.mmc@2194000.of: registered as mmc1
rng_self_test: RNG software self-test passed
caam 2140000.crypto@2140000.of: Instantiated RNG4 SH0
caam 2140000.crypto@2140000.of: Instantiated RNG4 SH1
malloc space: 0x8eefcf80 -> 0x9ddf9eff (size 239 MiB)
barebox-environment chosen:environment.of: probe failed: No such file or directory

开发信息显示

         `-- 21e0000.spi@21e0000.of
            `-- s25hs512t@00
               `-- m25p0
                  `-- 0x00000000-0x03ffffff (    64 MiB): /dev/m25p0
                  `-- m25p0.barebox
                     `-- 0x00000000-0x000fffff (     1 MiB): /dev/m25p0.barebox
                  `-- m25p0.barebox-env
                     `-- 0x00000000-0x0003ffff (   256 KiB): /dev/m25p0.barebox-env
                  `-- m25p0.barebox-of
                     `-- 0x00000000-0x0003ffff (   256 KiB): /dev/m25p0.barebox-of
                  `-- m25p0.kernel
                     `-- 0x00000000-0x007fffff (     8 MiB): /dev/m25p0.kernel
                  `-- m25p0.root
                     `-- 0x00000000-0x0363ffff (  54.3 MiB): /dev/m25p0.root

但是当我运行 ubiformat 时,我奇怪地得到了这个

barebox@Freescale i.MX6 UltraLite Caisteal Board:/ ubiformat /dev/m25p0.barebox -y
ubiformat: m25p0.barebox (nor), size 1048576 bytes (1 MiB), 4 eraseblocks of 262144 bytes (256 KiB), min. I/O size 1 bytes
libscan: scanning eraseblock 3 -- 100 % complete  
ubiformat: 1 eraseblocks are supposedly empty
ubiformat: warning!: 3 of 4 eraseblocks contain non-ubifs data
ubiformat: warning!: only 0 of 4 eraseblocks have valid erase counter
ubiformat: erase counter 0 will be used for all eraseblocks
ubiformat: note, arbitrary erase counter value may be specified using -e option
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: formatting eraseblock 3 -- 100 % complete  
ERROR: m25p80 s25hs512t@00: flash operation timed out
ERROR: m25p0.barebox: error -110 while writing 262144 bytes to PEB 0:0, written 0 bytes
libubigen: error!: cannot write 262144 bytes
ubiformat: error!: cannot write layout volume
ubiformat: Operation not permitted

有什么办法吗?

PS:更新感谢@TrentP 的帮助-我只专注于格式化较大的分区,以便我可以编写内核和根分区。但我一直无法挂载 ubi 分区。我收到以下问题(只读文件系统)

barebox@Freescale i.MX6 UltraLite Caisteal Board:/ erase /dev/m25p0.kernel 

barebox@Freescale i.MX6 UltraLite Caisteal Board:/ ubiattach /dev/m25p0.kernel 
NOTICE: ubi0: scanning is finished
NOTICE: ubi0: empty MTD device detected
NOTICE: ubi0: registering /dev/m25p0.kernel.ubi
NOTICE: ubi0: attached mtd0 (name "m25p0.kernel", size 8 MiB) to ubi0
NOTICE: ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 262016 bytes
NOTICE: ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1
NOTICE: ubi0: VID header offset: 64 (aligned 64), data offset: 128
NOTICE: ubi0: good PEBs: 32, bad PEBs: 0, corrupted PEBs: 0
NOTICE: ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
NOTICE: ubi0: max/mean erase counter: 1/0, WL threshold: 65536, image sequence number: 1700878141
NOTICE: ubi0: available PEBs: 28, total reserved PEBs: 4, PEBs reserved for bad PEB handling: 0

barebox@Freescale i.MX6 UltraLite Caisteal Board:/ ubimkvol /dev/m25p0.kernel.ubi kernel 0
NOTICE: ubi0: registering kernel as /dev/m25p0.kernel.ubi.kernel


barebox@Freescale i.MX6 UltraLite Caisteal Board:/ mount -t ubifs /dev/m25p0.kernel.ubi.kernel  /mnt/kernel/
ERROR: UBIFS error (ubi0:0): 9de5a2d5: can't format empty UBI volume: read-only mount
ERROR: ubifs ubifs0: probe failed: Read-only file system
mount: Invalid argument

如果我使用 ubiformat 我会得到这个

barebox@Freescale i.MX6 UltraLite Caisteal Board:/ ubiformat /dev/m25p0.kernel -y
ubiformat: m25p0.kernel (nor), size 8388608 bytes (8 MiB), 32 eraseblocks of 262144 bytes (256 KiB), min. I/O size 1 bytes
libscan: scanning eraseblock 31 -- 100 % complete  
ubiformat: warning!: 32 of 32 eraseblocks contain non-ubifs data
ubiformat: warning!: only 0 of 32 eraseblocks have valid erase counter
ubiformat: erase counter 0 will be used for all eraseblocks
ubiformat: note, arbitrary erase counter value may be specified using -e option
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: formatting eraseblock 31 -- 100 % complete  
barebox@Freescale i.MX6 UltraLite Caisteal Board:/ ubiattach /dev/m25p0.kernel 
NOTICE: ubi0: scanning is finished
ERROR: ubi0 error: ubi_read_volume_table: the layout volume was not found
ERROR: ubi0 error: ubi_attach_mtd_dev: failed to attach mtd0, error -22
failed to attach: Invalid argument

开发信息

Parent: m25p0.kernel
Parameters:
  available_pebs: 0 (type: uint32)
  bad_peb_count: 0 (type: uint32)
  good_peb_count: 32 (type: uint32)
  leb_size: 262016 (type: uint32)
  max_erase_counter: 2 (type: uint32)
  mean_erase_counter: 0 (type: uint32)
  min_io_size: 1 (type: uint32)
  peb_size: 262144 (type: uint32)
  reserved_pebs: 32 (type: uint32) <=== why all PEBs are reserved?
  sub_page_size: 1 (type: uint32)
  vid_header_offset: 64 (type: uint32)

关于我做错了什么的任何建议。我知道它非常简单。只是我不知道

4

1 回答 1

2

您不应该在 barebox 分区上使用 ubiformat。太小了。这就是它失败的原因。

UBI 是一个 Linux 层,用于将 UBI 文件系统放入 NAND 或 NOR 闪存。iMX6UL CPU 启动 ROM 不理解 UBI。它无法在 UBI 格式的分区中启动某些东西。它用于root分区中的根文件系统。

阅读 iMX6UL 参考手册的第 8 节,尤其是关于 QuadSPI 引导的第 8.6 节。这将告诉您必须放入闪存以使其可启动的内容。

另请查看该barebox_update命令,该命令可用于从 Barebox 刷新引导加载程序。董事会需要支持它,我不知道你的董事会。代码在各种imx6_bbu_*功能中。我不确定是否支持 qspi,因为我只看到 eMMC/SD、eMMC 启动、NAND 和 I2C/SPI。qspi 接口与 eCSPI 控制器之一上的串行 EEPROM 不同(再次参见 RM §8!)。但也许它可以与图像上已有的适当标题一起使用。

于 2021-09-01T06:10:27.557 回答