u-boot saveenv corrupted other MTD parttions

2020-02-17 Thread JH
Hi,

I have three MTD partitions, the mtd2 storage installed UBIFS volumes,
first is dtb volume, second is kernel volume, third is rootfs volume.
The saveenv was configured to save environment variables to NAND
ubootenv.

gpmi-nand:1m(boot),1m(ubootenv),-(storage)

There was no issue to run NAND boot, but if I called saveenv in
u-boot, then I run bootcmd again, it could not boot from NAND any
more:

Bad Linux ARM zImage magic!

The saveenv does not take any parameters, how did it work to write to
the NAND 1m(ubootenv)?

=> saveenv
Saving Environment to NAND... Erasing NAND...
Erasing at 0x5e -- 100% complete.
Writing to NAND... OK

It looks like that saveenv overwritten to the storage, is 0x5e RAM
or NAND address?

Where was that address defined?

How do I know it was the NAND 1m(ubootenv) address?

Thank you.

Kind regards,

- jh


Which parameters are shared by kernel and u-boot?

2020-02-16 Thread JH
Hi,

Does kernel and u-boot both need be compiled by u-boot configure files
to include bootargs, mtdpars etc?

Thank you.

Kind regards,

- jh


Re: [yocto] Support UBI u-boot

2020-02-09 Thread JH
Anyway, hacked the Makefile and mtdpart.c, finally got it compiled to
support UBI. I think some latest branch might fix the problems I
haven't tested, if not, I am happy to make patches.

Thank you all.

Kind regards,

- jh

On 2/9/20, JH  wrote:
> Changed to https://source.codeaurora.org/external/imx/uboot-imx.git
> branch imx_v2018.03_4.14.98_2.0.0_ga, it can now support
> CONFIG_CMD_MTDPARTS ind defconfg, all MTDPARTS error gone, but then
> 2018.03-r0/git/cmd/ubi.c missed dependencies of del_mtd_partitions,
> add_mtd_partitions, mtd_get_device_size all in mtdpart.c which can
> only be enabled by CONFIG_MTD_PARTITIONS:
>
> obj-$(CONFIG_MTD_PARTITIONS) += mtdpart.o
>
> But that CONFIG_MTD_PARTITIONS is not supported in defconfig.
>
> Could anyone advise which branch works for UBI?
>
> Thank you.
>
> Kind regards,
>
> - jh
>


Re: [yocto] Support UBI u-boot

2020-02-09 Thread JH
Changed to https://source.codeaurora.org/external/imx/uboot-imx.git
branch imx_v2018.03_4.14.98_2.0.0_ga, it can now support
CONFIG_CMD_MTDPARTS ind defconfg, all MTDPARTS error gone, but then
2018.03-r0/git/cmd/ubi.c missed dependencies of del_mtd_partitions,
add_mtd_partitions, mtd_get_device_size all in mtdpart.c which can
only be enabled by CONFIG_MTD_PARTITIONS:

obj-$(CONFIG_MTD_PARTITIONS) += mtdpart.o

But that CONFIG_MTD_PARTITIONS is not supported in defconfig.

Could anyone advise which branch works for UBI?

Thank you.

Kind regards,

- jh


Re: [yocto] Support UBI u-boot

2020-02-08 Thread JH
Hi Gabriele,

Thanks for the help.

On 2/8/20, Gabriele Zampieri  wrote:
> If you just want to run the menuconfig run
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
> and
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- savedefconfig
> In any environment.

It does not seem the OE / Yocto build issue, rather than the u-boot
build issue.

I can build OE / Yocto to load my mx6ull_14x14_evk_nand_defconfig to
replace the original source
git/configs/mx6ull_14x14_evk_nand_defconfig.

The git/scripts/kconfig was able to run defconfig mode that
git/scripts/kconfig/conf.c and git/scripts/kconfig/confdata.c was able
to enable CONFIG_CMD_UBI and to write to the .config based on my
mx6ull_14x14_evk_nand_defconfig, but git/scripts/kconfig/conf.c and
git/scripts/kconfig/confdata.c were not able to generate
CONFIG_CMD_MTDPARTS (I could not find CONFIG_CMD_MTDPARTS when I made
menuconig from menu config either).

The git/cmd/Makefile requires CONFIG_CMD_MTDPARTS set up to run
mtdparts.c, without CONFIG_CMD_MTDPARTS, mtdparts.c was not compiled,
and other cmd source files were not compiled, thus missing all
dependencies for ubi (undefined reference).

Is it buggy in u-boot source downloaded from
https://source.codeaurora.org/external/imx/uboot-imx.git (commit
"8be98e9322040c655b9e5c9fb2c494e002e3fad9"), or is just my silly
stupidity to miss things?

Could anyone in u-boot source development help to comment our if
https://source.codeaurora.org/external/imx/uboot-imx.git (commit
"8be98e9322040c655b9e5c9fb2c494e002e3fad9") works for ubi or not? Or
what I could be missing?

Apologize to cc source contributors.

Thank you.

Kind regards,

- jh


Re: Support UBI u-boot

2020-02-06 Thread JH
Hi Andy,

On 2/6/20, Andy Pont  wrote:
> JH wrote...
>
>
>>I added NAND and UBIFS support to my Yocto layer machine config file:
>>
>>UBOOT_CONFIG = "nand"
>>UBOOT_CONFIG[nand] += "mx6ull_14x14_evk_config"
>>UBOOT_CONFIG[nand] += "mx6ull_14x14_evk_nand_config"
>>UBOOT_CONFIG[nand] += "ubi"
>>UBOOT_CONFIG[nand] += "ubifs"
>>
>>But my u-boot.imx-nand still could not support ubi:
>>
>>=> ubi part rootfs
>>Unknown command 'ubi' - try ‘help’
> You need to start to read through the various sources to figure out for
> yourself what is going on!
>
> Starting from the bottom, in U-Boot 2017.03 all of the command sources
> are in the “cmd” directory. The “ubi …” command are all in ubi.c.
> Reading cmd/Makefile shows that file gets added into the build if
> CONFIG_CMD_UBI is enabled.

You are right, that CONFIG_CMD_UBI is not enabled, but I could not
find any conf or bb files I could change or enable CONFIG_CMD_UBI in
meta-freescale layer.

Desperately, I hacked to run "make menuconfig" at U-Boot 2017.03 build
directory, selected and enabled CONFIG_CMD_UBI and saved to .config
file in that build directory, but then to run bitbake to build u-boot
again, the .config was removed and replaced by an old one disabled
CONFIG_CMD_UBI again.

Other people recommended to build u-boot in a standalone environment
out of OE / Yocto build system. Since I have set up everything in OE /
Yocto environment, I thought it could be easier if I could modify one
line of u-boot config file in a recipe.

Any idea where is the recipe in meta-freescale to allow me to change /
enable CONFIG_CMD_UBI?

Am I the only one unable to change u-boot config file in OE / Yoctu
build? That makes me very sad :-(.


> The next place to look is whether or not that is set in your defconfig
> for U-Boot or overwritten somewhere in a recipe in your Yocto build
> environment.

Yeah, I'll been searched all day, could not find a recipe Yocto build
environment, I was told OE / Yocto does not have that stack and
mechanism to set and change u-boot config, is it true?

Thank you very much.

Kind regards,

- jh


Re: [yocto] Support UBI u-boot

2020-02-06 Thread JH
Hi Gabriele,

On 2/6/20, Gabriele Zampieri  wrote:
> As far as I know uboot (usually virtual/bootloader) does not have a task to
> run menuconfig directly from bitbake.
> I usually have a local clone of uboot and I simply run `make [...]
> menuconfig|savedefconfig` , then I create a patch
> to add my defconfig (custom_defconfig) to configs/ and specify
> UBOOT_MACHINE = "custom_defconfig"

Are there any document to use cross compiler tools to build u-boot-imx
on Ubuntu 18 host machine? It seems that build environment will not be
the same as the Yocto build environment I am currently running on
Ubuntu 18 host.

Thank you Gabriele for great helps.

Kind regards,

- jh


Support UBI u-boot

2020-02-06 Thread JH
Hi,

Sorry for cross-posting, I have been asking for helping solving the
issue many days ago, but could not get those work.

(1) UBI support

I added NAND and UBIFS support to my Yocto layer machine config file:

UBOOT_CONFIG = "nand"
UBOOT_CONFIG[nand] += "mx6ull_14x14_evk_config"
UBOOT_CONFIG[nand] += "mx6ull_14x14_evk_nand_config"
UBOOT_CONFIG[nand] += "ubi"
UBOOT_CONFIG[nand] += "ubifs"

But my u-boot.imx-nand still could not support ubi:

=> ubi part rootfs
Unknown command 'ubi' - try 'help'

What I could be missing here?


(2) Patch u-boot parameters

I am not clear how you do to change u-boot parameters, it seems to me
I have to create my own u-boot-imx_2017.03.bbappend and patch files to
 mx6ullevk.h, to change u-boot parameters of mtdparts, NAND_ROOT_UBI,
bootcmd, etc based on my configuration.

But Yocto won't allow the patch running unless that the patch is
committed to the git repository in
https://source.codeaurora.org/external/imx/uboot-imx.git.

Ideally, I thought all u-boot parameters can be changed in a bbappend
file, could you advise if it is possible to do that way or not? If so,
how to do it?

If not, what is the policy for making parches and commit to the git
repository https://source.codeaurora.org/external/imx/uboot-imx.git?

Thank you.

Kind regards,

- jh


Re: [yocto] Support UBI u-boot

2020-02-06 Thread JH
On 2/6/20, JH  wrote:
> I think I need to add an appended recipes-bsp to my layer just like I
> added the recipes-kernel to my layer to overwrite kernel defconfig, I
> need to overwrite u-boot defconfig.
>
> In kernel, to overwrite defconfig, I run bitbake -c menuconfig
> virtual/kernel, how can I generate u-boot defconfig, to run bitbake -c
> menuconfig u-boot?

Hmm, more complicated than I thought, it does not have defconfig in
u-boot like kernel does, how do you overwrite u-boot config in Yocto?


Re: [yocto] Support UBI u-boot

2020-02-06 Thread JH
Thanks Gabriele and Andy,

On 2/6/20, Gabriele Zampieri  wrote:
> Hi JH,
>
> have you tried what we suggested you in your last thread? More specifically
> adding your defconfig and tweaking it through menuconfig. and then specify
> the UBOOT_MACHINE.

Yes, as I posted in another thread, the MTD, UBI are all set in my
Linux kernel defconfig, I have also added UBOOT_CONFIG = "nand" in my
layer machine config.

What I missed is u-boot overlay, as you and Andy alluded. I added
UBOOT_CONFIG[nand] += "mx6ull_14x14_evk_nand_config", but strange
enough, that mx6ull_14x14_evk_nand_config, did not set CONFIG_CMD_UBI
in its config.

I think I need to add an appended recipes-bsp to my layer just like I
added the recipes-kernel to my layer to overwrite kernel defconfig, I
need to overwrite u-boot defconfig.

In kernel, to overwrite defconfig, I run bitbake -c menuconfig
virtual/kernel, how can I generate u-boot defconfig, to run bitbake -c
menuconfig u-boot?

Thank you.

Kind regards,

- jh


[U-Boot] What is the current U-Boot status to boot from multiple UBI volumes?

2019-10-12 Thread JH
Hi,

I tried to find more information about configure u-boot for booting
multiple UBI volumes on imx6, but seems to me that information is
really sparse.

There was a proposal by Wolfgang Denk many years ago at
https://elinux.org/Boot_U-Boot_from_UBI_volume, and I could not find
anyone talked about it in ELC_2019_Presentations.

Apologize if I am wrong to seek solutions in u-boot mailing list.

If I have only one UBI volume rootfs in an partition /dev/mtd5, I can
configure to boot the image from /dev/ubi0, but with following three
UBI volumes, how should I configure u-boot to boot from the UBI volume
configure file volume.conf? How to set up u-boot to start boot from
the volume.conf?

I have three UBI volumes for UBIFS:

[kernel-volume]
mode=ubi
image=zImage
vol_id=1
vol_size=10MiB
vol_type=static
vol_name=kernel

[rootfs-volume]
mode=ubi
image=rootfs_data
vol_id=2
vol_size=110MiB
vol_type=static
vol_name=rootfs

[data-volume]

mode=ubi
image=rootfs_data
vol_id=3
vol_size=10MiB
vol_type=dynamic
vol_name=data
vol_flags=autoresize

$ ubinize -o rootfs.img -p 130MiB -m 512 -s 256 volume.conf

Thank you.

Kind regards,

- jh
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] Set up NAND UBIFS partitions

2019-09-23 Thread JH
Hi,

I have to start u-boot in initram ramdisk to create NAND partitions
and burn the Yocto image to NAND flash in iMX6, is there a simple way
to partition NAND and burn image to NAND without running the u-boot in
an intermediate initram stage?

The second issue is in the current method to run u-boot in initram, I
created two NAND UBIFS partitions, one was the rootfs, one is the data
storage, but when the system booted from NAND rootfs, the data storage
/dev/ubi1_0 was no longer visiable in rootfs partition. So I have to
create the /dev/ubi1_0 again, attach it and mount it in rootfs
partition every time in rootfs partition boot that is definitely a
wrong way. What is a proper way to fix it?

Thank you.

Kind regards,

- jh
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot