Meta-swupdate yocto gub instead of u-boot bootloader - embedded-linux

I want to use the swupdate meta layer in my yocto build framework. see: https://github.com/sbabic/meta-swupdate
Before I build it with bitbake swupdateI do some configuration with bitbake -c menuconfig swupdate here I can find some configuration for change the bootloader from u-boot to grub. screenshot
Anytime when I call bitbake swupdatethe recipies u-boot is building...
If I start only the bitbake u-boot I get an error:
Configuration file ".config" not found!
But there is no option bitbake -c menuconfig u-boot
I'm confused. Is there another .config file for u-boot?

If my understanding of the swupdate recipe is correct, the DEPENDS variable is automatically appended depending on the content of the defconfig file that is specified in SRC_URI or in config fragments[1]. Therefore, in order to remove u-boot from the DEPENDS variable, one needs to remove it from the defconfig that is unpacked in the recipe workdir. Running the menuconfig task won't probably be enough. One can probably remove U-Boot from the defconfig by running the menuconfig task, get the resulting defconfig output from the workdir and add it in a bbappend of the swupdate recipe.
[1] https://github.com/sbabic/meta-swupdate/blob/master/recipes-support/swupdate/swupdate.inc#L90-L150

Related

Linux kernel out-of-tree module, installation of uapi headers issue

I have an external out-of-tree linux kernel module, say foo. Therein, I have a directory include/uapi/ that should, I assume, contain Kbuild file defining inclusion rules and/or headers to export. The directory include/uapi/ on its turn contains one more directory linux having the target user-API headers in, say three files foo.h bar.h baz.h
Ok, I have defined this Kbuild file inside include/uapi and it contains:
header-y += linux/
Then, inside include/uapi/linux directory I've defined one more KBuild and it has the content:
header-y += foo.h bar.h baz.h
Now I am expecting that upon running the command
make -C /lib/modules/5.4.48-dannftk/build M=/home/dannftk/foo INSTALL_HDR_PATH=/home/dannftk/my_exported_headers/ headers_install
I will get the headers installed in the /home/dannftk/my_exported_headers/ directory, instead, I am getting the error saying:
make: *** No rule to make target 'headers_install'. Stop.
/home/dannftk/foo - the path the out-of-tree module discussed is located by
/lib/modules/5.4.48-dannftk/build - the build directory of the kernel, it points to /usr/src/linux-5.4.48 containing the source code of the kernel, actually, I am on Gentoo Linux
May someone give me a hint what I am doing wrongly? Am I incorrectly setting rules for Kbuild? Or maybe I am locating them in unexpected for the kernel build system directories?
Thank you in advance
I personally consider this issue as a bad Kbuild error message. It's too confusing.
The answer is in linux documentation:
--- 2.3 Targets
When building an external module, only a subset of the "make"
targets are available.
make -C $KDIR M=$PWD [target]
The default will build the module(s) located in the current
directory, so a target does not need to be specified. All
output files will also be generated in this directory. No
attempts are made to update the kernel source, and it is a
precondition that a successful "make" has been executed for the
kernel.
modules
The default target for external modules. It has the
same functionality as if no target was specified. See
description above.
modules_install
Install the external module(s). The default location is
/lib/modules/<kernel_release>/extra/, but a prefix may
be added with INSTALL_MOD_PATH (discussed in section 5).
clean
Remove all generated files in the module directory only.
help
List the available targets for external modules.
There were some hacks available in older kernel versions, as adding header-y += ... into Kbuild file, but, as you see, it's not the official approach.
Looks like developers of out-of-tree modules should take care of headers installation manually, without reusing of linux kernel make rules.

bitbake -c savedefconfig overwrites current configuration

Yocto environment for an ARM embedded board.
Following these instructions I'm having hard time to change the kenerl configuration.
Basically I did:
bitbake -c menuconfig virtual/kernel
enabled a new driver (i.e. PPP)
save
check new the items in .config
bitbake -c savedefconfig virtual/kernel
now both defconfig and .config don't have the PPP module anymore
even more: entering again the menuconfig it is disabled
Why it does not work as expected?

Creating a defconfig for u-boot

I'm trying to create a defconfig for u-boot using make u-boot-savedefconfig but I get the error.
make: *** No rule to make target 'u-boot-savedefconfig'. Stop.make: *** No rule to make target 'u-boot-savedefconfig'. Stop.
Should I modify the makefile or is it not possible to create a defconfig for u-boot?
I expect a defconfig file to be created using the existing .config file as I'd like to upload the defconfig to github.
Are there any docs that I can follow? I'm using timesys to create custom embedded Linux, the docs in Timesys do not contain any info about creating defconfig.
The name of the make target is not u-boot-savedefconfig but just savedefconfig just like the Linux kernel.

`tftp` command in U-Boot: Binary image or U-Boot image?

When using the tftp command in U-Boot, do I have to specifiy a binary image to load, or an image created with the U-Boot-supplied mkimage tool?
Addendum: The image I'm trying to load is a bare-metal C program. I compiled it with
arm-none-eabi-gcc (input files and flags) -o blinky.elf
and converted it with
arm-none-eabi-objcopy -O binary blinky.elf blinky.bin
.
tftp command is just for downloading a file from the host, it does not care what to download. The bootm command is which does care. Recent versions of u-boot are capable of loading zImage directly (if configured). But the most common way is to use the legacy uImage, created either by mkimage or by make uImage command, if supported.
Upd:
For a bare-metal programs you should use the go command in u-boot with the address of your bin file:
tftp ${loadaddr} yourfile.bin
go ${loadaddr}
Upd2:
By the way, It is possible to build u-boot with a bootelf command, which will allow to boot from your output elf file, without the need of using objcopy.

Error in linux cross compilation u-boot

When i am cross compile u-boot code in ubuntu and gives command as follow
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- distclean
error is:
System not configured -see readme Error[1]
What is solution for this?
thank you.
hardik gajjar
To compile U-Boot, the easiest way is to export the CROSS_COMPILE variable :
$ export CROSS_COMPILE=/directory/.../arm-none-linux-gnueabi-
And then you have to choose the board configuration, for example :
$ make lpc4350-board_config
Then you can compile :
$ make
The distclean target is used to undo/clear any changes made to the local working directory by selecting any board/device-specific config.
The error System not configured -see readme Error[1] indicates that the current u-boot working-directory is NOT yet configured for any device/board and hence the distclean target to make is redundant at this point.

Resources