[yocto] Support UBI u-boot


Gabriele <gabbla.malist@...>
 

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.

However you should be able to create and apply patches for external repo without any problem and the needs to push your changes to public repos (unless them are useful for others).

BR
Gabriele


On Thu, Feb 6, 2020 at 7:35 AM JH <jupiter.hce@...> wrote:
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


JH
 

Thanks Gabriele and Andy,

On 2/6/20, Gabriele Zampieri <gabbla.malist@...> 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


JH
 

On 2/6/20, JH <jupiter.hce@...> 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?


Gabriele <gabbla.malist@...>
 

Hi,

On Thu, Feb 6, 2020 at 11:07 AM JH <jupiter.hce@...> wrote:
Thanks Gabriele and Andy,

On 2/6/20, Gabriele Zampieri <gabbla.malist@...> 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.

Sorry, I never tried that approach. 

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?
 
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"

Thank you.

Kind regards,

- jh

Gabriele


JH
 

Hi Gabriele,

On 2/6/20, Gabriele Zampieri <gabbla.malist@...> 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


Gabriele <gabbla.malist@...>
 

Hi,

On Fri, Feb 7, 2020 at 2:55 AM JH <jupiter.hce@...> wrote:
Hi Gabriele,

On 2/6/20, Gabriele Zampieri <gabbla.malist@...> 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.

I compile uboot using the Yocto generated SDK. Simply
source /opt/poky/.../env-script
make -j4

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.
Thank you Gabriele for great helps.
 
Kind regards,

- jh

Gabriele


JH
 

Hi Gabriele,

Thanks for the help.

On 2/8/20, Gabriele Zampieri <gabbla.malist@...> 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


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


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 <jupiter.hce@...> 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