Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yocto using .bbappend file to override writing of default init scripts for initramfs

I am trying to write a .bbappend file that will append to the initramfs-live-boot_1.0.bb which has a statement inside the do_install() that writes the contents of init-live.sh, a shell script that manages the boot procedure, to init, an initialisation script that runs upon boot. The purpose of my .bbappend file is to reference a modified version of the startup script to be copied in place of the original without changing the base openembedded-core and/or poky environments. The .bbappend file and my version of the script is therefore placed in my project directory with the rest of my own recipes to be built.

My initramfs-live-boot_1.0.bbappend looks like this:

SUMMARY = "Replacement recipe"
FILESEXTRAPATH_prepend := "${THISDIR}/files:"
SRC_URI += "file://init.sh"

do_install_append() {
        install -m 0755 ${WORKDIR}/init.sh ${D}/init
}

I have a folder files in the same directory as the .bbappend file that contains the init.sh script it should be reading from.

The problem is when I try to build the image, it spits out this error:

WARNING: Failed to fetch URL file://init.sh, attempting MIRRORS if available

and then attempts to search through the poky directory for the missing files rather than in my project directory.

Have I written my .bbappend file wrong? How would I go about editing the initramfs scripts using the .bbappend file?

like image 431
Shiri Avatar asked Dec 15 '15 13:12

Shiri


People also ask

Where do Bbappend files go?

bbappend file is to reference a modified version of the startup script to be copied in place of the original without changing the base openembedded-core and/or poky environments. The . bbappend file and my version of the script is therefore placed in my project directory with the rest of my own recipes to be built.

What is the difference between BB and Bbappend?

bbappend file resides in your layer, while the main . bb recipe file to which you are appending Metadata resides in a different layer.

What is .BB file in yocto?

bb , are the most basic metadata files. These recipe files provide BitBake with the following: Descriptive information about the package. The version of the recipe. Existing Dependencies.


1 Answers

FILESEXTRAPATH_prepend := "${THISDIR}/files:" should be FILESEXTRAPATHS_prepend := "${THISDIR}/files:". Note the last S in FILESEXTRAPATHS.

That should make it work for you.

Another improvement would be to rename you file file from init.sh to init-live.sh. I.e. use the same name as the file in the original initramfs-live-bootrecipe. That would allow you to remove your do_install_append()-function as well as SRC_URI += "file://init.sh" from the bbappend. The recipe itself would handle those for you. Thus, the only line you'd actually need is the FILESEXTRAPATHS_prepend := "${THISDIR}/files:".

like image 161
Anders Avatar answered Nov 04 '22 15:11

Anders