diff --git a/README.md b/README.md index a8bb4be1e5fa25a94913cc882f36273490b33ca4..21a872f0e7e416709a282e1ac23c17173f863e1b 100644 --- a/README.md +++ b/README.md @@ -269,6 +269,8 @@ In my case, I copied the tools produced by U-Boot into the **/tools/u-boot-tools ### Create UBIFS images +[Documentation about the UBI/UBIFS file system](https://elinux.org/images/5/54/Weinberger.pdf) + **First, check that the mtd-utils package (debian and ubuntu) is installed on your host machine.** From the root directory of the PetaLinux project... @@ -287,10 +289,12 @@ $ tar -xzvpf rootfs.tar.gz -C rootfs $ mkdir datafs ``` -Next, the two UBIFS images rootfs and datafs must be +Then, both rootfs and datafs UBIFS images must be created respecting the geometrical configuration of the flash memory. **SF: Detected s25fl256s1 with page size 256 Bytes, erase size 64 KiB, total 32 MiB** +**Information obtained using the sf probe command from U-Boot.** + | QSPI Flash memory size | 33554432 Bytes | |------------------------|----------------| | Page size | 256 Bytes | @@ -299,9 +303,11 @@ Next, the two UBIFS images rootfs and datafs must be |------------------------|----------------| | Max. erase blocks | 512 | +**This information alone is not sufficient. Please refer to subsection [Geometric organisation](#howto-obtain-information-about-the-geometric-organisation-of-the-spi-nor-memory).** + ``` -$ sudo mkfs.ubifs -r ./rootfs -m 1 -e 65408 -c 256 -o rootfs.img -$ sudo mkfs.ubifs -r ./datafs -m 1 -e 65408 -c 32 -o datafs.img +$ sudo mkfs.ubifs -r ./rootfs -m 1 -e 65408 -c 257 -o rootfs.ubifs +$ sudo mkfs.ubifs -r ./datafs -m 1 -e 65408 -c 33 -o datafs.ubifs ``` Next, a configuration file must be created to define the UBI volume. @@ -309,7 +315,7 @@ Next, a configuration file must be created to define the UBI volume. $ echo \ "[datafs-volume] mode=ubi -image=datafs.img +image=datafs.ubifs vol_id=0 vol_size=2MiB vol_type=static @@ -317,7 +323,7 @@ vol_name=datafs [rootfs-volume] mode=ubi -image=rootfs.img +image=rootfs.ubifs vol_id=1 vol_size=16MiB vol_type=dynamic @@ -330,14 +336,34 @@ vol_flags=autoresize Next, the UBI volume must be created. ``` -$ sudo ubinize -p 64KiB -m 1 -s 1 -O 64 -o ubifs.img ubiconf.ini +$ sudo ubinize -p 65536 -m 1 -s 1 -O 64 -o ubifs.ubi ubiconf.ini $ cd ../.. ``` -#### Howto obtain information about the organization of the SPI NOR memory. +#### Howto obtain information about the geometric organisation of the SPI NOR memory **For information purposes only** +From U-Boot source files. + +``` +{ INFO("s25fl256s0", 0x010219, 0x4d00, 256 * 1024, 128, USE_CLSR) }, +{ INFO("s25fl256s1", 0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) }, +``` + +From old U-Boot source files. + +``` +{ + .idcode1 = 0x0219, + .idcode2 = 0x4d01, + .page_size = 256, + .pages_per_sector = 256, + .nr_sectors = 512, + .name = "S25FL256S1", +} +``` + From U-Boot ... ``` @@ -355,6 +381,55 @@ ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 11 ubi0: available PEBs: 0, total reserved PEBs: 300, PEBs reserved for bad PEB handling: 0 ``` +``` +ScalpZynq> ubi info l +Volume information dump: + vol_id 0 + reserved_pebs 33 + alignment 1 + data_pad 0 + vol_type 4 + name_len 6 + usable_leb_size 65408 + used_ebs 13 + used_bytes 850304 + last_eb_bytes 65408 + corrupted 0 + upd_marker 0 + skip_check 0 + name datafs +Volume information dump: + vol_id 1 + reserved_pebs 263 + alignment 1 + data_pad 0 + vol_type 3 + name_len 6 + usable_leb_size 65408 + used_ebs 263 + used_bytes 17202304 + last_eb_bytes 65408 + corrupted 0 + upd_marker 0 + skip_check 0 + name rootfs +Volume information dump: + vol_id 2147479551 + reserved_pebs 2 + alignment 1 + data_pad 0 + vol_type 3 + name_len 13 + usable_leb_size 65408 + used_ebs 2 + used_bytes 130816 + last_eb_bytes 2 + corrupted 0 + upd_marker 0 + skip_check 0 + name layout volume +``` + ``` ScalpZynq> ubi info UBI: MTD device name: "ubifs" @@ -376,10 +451,6 @@ UBI: number of PEBs reserved for bad PEB handling: 0 UBI: max/mean erase counter: 1/0 ``` -``` -UBIFS error (ubi0:0 pid 0): validate_sb: LEB size mismatch: 65536 in superblock, 65408 real -``` - ### QSPI firmware packaging ``` @@ -387,7 +458,11 @@ $ petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux -petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/system.bit --u-boot --kernel --offset 0x540000 --dtb images/linux/system.dtb --offset 0x520000 --add images/linux/ubifs.img --offset 0xD40000 --force +petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/system.bit --u-boot --kernel --offset 0x540000 --dtb images/linux/system.dtb --offset 0x520000 --add images/linux/ubifs.ubi --offset 0xD40000 --force + +dd if=/dev/zero of=images/linux/BOOT.BIN bs=1 count=$((33554432-$(stat -c%s images/linux/BOOT.BIN))) seek=$(stat -c%s images/linux/BOOT.BIN) && wc -c images/linux/BOOT.BIN + + Do not use this command : @@ -398,22 +473,6 @@ The produced binary file can be found in the **./images/linux** folder. The **FI **For information purposes only**, below is the partitioning of the flash memory. -``` -{ INFO("s25fl256s0", 0x010219, 0x4d00, 256 * 1024, 128, USE_CLSR) }, -{ INFO("s25fl256s1", 0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) }, -``` - -``` -{ - .idcode1 = 0x0219, - .idcode2 = 0x4d01, - .page_size = 256, - .pages_per_sector = 256, - .nr_sectors = 512, - .name = "S25FL256S1", -} -``` - ``` List of MTD devices: * nor0 @@ -471,6 +530,31 @@ partition@ubifs { }; ``` +``` +/* 5242880 Bytes */ +partition@boot { + label = "boot"; + reg = <0x0 0x500000>; +}; + +/* 28311552 Bytes */ +partition@ubi { + label = "ubi"; + reg = <0x500000 0x1B00000>; +}; +``` + +``` +Image : ubi +Size : 28311552 - 0x1B00000 + + -------------------------------------------------- +vol. names : | uenv-vol | uenv2-vol | datafs-vol | rootfs-vol | + -------------------------------------------------- +vol. sizes : | 20000 | 20000 | 8126464 | 19922944 | + -------------------------------------------------- +``` + ### Flash firmware on QSPI memory **First of all, to flash the board, it is necessary to set switch SW1 (BOOT MODE) in JTAG mode. Then, once the card is flashed, it is necessary to set switch SW1 back in QSPI mode and reconnect the board.** @@ -478,6 +562,8 @@ partition@ubifs { If you are using a single JTAG probe. ``` +$ program_flash -blank_check -verify -frequency 30000000 -f images/linux/BOOT.BIN -offset 0 -flash_type qspi-x4-single -fsbl images/linux/zynq_fsbl.elf -cable type xilinx_tcf url TCP:127.0.0.1:3121 + $ program_flash -f images/linux/BOOT.BIN -offset 0 -flash_type qspi-x4-single -fsbl images/linux/zynq_fsbl.elf -cable type xilinx_tcf url TCP:127.0.0.1:3121 ```