g40 Posted August 24, 2017 Posted August 24, 2017 Documentation is a little thin here. Does anyone have a working example of how to get a file (or files) properly copied into the destination image? Specifically I'm trying to get a binary copied into /sbin on the target. TAIA Quote To add files to image easily, put them in userpatches/overlay and access them in /tmp/overlay from customize-image.sh
g40 Posted August 24, 2017 Author Posted August 24, 2017 So, after some digging around I discovered the following: 1. Any files placed in userpatches/overlay automatically get copied by the build process into /tmp/overlay 2. Shortly before the image is finalized, customize-image.sh is run. This is run at the root of the file system '/' as shown by calling `pwd` and `ls -als` from the script itself (see snippet below) 3. So the answer to the copy question is pretty simple. Simply add a line calling `cp /tmp/overlay/myfile` to the destination folder of your choice. Place this where it suits and optionally test the parameters passed to the script for build type/board name etc. Hope this helps someone else. Will add to my upcoming documentation PR. [ o.k. ] Calling image customization script [ customize-image.sh ] Inside Main() pwd / ls -als 0 drwxr-xr-x 21 root root 420 Aug 24 12:52 . 0 drwxr-xr-x 21 root root 420 Aug 24 12:52 .. 0 drwxr-xr-x 2 root root 3120 Aug 23 13:38 bin 0 drwxr-xr-x 4 root root 340 Aug 24 12:54 boot 0 drwxr-xr-x 19 root root 4240 Aug 22 19:27 dev 0 drwxr-xr-x 91 root root 3520 Aug 24 12:55 etc 0 drwxr-xr-x 2 root root 40 Jul 17 04:02 home 0 drwxr-xr-x 19 root root 640 Aug 24 12:54 lib 0 drwxr-xr-x 2 root root 40 Aug 23 13:33 media 0 drwxr-xr-x 2 root root 40 Aug 23 13:33 mnt 0 drwxr-xr-x 2 root root 40 Aug 23 13:33 opt 0 dr-xr-xr-x 299 root root 0 Aug 13 17:18 proc 0 drwx------ 2 root root 100 Aug 24 12:52 root 0 drwxr-xr-x 2 root root 60 Aug 24 12:52 run 0 drwxr-xr-x 2 root root 3600 Aug 23 13:38 sbin 0 drwxrwxr-x 2 root root 40 Aug 24 12:52 selinux 0 drwxr-xr-x 2 root root 40 Aug 23 13:33 srv 0 dr-xr-xr-x 13 root root 0 Aug 24 12:36 sys 0 drwxrwxrwt 3 root root 80 Aug 24 12:55 tmp 0 drwxr-xr-x 10 root root 200 Aug 23 13:33 usr 0 drwxr-xr-x 11 root root 260 Aug 23 13:33 var
Recommended Posts