Hi Joe and Heiko, I tried disabling the fastmap options, and it appears to be related to these. With fastmap off, I am able two write without corrupting the other volume. It looks like it may specifically be the autoupdate feature, but I am still testing to be sure this is the case. I will let you know.
Thank you for your help, Kevin On 05/11/2016 12:51 AM, Heiko Schocher wrote: > Hello Joe, > > Am 11.05.2016 um 01:15 schrieb Joseph Hershberger: >> Hi Kevin, >> >> Am 09.05.2016 um 23:16 schrieb Kevin Smith: >>> Hello, >>> >>> I would appreciate some UBI help/advice if you are able to provide it. >>> I am trying to use UBI to store my u-boot environment, but when I try >>> to 'saveenv', it is corrupting another volume of my UBI. I can image >>> the rootfs volume and boot Linux from it without a problem. However, >>> the first time that I save the u-boot environment, the rootfs becomes >>> unreadable. When the rootfs is corrupted, I have booted Linux from >>> another source and tried to attach UBI and dd out the data. It >>> appears as all 0xFF. Both u-boot and Linux can read the env volume >>> correctly. >>> >>> I do not think that there is a board in U-boot that uses UBI env, so I >>> do not have anything to compare to. I have included some details of >>> my setup below. Do you have any suggestion about what might be wrong? >>> I saw the recent patch b1d6590d35, and thought it might fix it, but am >>> still having the problem even with this. Maybe there is another bug? >>> I am glad to provide more info as needed. >>> Thank you, >>> Kevin >>> >>> DTS: >>> flash@d0000 { >>> num-cs = <1>; >>> marvell,nand-keep-config; >>> marvell,nand-enable-arbiter; >>> nand-on-flash-bbt; >>> nand-ecc-strength = <4>; >>> nand-ecc-step-size = <512>; >>> status = "okay"; >>> >>> partition@0 { >>> label = "mvboot"; >>> reg = <0 0x200000>; >>> }; >>> partition@200000 { >>> label = "ubi"; >>> reg = <0x200000 0x1fe00000>; >>> }; >>> }; >>> Config: >>> #define MTDIDS_DEFAULT "nand0=pxa3xx_nand-0" >>> #define MTDPARTS_DEFAULT "mtdparts=pxa3xx_nand-0:2m(mvboot),-(ubi)" >>> #define CONFIG_CMD_UBI >>> #define CONFIG_CMD_UBIFS >> >>> #define CONFIG_MTD_UBI_FASTMAP >>> #define CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT 1 >> >> I don’t define these 2, not sure if it matters. > > This should be no problem ... but you (Kevin) may disable > FASTMAP for a test? > >>> #define CONFIG_ENV_IS_IN_UBI >>> #define CONFIG_ENV_UBI_PART "ubi" >>> #define CONFIG_ENV_UBI_VOLUME "u-boot-env" >>> #define CONFIG_ENV_SIZE (64 * 1024) >> >> My config looks like this: >> >> #define MTDIDS_DEFAULT "nand0=xilinx_nand" >> #define MTDPARTS_DEFAULT \ >> "mtdparts=xilinx_nand:" \ >> "128k(fsbl)ro," \ >> "11M(u-boot)ro," \ >> "70M(boot-config)," \ >> "-(root)" > > You have 70MB for Env? > >> #define CONFIG_ENV_IS_IN_UBI >> #define CONFIG_ENV_UBI_PART "boot-config" >> #define CONFIG_ENV_UBI_VOLUME "u-boot-env1" >> #define CONFIG_ENV_UBI_VOLUME_REDUND "u-boot-env2" >> #define CONFIG_ENV_SIZE 0x20000 >> >> I create volumes like this: >> >> "writepartitions=" \ >> "if ubi part boot-config && " \ >> "ubi read $verifyaddr u-boot-env1 1 && " \ >> "ubi read $verifyaddr u-boot-env2 1; " \ >> "then " \ >> "ubi remove bootfs && " \ >> "ubi remove config; " \ >> "else " \ >> "nand erase.part boot-config && " \ >> "ubi part boot-config && " \ >> "ubi create u-boot-env1 " __stringify(CONFIG_ENV_SIZE) " >> dynamic && " \ >> "ubi create u-boot-env2 " __stringify(CONFIG_ENV_SIZE) " >> dynamic; " \ >> "fi && " \ >> "ubi create bootfs " __stringify(CONFIG_BOOTFS_VOLUME_SIZE) " >> dynamic && " \ >> "ubi create config - dynamic && " \ >> "if ubi part root && " \ >> "ubi read $verifyaddr rootfs 1; " \ >> "then " \ >> "ubi remove rootfs; " \ >> "else " \ >> "nand erase.part root && " \ >> "ubi part root; " \ >> "fi && " \ >> "ubi create rootfs - dynamic;\0" \ >> >> >>> => ubi info >>> UBI: MTD device name: "mtd=1" >>> UBI: MTD device size: 510 MiB >>> UBI: physical eraseblock size: 131072 bytes (128 KiB) >>> UBI: logical eraseblock size: 126976 bytes >>> UBI: number of good PEBs: 4072 >>> UBI: number of bad PEBs: 8 >>> UBI: smallest flash I/O unit: 2048 >>> UBI: VID header offset: 2048 (aligned 2048) >>> UBI: data offset: 4096 >>> UBI: max. allowed volumes: 128 >>> UBI: wear-leveling threshold: 4096 >>> UBI: number of internal volumes: 1 >>> UBI: number of user volumes: 2 >>> UBI: available PEBs: 0 >>> UBI: total number of reserved PEBs: 4072 >>> UBI: number of PEBs reserved for bad PEB handling: 72 >>> UBI: max/mean erase counter: 18/4 >>> >>> => ubi info l >>> Volume information dump: >>> vol_id 0 >>> reserved_pebs 1 >>> alignment 1 >>> data_pad 0 >>> vol_type 3 >>> name_len 10 >>> usable_leb_size 126976 >>> used_ebs 1 >>> used_bytes 126976 >>> last_eb_bytes 126976 >>> corrupted 0 >>> upd_marker 0 >>> name u-boot-env > > @Kevin: you have exactly one PEB for this volume ... may this is the > problem? > Can you try it with a Volume, which have more space? > >>> Volume information dump: >>> vol_id 1 >>> reserved_pebs 3993 >>> alignment 1 >>> data_pad 0 >>> vol_type 3 >>> name_len 6 >>> usable_leb_size 126976 >>> used_ebs 3993 >>> used_bytes 507015168 >>> last_eb_bytes 126976 >>> corrupted 0 >>> upd_marker 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 126976 >>> used_ebs 2 >>> used_bytes 253952 >>> last_eb_bytes 2 >>> corrupted 0 >>> upd_marker 0 >>> name layout volume >>> >>> => ubifsmount ubi0:rootfs >>> Error reading superblock on volume 'ubi0:rootfs' errno=-30! >>> ubifsmount - mount UBIFS volume >>> >>> Usage: >>> ubifsmount <volume-name> >>> - mount 'volume-name' volume >>> >> >> I also notice that you are not using a redundant env like I am, so >> maybe there is a bug when not using a redundant env that I don't run >> into. > > I don;t know. > > bye, > Heiko _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot