[OE-core] [yocto] Support UBI u-boot


Quentin Schulz <quentin.schulz@...>
 

Hi JH,

On Fri, Feb 07, 2020 at 07:52:35PM +1100, JH wrote:
Hi Pelle,

Aplogize for cross posting.

On 2/7/20, Pelle Windestam <Pelle.Windestam@...> wrote:
In my case u-boot uses a default config called imx8qxp_var_som_defconfig
stored under the configs directory in u-boot (not sure if its in the
official repositories, I use a vendor supplied u-boot repo, but the
procedure should be the same either way), then I have created a
.bbappend-file for the u-boot recipe, and added a patch that modifies the
defconfig file to include the options I want to enable. Then as u-boot is
built, it will use the patched defconfig with the appropriate options
enabled. In the meta-freescale layer the u-boot recipes are under
meta-freescale/recipes-bsp/u-boot.
Thanks for the tip, that is quite helpful. I created bbappend file,
run the make menuconfig to enable NAND and CONFIG_CMD_UBI, but then
failed in build, missing all MTD, NAND, UBI references, the MTD, NAND,
UBI are all selected, what I could be missing?

/build/Installer/sa_platform_build/Source/Yocto/build/tmp-glibc/work/solar-oe-linux-gnueabi/u-boot-imx/2017.03-r0/git/cmd/ubi.c:448:
undefined reference to `mtdparts_init'
This function is not defined. So you look it up in the sources, find
where it's defined.

Is it in a file which is compiled/included somewhere?
Is it surrounded by #ifdef? And by surrounded, I mean the #ifdef can
be several thousands of lines above the function definition.

In that case, I couldn't find the sources of u-boot-imx (didn't take the
time) but from upstream:
https://elixir.bootlin.com/u-boot/v2017.03/source/cmd/nand.c#L35

It's surrounded by #if defined(CONFIG_CMD_MTDPARTS) so you need
CMD_MTDPARTS to be enabled. Do the same for all the other calls. There's
no magic thing, you thus have to look it up yourself most of the time.
Even though arguably, that's a mistake from upstream (there should be a
dependency on MTDPARTS in Kconfig, anyway...).

Quentin


JH
 

Hi Quentin,

Thanks for your response, so glad you help me here again :-).

On 2/7/20, Quentin Schulz <quentin.schulz@...> wrote:
/build/Installer/sa_platform_build/Source/Yocto/build/tmp-glibc/work/solar-oe-linux-gnueabi/u-boot-imx/2017.03-r0/git/cmd/ubi.c:448:
undefined reference to `mtdparts_init'
This function is not defined. So you look it up in the sources, find
where it's defined.
That is a function call in cmd/ubi.c:

int ubi_detach(void)
{
if (mtdparts_init() != 0) {
printf("Error initializing mtdparts!\n");
return 1;
}
.....

That function is in cmd/mtdparts.c:
int mtdparts_init(void) {
.......
}

It is in the same source directory, I'll have to look it deep, why it
does not compile cmd/mtdparts.c?


Is it in a file which is compiled/included somewhere?
Is it surrounded by #ifdef? And by surrounded, I mean the #ifdef can
be several thousands of lines above the function definition.
Actually, there is no macros to surround that function.


In that case, I couldn't find the sources of u-boot-imx (didn't take the
time) but from upstream:
https://elixir.bootlin.com/u-boot/v2017.03/source/cmd/nand.c#L35
The meta-freescale downloaded the u-boot source from
https://source.codeaurora.org/external/imx/uboot-imx.git

It's surrounded by #if defined(CONFIG_CMD_MTDPARTS) so you need
CMD_MTDPARTS to be enabled. Do the same for all the other calls. There's
no magic thing, you thus have to look it up yourself most of the time.
Even though arguably, that's a mistake from upstream (there should be a
dependency on MTDPARTS in Kconfig, anyway...).
You are right, the CONFIG_CMD_MTDPARTS is defined in many defconfig
except it is not in my mx6ull_14x14_evk_defconfig, there are lots of
definitions are defined in other defconfig, but missing in
mx6ull_14x14_evk_defconfig. When I run make menuconfig, I enabled all
MTD, NAND and UBI parts except UBI Fastmap (Experimental feature) in
menuconfig, but I still could not find CONFIG_CMD_MTDPARTS and other
definitions. Need to look it carefully.

I suspect that to run make menuconfig might not be right command, I
tried bitbake -c menuconfig u-boot:

ERROR: Task do_menuconfig does not exist for target u-boot
(./meta-freescale/recipes-bsp/u-boot/u-boot-imx_2017.03.bb:do_menuconfig).
Close matches:
do_configure

To run kernel menuconfig, I can add KERNEL_CONFIG_COMMAND =
"oe_runmake_call -C ${S} O=${B} imx_v6_v7_defconfig" to a bbappend
file to run bitbake -c menuconfig kernel. Is there an equivelent
UBOOT_CONFIG_COMMAND to run oe_runmake?

Thank you.

- jh