At what stage the init script is created and can be used within the post build script?
Hi,
I'm building buildroot as a cpio initramfs (BR2_TARGET_ROOTFS_CPIO=y) and I have a post build script that edits the /init script like so:
sed -i "s/something/anotherthing/" ${TARGET_DIR}/init
The script worked fine when I used buildroot-2018.02.3 but now I want to build using the latest buildroot from git repo(master branch, latest commit is 0ce56fbdf6469cf9bbda168ffe75480ae811acaa as of writing this messege) and the script can't find the /init script and errors out:
|sed: can't read /home/mohammad/buildroot/output/target/init: No such file or directory
|so clearly the init script is not created until the cpio archive is created.
So how can I access the /init script from the post-build script ?
Thanks
||
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180711/cbaa9581/attachment.html>
Quoted 9 lines · MOHAMMAD RASIM
Hi,
I'm building buildroot as a cpio initramfs (BR2_TARGET_ROOTFS_CPIO=y) and I have a post build script that edits the /init script like so:
sed -i "s/something/anotherthing/" ${TARGET_DIR}/init
The script worked fine when I used buildroot-2018.02.3 but now I want to build using the latest buildroot from git repo(master branch, latest commit is0ce56fbdf6469cf9bbda168ffe75480ae811acaaas of writing this messege) and the script can't find the /init script and errors out:
Quoted 4 lines
|sed: can't read
/home/mohammad/buildroot/output/target/init: No such file or directory|so clearly the init script is not created until the cpio archive is created.
Indeed, the filesystem generation steps no longer modify $(TARGET_DIR).
Instead, they get their own private directory to work in. So the /init script will only appear in the cpio archive, not in the target directory or in the tarball.
Quoted 1 line
So how can I access the /init script from the post-build script ?
The easiest is: instead of using sed to update the init script, add a complete
init script in the rootfs overlay (BR2_ROOTFS_OVERLAY). That's what I usually do.
Alternatively, but IMO ugly, you could add the following in an external.mk:
define ROOTFS_CPIO_UPDATE_INIT
sed -i "s/something/anotherthing/" ${TARGET_DIR}/initendef
ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_UPDATE_INIT
Regards,
Arnout
Quoted 10 lines
Thanks
||_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Yeah I was trying to avoid using overlay, I guess I don't have a choice now. Thanks
Quoted 45 lines · Arnout Vandecappelle
Quoted 9 lines · MOHAMMAD RASIM
Hi,
I'm building buildroot as a cpio initramfs (BR2_TARGET_ROOTFS_CPIO=y) and I have a post build script that edits the /init script like so:
sed -i "s/something/anotherthing/" ${TARGET_DIR}/init
The script worked fine when I used buildroot-2018.02.3 but now I want to build using the latest buildroot from git repo(master branch, latest commit is0ce56fbdf6469cf9bbda168ffe75480ae811acaaas of writing this messege) and the script can't find the /init script and errors out:Quoted 4 lines
|sed: can't read
/home/mohammad/buildroot/output/target/init: No such file or directory|so clearly the init script is not created until the cpio archive is created.
Indeed, the filesystem generation steps no longer modify $(TARGET_DIR).
Instead, they get their own private directory to work in. So the /init script will only appear in the cpio archive, not in the target directory or in the tarball.Quoted 1 line
So how can I access the /init script from the post-build script ?
The easiest is: instead of using sed to update the init script, add a complete
init script in the rootfs overlay (BR2_ROOTFS_OVERLAY). That's what I usually do.Alternatively, but IMO ugly, you could add the following in an external.mk:
define
ROOTFS_CPIO_UPDATE_INITsed -i "s/something/anotherthing/" ${TARGET_DIR}/initendef
ROOTFS_CPIO_PRE_GEN_HOOKS+=ROOTFS_CPIO_UPDATE_INITRegards,
ArnoutQuoted 9 lines
Thanks
||_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot