Community
cancel
Showing results for 
Search instead for 
Did you mean: 
SR11
New Contributor I
1,445 Views

Recipe for copying directory into image

Hi,

Hi,

Can you please point me to any recipe which copies entire directory from source to specified path in destination.

Regards

Srikanth

8 Replies
FBuit
Innovator
73 Views

If you want to access to the mass storage you can check this :

Regards

Pedro_M_Intel
Employee
73 Views

Hello Blackhole,

What exactly are you trying to achieve? Do you want to have access to a mass storage device as Fran.B suggested? If so, this other link is also helpful:

Peter.

SR11
New Contributor I
73 Views

hi peter,

i'm not trying to copy to usb mass storage. I want my directory to be included at the time of creating image rather than requiring to copy it using SCP etc. later.

Regards

Srikanth

Pedro_M_Intel
Employee
73 Views

I believe it is simpler to create a service that mounts the flash drive on boot. It is quite simple and should not take that much time. You will need two files, the first one is a shell script that we'll call mount_flash_drive_on_boot.sh and, for the sake of this example, it will be stored in /home/root/:

# !/bin/sh

# Create the directory in case it doesn't exist, if the directory exists the command will be skipped by default

mkdir /media/fhdr

# Mount the flash drive if it exists, if it doesn't skip this command.

mount /dev/sda1 /media/fhdr

Once you've created this file in your Edison, make it executable with:

chmod +x mount_flash_drive_on_boot.sh

Now we need to create the service that will start the script on boot. The service can be called however you like but it must have the extension .service. In this example it will be called mount_flash_drive_on_boot.service. All services must be stored in /lib/systemd/system/:

# !/bin/sh

[Unit]

Description=Service that mounts a flash drive connected to Edison on boot to the directory found in /dev/fhdr

[Service]

ExecStart=/home/root/mount_flash_drive_on_boot.sh

Type=idle

[Install]

WantedBy=basic.target

Once you've created this file you can enable it with the command:

systemctl enable mount_flash_drive_on_boot.sh

After this is done you should be able to see that your flash drive is detected and mounted on boot (if it is connected of course).

Peter.

SR11
New Contributor I
73 Views

Hi Peter,

I don't want to expose these files outside. That's why I prefer not using USB mass storage.

Also, from point of mass production, it will be better if I avoid any extra steps after flashingthe image.

Regards

Srikanth

Pedro_M_Intel
Employee
73 Views

I understand, in that case, you can take this recipe as an example: https://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-edison/tree/meta-intel-edison-distro/recipes-s... https://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-edison/tree/meta-intel-edison-distro/recipes-s....

As you can see in it, what it does is "install" a service that blinks the Edison's LED. But as you may know, a service is not the same as a package, it does not need to be installed, it just needs a couple of files to be stored correctly. In the recipe you can find the directory called files, there you will see precisely the service files called blink-led and blink-led.service.

Now, if you read the content of blink-led_0.1.bb, you can see that the recipe is, again, "installing" the files and the specific location where they will be stored.

In case of blink-led, it will be stored in /bin/ and in case of blink-led.service, it will be stored in /lib/systemd/system/. So, I'd suggest you to take this recipe as an example to take your files and store them in your custom image.

Peter.

SR11
New Contributor I
73 Views

Hi,

Thank you..

Recipe for oobie ( ) may be better example here. As it is directly using cp -r to copy the whole directory instead of individual files.

Regards

Srikanth

Matthias_H_Intel
Employee
73 Views

I would create a recipe "additionalStuff_0.1.bb" or so which just copies over the directory in the "do_install" section. Then include this package in the list of packages for your image. That should do the job

Reply