简体   繁体   中英

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?

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 . Ie use the same name as the file in the original initramfs-live-boot recipe. 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:" .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM