问题描述
我有一个定制的IMX 6UL板,带有Barebox(部分)功能。检测到Semper s25hs512T闪存(在驱动程序/mtd/spi-nor/spi-nor.c中添加了必要的设备ID后)
问题-我的主板没有以太网或可拆卸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>;
};
};
};
启动时,Bare Box检测到闪存
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
DevInfo显示
`-- 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
DevInfo
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)
任何关于我做错了什么的建议。我知道这件事简单得离谱。我只是不知道
推荐答案
您不应该在赤箱分区上使用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!)。但也许它可以与图像上已有的适当页眉一起工作。