From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] U-boot UBI environment
Date: Wed, 11 May 2016 07:51:11 +0200 [thread overview]
Message-ID: <5732C84F.50408@denx.de> (raw)
In-Reply-To: <BY1PR0401MB12406CC146A272A363551F56F6710@BY1PR0401MB1240.namprd04.prod.outlook.com>
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 at 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 at 0 {
>> label = "mvboot";
>> reg = <0 0x200000>;
>> };
>> partition at 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
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
next prev parent reply other threads:[~2016-05-11 5:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5730FE25.909@elecsyscorp.com>
[not found] ` <57316B70.5060505@denx.de>
2016-05-10 23:15 ` [U-Boot] U-boot UBI environment Joseph Hershberger
2016-05-11 5:51 ` Heiko Schocher [this message]
2016-05-11 15:54 ` Kevin Smith
2016-05-12 4:41 ` Heiko Schocher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5732C84F.50408@denx.de \
--to=hs@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox