Reputation: 3349
I have written a simple script to use a 3G UMTS Dongle with my board.
The bash script is as follows:
#!/bin/bash
sleep 1;
/usr/bin/tmux new-session -d -s Cloud
/usr/bin/tmux set-option set-remain-on-exit on
/usr/bin/tmux new-window -d -n 'usb_modeswitch' -t Cloud:2 '/usr/sbin/usb_modeswitch --default-vendor 12d1 --default-product 1446 -J';
/usr/bin/tmux new-window -d -n 'wvdial' -t Cloud:1 'sleep 10; /usr/bin/wvdialconf; /usr/bin/wvdial';
and its corresponding systemd
script is as follows:
[Unit]
Description=Enable UMTS Dongle for Cloud Connectivity
[Service]
Type=oneshot
ExecStart=/usr/umts.sh
RemainAfterExit=true
[Install]
WantedBy=default.target
I have other such systemd
files for certain applications files that I have currently written directly on the board but want them to be available for every image I make for new board.
How should I go around with this in terms of a recipe?
I thought of creating my own Yocto layer:
meta-custom
------ recipes-custom/
------------- files / all such scripts here
------------ custom_1.0.bb
Should I only perform do_install()
the bash scripts in the custom_1.0.bb
recipes? since the scripts do not require to be compile?
Upvotes: 4
Views: 3666
Reputation: 1257
Creating own layer is a good idea and structure you listed is fine too.
in your recipes you can create empty do_compile and do_configure tasks\ here is a pseudo recipe. And dont forget to add it to IMAGE_INSTALL in the end so that your image build picks it up as dependency.
SRC_URI = "file://file.service \
file://file.sh \
"
inherit systemd
do_configure(){
:
}
do_compile() {
:
}
do_install() {
install -Dm 0644 ${WORKDIR}/<file.service> ${D}/${systemd_unitdir}/system/<file.service>
install -Dm 0755 ${WORKDIR}/<file.sh> ${D}/${bindir}/<file.sh>
...
}
SYSTEMD_SERVICE_${PN} = "<file.service>"
Upvotes: 6