summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcajun-rat <p@beta16.co.uk>2017-08-04 16:28:15 +0200
committerGitHub <noreply@github.com>2017-08-04 16:28:15 +0200
commitba233570a3a380c62a7fb31ad00b9a7a3fd4b42e (patch)
tree7272786cd44f933738455638d5969630b04cfb1d
parent7643e4da141c10bcb017d7a216512febe08da68a (diff)
parent621c2c6f2480b9e8f8b7bb6e6453c777952aa10e (diff)
downloadmeta-updater-ba233570a3a380c62a7fb31ad00b9a7a3fd4b42e.tar.gz
Merge pull request #116 from leon-anavi/krogoth
Krogoth
-rw-r--r--.gitignore1
-rw-r--r--README.adoc6
-rw-r--r--classes/image_types_ostree.bbclass65
-rw-r--r--classes/image_types_ota.bbclass58
-rw-r--r--classes/sdcard_image-dra7xx-evm-ota.bbclass72
-rw-r--r--classes/sdcard_image-minnowboard-ota.bbclass78
-rw-r--r--classes/sdcard_image-porter-ota.bbclass78
-rw-r--r--classes/sdcard_image-rpi-ota.bbclass16
-rw-r--r--classes/sota.bbclass33
-rw-r--r--classes/sota_am335x-evm-wifi.bbclass18
-rw-r--r--classes/sota_bleeding.inc1
-rw-r--r--classes/sota_m3ulcb.bbclass9
-rw-r--r--classes/sota_minnowboard.bbclass7
-rw-r--r--classes/sota_minnowboard_uboot.inc8
-rw-r--r--classes/sota_none.bbclass4
-rw-r--r--classes/sota_porter.bbclass10
-rw-r--r--classes/sota_qemux86-64.bbclass11
-rw-r--r--classes/sota_raspberrypi.bbclass11
-rw-r--r--conf/distro/poky-sota-systemd.conf1
-rw-r--r--conf/distro/sota.conf.inc51
-rw-r--r--conf/include/bblayers/sota.inc5
-rw-r--r--conf/include/bblayers/sota_am335x-evm.inc2
-rw-r--r--conf/include/bblayers/sota_intel-corei7-64.inc2
-rw-r--r--conf/include/bblayers/sota_m3ulcb.inc2
-rw-r--r--conf/include/bblayers/sota_porter.inc2
-rw-r--r--conf/include/bblayers/sota_qemux86-64.inc2
-rw-r--r--conf/include/bblayers/sota_raspberrypi2.inc2
-rw-r--r--conf/include/bblayers/sota_raspberrypi3.inc2
-rw-r--r--recipes-bsp/grub/grub-efi_%.bbappend2
-rw-r--r--recipes-bsp/u-boot/u-boot_2016.11.bb6
-rw-r--r--recipes-core/images/initramfs-ostree-image.bb5
-rw-r--r--recipes-devtools/pseudo/files/0001-Add-check-for-existence-of-old-file-to-renameat.patch40
-rw-r--r--recipes-devtools/pseudo/files/fallback-group2
-rw-r--r--recipes-devtools/pseudo/files/fallback-passwd1
-rw-r--r--recipes-devtools/pseudo/pseudo_1.7.5.bbappend3
-rw-r--r--recipes-devtools/pseudo/pseudo_1.8.1.bb20
-rw-r--r--recipes-sota/aktualizr/aktualizr_git.bb39
-rw-r--r--recipes-sota/aktualizr/files/aktualizr-autoprovision.service14
-rw-r--r--recipes-sota/aktualizr/files/aktualizr-manual-provision.service13
-rw-r--r--recipes-sota/aktualizr/files/sota_autoprov.toml18
-rw-r--r--recipes-sota/ostree-initrd/files/init.sh35
-rw-r--r--recipes-sota/ostree-initrd/ostree-initrd.bb5
-rw-r--r--recipes-sota/ostree/ostree_git.bb35
-rw-r--r--recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service16
-rw-r--r--recipes-sota/rvi-sota-client/files/sota-client-ostree.service13
-rw-r--r--recipes-sota/rvi-sota-client/files/sota-client-uptane.service15
-rw-r--r--recipes-sota/rvi-sota-client/files/sota-installer.service12
-rw-r--r--recipes-sota/rvi-sota-client/rvi-sota-client.inc143
-rw-r--r--recipes-sota/rvi-sota-client/rvi-sota-client_git.bb155
-rw-r--r--recipes-sota/rvi-sota-client/sota-installer_git.bb25
-rw-r--r--recipes-sota/rvi-sota-client/sota-launcher_git.bb15
-rw-r--r--recipes-sota/sota-tools/sota-tools_git.bb2
-rw-r--r--recipes-support/fuse/fuse_%.bbappend4
-rw-r--r--recipes-support/glib-networking/glib-networking_%.bbappend2
-rw-r--r--recipes-support/gpgme/gpgme_%.bbappend2
-rw-r--r--recipes-support/libgit2/libgit2-release.inc2
-rw-r--r--recipes-support/libgit2/libgit2.inc19
-rw-r--r--recipes-support/libgit2/libgit2_0.24.1.bb4
-rw-r--r--recipes-support/libgsystem/libgsystem_git.bb8
-rw-r--r--recipes-support/libsoup/libsoup-2.4_%.bbappend4
-rw-r--r--recipes-support/libssh2/libssh2_%.bbappend2
-rw-r--r--recipes-support/lshw/lshw_02.16.bb5
-rw-r--r--recipes-support/python-canonicaljson/python-canonicaljson.bb18
-rw-r--r--recipes-support/python-frozendict/python-frozendict.bb12
-rw-r--r--recipes-support/python-petname/python-petname.bb16
-rw-r--r--recipes-support/util-linux/util-linux_%.bbappend11
-rw-r--r--recipes-test/big-update/big-update_1.0.bb11
-rw-r--r--recipes-test/big-update/big-update_2.0.bb11
-rw-r--r--recipes-test/big-update/files/rand_file.py16
-rwxr-xr-xscripts/envsetup.sh35
-rw-r--r--scripts/lib/wic/canned-wks/efiimage-sota.wks8
-rw-r--r--scripts/lib/wic/canned-wks/grub-ota.cfg2
-rw-r--r--scripts/lib/wic/canned-wks/sdimage-sota.wks7
-rw-r--r--scripts/lib/wic/plugins/source/otaimage.py68
-rwxr-xr-xscripts/qa60
-rwxr-xr-xscripts/run-qemu-ota150
-rwxr-xr-xscripts/runqemu575
-rwxr-xr-xscripts/runqemu-addptable2image51
-rwxr-xr-xscripts/runqemu-export-rootfs163
-rwxr-xr-xscripts/runqemu-extract-sdk104
-rwxr-xr-xscripts/runqemu-gen-tapdevs100
-rwxr-xr-xscripts/runqemu-ifdown66
-rwxr-xr-xscripts/runqemu-ifup121
-rwxr-xr-xscripts/runqemu-internal760
-rw-r--r--scripts/runqemu.README42
-rw-r--r--templates/README.md10
-rw-r--r--templates/feature/agl-sota/50_bblayers.conf.inc7
-rw-r--r--templates/feature/agl-sota/50_local.conf.inc15
88 files changed, 1089 insertions, 2593 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..bee8a64
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
__pycache__
diff --git a/README.adoc b/README.adoc
index f8e8ada..d625780 100644
--- a/README.adoc
+++ b/README.adoc
@@ -4,13 +4,13 @@ This layer enables over-the-air updates (OTA) with https://github.com/ostreedev/
4 4
5https://github.com/ostreedev/ostree[OSTree] is a tool for atomic full file system upgrades with rollback capability. OSTree has several advantages over traditional dual-bank systems, but the most important one is that it minimizes network bandwidth and data storage footprint by sharing files with the same contents across file system deployments. 5https://github.com/ostreedev/ostree[OSTree] is a tool for atomic full file system upgrades with rollback capability. OSTree has several advantages over traditional dual-bank systems, but the most important one is that it minimizes network bandwidth and data storage footprint by sharing files with the same contents across file system deployments.
6 6
7https://github.com/advancedtelematic/rvi_sota_client[RVI SOTA client] adds authentication and provisioning capabilities to OTA and is integrated with OSTree. It connects to https://github.com/advancedtelematic/rvi_sota_server[RVI SOTA server]. 7https://github.com/advancedtelematic/rvi_sota_client[RVI SOTA client] and/or https://github.com/advancedtelematic/aktualizr[aktualizr] add authentication and provisioning capabilities to OTA and are integrated with OSTree. You can connect with the open-source https://github.com/advancedtelematic/rvi_sota_server[RVI SOTA server] or sign up for a free account at https://app.atsgarage.com[ATS Garage] to get started.
8 8
9== Build 9== Build
10 10
11=== Quickstart 11=== Quickstart
12 12
13If you don't already have a Yocto project that you want to add OTA to, you can use the https://github.com/advancedtelematic/garage-quickstart-rpi[ATS Garage Quickstart] project to rapidly get up and running on a Raspberry Pi. It takes a standard https://www.yoctoproject.org/tools-resources/projects/poky[poky] distribution, and adds OTA and OSTree capabilities. For a detailed getting started tutorial see the https://github.com/advancedtelematic/garage-quickstart-rpi/blob/master/README.adoc[README]. 13If you don't already have a Yocto project that you want to add OTA to, you can use the https://docs.atsgarage.com/quickstarts/raspberry-pi.html[ATS Garage Quickstart] project to rapidly get up and running on a Raspberry Pi. It takes a standard https://www.yoctoproject.org/tools-resources/projects/poky[poky] distribution, and adds OTA and OSTree capabilities.
14 14
15=== Adding meta-updater capabilities to your build 15=== Adding meta-updater capabilities to your build
16 16
@@ -18,7 +18,7 @@ If you already have a Yocto-based project and you want to add atomic filesystem
18 18
191. Clone the `meta-updater` layer and add it to your https://www.yoctoproject.org/docs/2.1/ref-manual/ref-manual.html#structure-build-conf-bblayers.conf[bblayers.conf]. 191. Clone the `meta-updater` layer and add it to your https://www.yoctoproject.org/docs/2.1/ref-manual/ref-manual.html#structure-build-conf-bblayers.conf[bblayers.conf].
202. Clone BSP integration layer (meta-updater-$\{PLATFORM}, e.g. https://github.com/advancedtelematic/meta-updater-raspberrypi[meta-updater-raspberrypi]) and add it to your conf/bblayers.conf. If your board isn't supported yet, you could write a BSP integration for it yourself. See the <<Adding support for your board>> section for the details. 202. Clone BSP integration layer (meta-updater-$\{PLATFORM}, e.g. https://github.com/advancedtelematic/meta-updater-raspberrypi[meta-updater-raspberrypi]) and add it to your conf/bblayers.conf. If your board isn't supported yet, you could write a BSP integration for it yourself. See the <<Adding support for your board>> section for the details.
213. Set up your https://www.yoctoproject.org/docs/2.1/ref-manual/ref-manual.html#var-DISTRO[distro]. If you are using "poky", the default distro in Yocto, you can change it in your conf/local.conf to "poky-sota". Alternatively, if you are using your own or third party distro configuration, you can add 'require conf/distro/sota.conf.inc' to it, thus combining capabilities of your distro with meta-updater features. 213. Set up your https://www.yoctoproject.org/docs/2.1/ref-manual/ref-manual.html#var-DISTRO[distro]. If you are using "poky", the default distro in Yocto, you can change it in your conf/local.conf to "poky-sota". Alternatively, if you are using your own or third party distro configuration, you can add 'INHERIT += " sota"' to it, thus combining capabilities of your distro with meta-updater features.
22 22
23You can then build your image as usual, with bitbake. After building the root file system, bitbake will then create an https://ostree.readthedocs.io/en/latest/manual/adapting-existing/[OSTree-enabled version] of it, commit it to your local OSTree repo and (optionally) push it to a remote server. Additionally, a live disk image will be created (normally named $\{IMAGE_NAME}.-sdimg-ota e.g. core-image-raspberrypi3.rpi-sdimg-ota). You can control this behaviour through <<variables in your local.conf,OSTree-related variables in your local.conf>>. 23You can then build your image as usual, with bitbake. After building the root file system, bitbake will then create an https://ostree.readthedocs.io/en/latest/manual/adapting-existing/[OSTree-enabled version] of it, commit it to your local OSTree repo and (optionally) push it to a remote server. Additionally, a live disk image will be created (normally named $\{IMAGE_NAME}.-sdimg-ota e.g. core-image-raspberrypi3.rpi-sdimg-ota). You can control this behaviour through <<variables in your local.conf,OSTree-related variables in your local.conf>>.
24 24
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass
index 8bc0a52..ac7cb60 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -3,8 +3,9 @@
3inherit image 3inherit image
4 4
5IMAGE_DEPENDS_ostree = "ostree-native:do_populate_sysroot \ 5IMAGE_DEPENDS_ostree = "ostree-native:do_populate_sysroot \
6 openssl-native:do_populate_sysroot \
6 virtual/kernel:do_deploy \ 7 virtual/kernel:do_deploy \
7 ${OSTREE_INITRAMFS_IMAGE}:do_image_ext4" 8 ${OSTREE_INITRAMFS_IMAGE}:do_image_complete"
8 9
9export OSTREE_REPO 10export OSTREE_REPO
10export OSTREE_BRANCHNAME 11export OSTREE_BRANCHNAME
@@ -16,6 +17,36 @@ OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}"
16 17
17export SYSTEMD_USED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', '', d)}" 18export SYSTEMD_USED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', '', d)}"
18 19
20python () {
21 if d.getVar("SOTA_PACKED_CREDENTIALS", True):
22 if d.getVar("SOTA_AUTOPROVISION_CREDENTIALS", True):
23 bb.warn("SOTA_AUTOPROVISION_CREDENTIALS are overriden by those in SOTA_PACKED_CREDENTIALS")
24 if d.getVar("SOTA_AUTOPROVISION_URL", True):
25 bb.warn("SOTA_AUTOPROVISION_URL is overriden by the one in SOTA_PACKED_CREDENTIALS")
26
27 if d.getVar("SOTA_AUTOPROVISION_URL_FILE", True):
28 bb.warn("SOTA_AUTOPROVISION_URL_FILE is overriden by the one in SOTA_PACKED_CREDENTIALS")
29
30 if d.getVar("OSTREE_PUSH_CREDENTIALS", True):
31 bb.warn("OSTREE_PUSH_CREDENTIALS are overriden by those in SOTA_PACKED_CREDENTIALS")
32
33 d.setVar("SOTA_AUTOPROVISION_CREDENTIALS", "%s/sota_credentials/autoprov_credentials.p12" % d.getVar("DEPLOY_DIR_IMAGE", True))
34 d.setVar("SOTA_AUTOPROVISION_URL_FILE", "%s/sota_credentials/autoprov.url" % d.getVar("DEPLOY_DIR_IMAGE", True))
35 d.setVar("OSTREE_PUSH_CREDENTIALS", "%s/sota_credentials/treehub.json" % d.getVar("DEPLOY_DIR_IMAGE", True))
36}
37
38IMAGE_DEPENDS_ostreecredunpack = "unzip-native:do_populate_sysroot"
39
40IMAGE_CMD_ostreecredunpack () {
41 if [ ${SOTA_PACKED_CREDENTIALS} ]; then
42 rm -rf ${DEPLOY_DIR_IMAGE}/sota_credentials
43
44 unzip ${SOTA_PACKED_CREDENTIALS} -d ${DEPLOY_DIR_IMAGE}/sota_credentials
45 fi
46}
47
48IMAGE_TYPEDEP_ostree = "ostreecredunpack"
49
19IMAGE_CMD_ostree () { 50IMAGE_CMD_ostree () {
20 if [ -z "$OSTREE_REPO" ]; then 51 if [ -z "$OSTREE_REPO" ]; then
21 bbfatal "OSTREE_REPO should be set in your local.conf" 52 bbfatal "OSTREE_REPO should be set in your local.conf"
@@ -68,6 +99,10 @@ IMAGE_CMD_ostree () {
68 ln -s ../init.d/tmpfiles.sh usr/etc/rcS.d/S20tmpfiles.sh 99 ln -s ../init.d/tmpfiles.sh usr/etc/rcS.d/S20tmpfiles.sh
69 fi 100 fi
70 101
102 # Preserve OSTREE_BRANCHNAME for future information
103 mkdir -p usr/share/sota/
104 echo -n "${OSTREE_BRANCHNAME}" > usr/share/sota/branchname
105
71 # Preserve data in /home to be later copied to /sysroot/home by 106 # Preserve data in /home to be later copied to /sysroot/home by
72 # sysroot generating procedure 107 # sysroot generating procedure
73 mkdir -p usr/homedirs 108 mkdir -p usr/homedirs
@@ -110,6 +145,27 @@ IMAGE_CMD_ostree () {
110 ln -sf var/roothome root 145 ln -sf var/roothome root
111 fi 146 fi
112 147
148 # deploy SOTA credentials
149 mkdir -p var/sota
150
151 if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then
152 EXPDATE=`openssl pkcs12 -in ${SOTA_AUTOPROVISION_CREDENTIALS} -password "pass:" -nodes 2>/dev/null | openssl x509 -noout -enddate | cut -f2 -d "="`
153
154 if [ `date +%s` -ge `date -d "${EXPDATE}" +%s` ]; then
155 bberror "Certificate ${SOTA_AUTOPROVISION_CREDENTIALS} has expired on ${EXPDATE}"
156 fi
157
158 cp ${SOTA_AUTOPROVISION_CREDENTIALS} var/sota/sota_provisioning_credentials.p12
159 if [ -n "${SOTA_AUTOPROVISION_URL_FILE}" ]; then
160 export SOTA_AUTOPROVISION_URL=`cat ${SOTA_AUTOPROVISION_URL_FILE}`
161 fi
162 echo "SOTA_GATEWAY_URI=${SOTA_AUTOPROVISION_URL}" > var/sota/sota_provisioning_url.env
163 fi
164
165 if [ -n "${SOTA_SECONDARY_ECUS}" ]; then
166 cp ${SOTA_SECONDARY_ECUS} var/sota/ecus
167 fi
168
113 # Creating boot directories is required for "ostree admin deploy" 169 # Creating boot directories is required for "ostree admin deploy"
114 170
115 mkdir -p boot/loader.0 171 mkdir -p boot/loader.0
@@ -122,7 +178,7 @@ IMAGE_CMD_ostree () {
122 cp ${DEPLOY_DIR_IMAGE}/${OSTREE_INITRAMFS_IMAGE}-${MACHINE}${RAMDISK_EXT} boot/initramfs-${checksum} 178 cp ${DEPLOY_DIR_IMAGE}/${OSTREE_INITRAMFS_IMAGE}-${MACHINE}${RAMDISK_EXT} boot/initramfs-${checksum}
123 179
124 # Copy image manifest 180 # Copy image manifest
125 cat ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.manifest | cut -d " " -f1,3 > usr/package.manifest 181 cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest
126 182
127 cd ${WORKDIR} 183 cd ${WORKDIR}
128 184
@@ -151,9 +207,10 @@ IMAGE_CMD_ostree () {
151IMAGE_TYPEDEP_ostreepush = "ostree" 207IMAGE_TYPEDEP_ostreepush = "ostree"
152IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot" 208IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot"
153IMAGE_CMD_ostreepush () { 209IMAGE_CMD_ostreepush () {
154 if [ ${OSTREE_PUSH_CREDENTIALS} ]; then 210 if [ -n "${OSTREE_PUSH_CREDENTIALS}" ]; then
155 garage-push --repo=${OSTREE_REPO} \ 211 garage-push --repo=${OSTREE_REPO} \
156 --ref=${OSTREE_BRANCHNAME} \ 212 --ref=${OSTREE_BRANCHNAME} \
157 --credentials=${OSTREE_PUSH_CREDENTIALS} 213 --credentials=${OSTREE_PUSH_CREDENTIALS} \
214 --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt
158 fi 215 fi
159} 216}
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass
index bee1ea4..09c30ff 100644
--- a/classes/image_types_ota.bbclass
+++ b/classes/image_types_ota.bbclass
@@ -9,12 +9,11 @@
9 9
10inherit image 10inherit image
11 11
12IMAGE_DEPENDS_otaimg = "e2fsprogs-native:do_populate_sysroot" 12OSTREE_BOOTLOADER ??= 'u-boot'
13 13
14# For qemux86 u-boot is not included in any live image and is built separately 14IMAGE_DEPENDS_otaimg = "e2fsprogs-native:do_populate_sysroot \
15IMAGE_DEPENDS_otaimg_append_qemux86 = " virtual/bootloader:do_deploy" 15 ${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER', True) == 'grub' else ''} \
16IMAGE_DEPENDS_otaimg_append_qemux86-64 = " virtual/bootloader:do_deploy" 16 ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot' else ''}"
17IMAGE_DEPENDS_otaimg_append_corei7-64-intel-common = " virtual/bootloader:do_deploy"
18 17
19calculate_size () { 18calculate_size () {
20 BASE=$1 19 BASE=$1
@@ -52,6 +51,7 @@ calculate_size () {
52export OSTREE_OSNAME 51export OSTREE_OSNAME
53export OSTREE_BRANCHNAME 52export OSTREE_BRANCHNAME
54export OSTREE_REPO 53export OSTREE_REPO
54export OSTREE_BOOTLOADER
55 55
56IMAGE_CMD_otaimg () { 56IMAGE_CMD_otaimg () {
57 if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'true', 'false', d)}; then 57 if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'true', 'false', d)}; then
@@ -76,32 +76,36 @@ IMAGE_CMD_otaimg () {
76 mkdir -p ${PHYS_SYSROOT}/boot/loader.0 76 mkdir -p ${PHYS_SYSROOT}/boot/loader.0
77 ln -s loader.0 ${PHYS_SYSROOT}/boot/loader 77 ln -s loader.0 ${PHYS_SYSROOT}/boot/loader
78 78
79 touch ${PHYS_SYSROOT}/boot/loader/uEnv.txt 79 if [ "${OSTREE_BOOTLOADER}" = "grub" ]; then
80 mkdir -p ${PHYS_SYSROOT}/boot/grub2
81 touch ${PHYS_SYSROOT}/boot/grub2/grub.cfg
82 elif [ "${OSTREE_BOOTLOADER}" = "u-boot" ]; then
83 touch ${PHYS_SYSROOT}/boot/loader/uEnv.txt
84 else
85 bberror "Invalid bootloader: ${OSTREE_BOOTLOADER}"
86 fi;
80 87
81 ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${OSTREE_BRANCHNAME} 88 ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${OSTREE_BRANCHNAME}
82 ostree admin --sysroot=${PHYS_SYSROOT} deploy --os=${OSTREE_OSNAME} ${OSTREE_OSNAME}:${OSTREE_BRANCHNAME} 89 export OSTREE_BOOT_PARTITION="/boot"
83 90 kargs_list=""
84 # Copy deployment /home to sysroot 91 for arg in ${OSTREE_KERNEL_ARGS}; do
92 kargs_list="${kargs_list} --karg-append=$arg"
93 done
94
95 ostree admin --sysroot=${PHYS_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${OSTREE_BRANCHNAME}
96
97 # Copy deployment /home and /var/sota to sysroot
85 HOME_TMP=`mktemp -d ${WORKDIR}/home-tmp-XXXXX` 98 HOME_TMP=`mktemp -d ${WORKDIR}/home-tmp-XXXXX`
86 tar --xattrs --xattrs-include='*' -C ${HOME_TMP} -xf ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 ./usr/homedirs 99 tar --xattrs --xattrs-include='*' -C ${HOME_TMP} -xf ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 ./usr/homedirs ./var/sota ./var/local || true
87 mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ 100 mv ${HOME_TMP}/var/sota ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/ || true
101 mv ${HOME_TMP}/var/local ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/ || true
102 # Create /var/sota if it doesn't exist yet
103 mkdir -p ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota || true
104 mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ || true
105 # Ensure that /var/local exists (AGL symlinks /usr/local to /var/local)
106 install -d ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/local
88 rm -rf ${HOME_TMP} 107 rm -rf ${HOME_TMP}
89 108
90 # Deploy device credentials
91 if [ -n "$SOTA_CREDENTIALS" ]; then
92 if [ -f "$SOTA_CREDENTIALS" ]; then
93 EXT=`basename $SOTA_CREDENTIALS | cut -d'.' -f2`
94 if [ "$EXT" != "toml" ]; then
95 bbwarn "File\'s extension is not \'toml\', make sure you have the correct file"
96 fi
97
98 cat $SOTA_CREDENTIALS | sed 's/^package_manager = .*$/package_manager = "ostree"/' > ${PHYS_SYSROOT}/boot/sota.toml
99 chmod 644 ${PHYS_SYSROOT}/boot/sota.toml
100 else
101 bberror "File $SOTA_CREDENTIALS does not exist"
102 fi
103 fi
104
105 # Calculate image type 109 # Calculate image type
106 OTA_ROOTFS_SIZE=$(calculate_size `du -ks $PHYS_SYSROOT | cut -f 1` "${IMAGE_OVERHEAD_FACTOR}" "${IMAGE_ROOTFS_SIZE}" "${IMAGE_ROOTFS_MAXSIZE}" `expr ${IMAGE_ROOTFS_EXTRA_SPACE}` "${IMAGE_ROOTFS_ALIGNMENT}") 110 OTA_ROOTFS_SIZE=$(calculate_size `du -ks $PHYS_SYSROOT | cut -f 1` "${IMAGE_OVERHEAD_FACTOR}" "${IMAGE_ROOTFS_SIZE}" "${IMAGE_ROOTFS_MAXSIZE}" `expr ${IMAGE_ROOTFS_EXTRA_SPACE}` "${IMAGE_ROOTFS_ALIGNMENT}")
107 111
@@ -118,7 +122,7 @@ IMAGE_CMD_otaimg () {
118 rm -rf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg 122 rm -rf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg
119 sync 123 sync
120 dd if=/dev/zero of=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg seek=$OTA_ROOTFS_SIZE count=$COUNT bs=1024 124 dd if=/dev/zero of=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg seek=$OTA_ROOTFS_SIZE count=$COUNT bs=1024
121 mkfs.ext4 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg -d ${PHYS_SYSROOT} 125 mkfs.ext4 -O ^64bit ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg -L otaroot -d ${PHYS_SYSROOT}
122 rm -rf ${PHYS_SYSROOT} 126 rm -rf ${PHYS_SYSROOT}
123 127
124 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.otaimg 128 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.otaimg
diff --git a/classes/sdcard_image-dra7xx-evm-ota.bbclass b/classes/sdcard_image-dra7xx-evm-ota.bbclass
deleted file mode 100644
index f023649..0000000
--- a/classes/sdcard_image-dra7xx-evm-ota.bbclass
+++ /dev/null
@@ -1,72 +0,0 @@
1inherit image_types
2
3# Boot partition volume id
4BOOTDD_VOLUME_ID ?= "${MACHINE}"
5
6# Boot partition size [in KiB] (will be rounded up to IMAGE_ROOTFS_ALIGNMENT)
7BOOT_SPACE ?= "4096"
8
9IMAGE_ROOTFS_ALIGNMENT = "4096"
10SDIMG_OTA_ROOTFS_TYPE ?= "otaimg"
11SDIMG_OTA_ROOTFS = "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${SDIMG_OTA_ROOTFS_TYPE}"
12
13IMAGE_TYPEDEP_dra7xx-evm-sdimg-ota = "${SDIMG_OTA_ROOTFS_TYPE}"
14IMAGE_DEPENDS_dra7xx-evm-sdimg-ota = " \
15 parted-native \
16 mtools-native \
17 dosfstools-native \
18 "
19
20SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.dra7xx-evm-sdimg-ota"
21
22IMAGE_CMD_dra7xx-evm-sdimg-ota () {
23 OTAROOT_SIZE=`du -Lb ${SDIMG_OTA_ROOTFS} | cut -f1`
24 OTAROOT_SIZE=$(expr ${OTAROOT_SIZE} / 1024 + 1)
25 BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1)
26 BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT})
27 SDIMG_OTA_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $OTAROOT_SIZE)
28
29 echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $OTAROOT_SIZE KiB"
30
31 # Initialize sdcard image file
32 dd if=/dev/zero of=${SDIMG_OTA} bs=1024 count=0 seek=${SDIMG_OTA_SIZE}
33
34 # Create partition table
35 parted -s ${SDIMG_OTA} mklabel msdos
36 # Create boot partition and mark it as bootable
37 parted -s ${SDIMG_OTA} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT})
38 parted -s ${SDIMG_OTA} set 1 boot on
39 # Create rootfs partition to the end of disk
40 parted -s ${SDIMG_OTA} -- unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) -1s
41 parted ${SDIMG_OTA} print
42
43 # Create a vfat image with boot files
44 BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG_OTA} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }')
45 rm -f ${WORKDIR}/boot.img
46 mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS
47 sync
48
49 sync
50 #dd if=${WORKDIR}/boot.img of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
51
52 if echo "${SDIMG_OTA_ROOTFS_TYPE}" | egrep -q "*\.xz"
53 then
54 xzcat ${SDIMG_OTA_ROOTFS} | dd of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
55 else
56 dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
57 fi
58
59 # Optionally apply compression
60 case "${SDIMG_OTA_COMPRESSION}" in
61 "gzip")
62 gzip -k9 "${SDIMG_OTA}"
63 ;;
64 "bzip2")
65 bzip2 -k9 "${SDIMG_OTA}"
66 ;;
67 "xz")
68 xz -k "${SDIMG_OTA}"
69 ;;
70 esac
71}
72
diff --git a/classes/sdcard_image-minnowboard-ota.bbclass b/classes/sdcard_image-minnowboard-ota.bbclass
deleted file mode 100644
index c49b3cd..0000000
--- a/classes/sdcard_image-minnowboard-ota.bbclass
+++ /dev/null
@@ -1,78 +0,0 @@
1inherit image_types
2
3# Boot partition volume id
4BOOTDD_VOLUME_ID ?= "${MACHINE}"
5
6# Boot partition size [in KiB] (will be rounded up to IMAGE_ROOTFS_ALIGNMENT)
7BOOT_SPACE ?= "4096"
8
9IMAGE_ROOTFS_ALIGNMENT = "4096"
10SDIMG_OTA_ROOTFS_TYPE ?= "otaimg"
11SDIMG_OTA_ROOTFS = "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${SDIMG_OTA_ROOTFS_TYPE}"
12
13IMAGE_TYPEDEP_minnowboard-sdimg-ota = "${SDIMG_OTA_ROOTFS_TYPE}"
14IMAGE_DEPENDS_minnowboard-sdimg-ota = " \
15 parted-native \
16 mtools-native \
17 dosfstools-native \
18 minnowboard-bootfiles \
19 "
20
21SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.minnowboard-sdimg-ota"
22
23IMAGE_CMD_minnowboard-sdimg-ota () {
24 OTAROOT_SIZE=`du -Lb ${SDIMG_OTA_ROOTFS} | cut -f1`
25 OTAROOT_SIZE=$(expr ${OTAROOT_SIZE} / 1024 + 1)
26 BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1)
27 BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT})
28 SDIMG_OTA_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $OTAROOT_SIZE)
29
30 echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $OTAROOT_SIZE KiB"
31
32 # Initialize sdcard image file
33 dd if=/dev/zero of=${SDIMG_OTA} bs=1024 count=0 seek=${SDIMG_OTA_SIZE}
34
35 # Create partition table
36 parted -s ${SDIMG_OTA} mklabel msdos
37 # Create boot partition and mark it as bootable
38 parted -s ${SDIMG_OTA} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT})
39 parted -s ${SDIMG_OTA} set 1 boot on
40 # Create rootfs partition to the end of disk
41 parted -s ${SDIMG_OTA} -- unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) -1s
42 parted ${SDIMG_OTA} print
43
44 # Create a vfat image with boot files
45 BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG_OTA} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }')
46 rm -f ${WORKDIR}/boot.img
47 mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS
48 sync
49
50 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/minnowboard-bootfiles/* ::/
51
52 sync
53 dd if=${WORKDIR}/boot.img of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
54
55 if echo "${SDIMG_OTA_ROOTFS_TYPE}" | egrep -q "*\.xz"
56 then
57 xzcat ${SDIMG_OTA_ROOTFS} | dd of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
58 else
59 dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
60 fi
61
62 # Optionally apply compression
63 case "${SDIMG_OTA_COMPRESSION}" in
64 "gzip")
65 gzip -k9 "${SDIMG_OTA}"
66 ;;
67 "bzip2")
68 bzip2 -k9 "${SDIMG_OTA}"
69 ;;
70 "xz")
71 xz -k "${SDIMG_OTA}"
72 ;;
73 esac
74
75 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.minnowboard-sdimg-ota
76 ln -s ${IMAGE_NAME}.minnowboard-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.minnowboard-sdimg-ota
77}
78
diff --git a/classes/sdcard_image-porter-ota.bbclass b/classes/sdcard_image-porter-ota.bbclass
deleted file mode 100644
index 5909b44..0000000
--- a/classes/sdcard_image-porter-ota.bbclass
+++ /dev/null
@@ -1,78 +0,0 @@
1inherit image_types
2
3# Boot partition volume id
4BOOTDD_VOLUME_ID ?= "${MACHINE}"
5
6# Boot partition size [in KiB] (will be rounded up to IMAGE_ROOTFS_ALIGNMENT)
7BOOT_SPACE ?= "4096"
8
9IMAGE_ROOTFS_ALIGNMENT = "4096"
10SDIMG_OTA_ROOTFS_TYPE ?= "otaimg"
11SDIMG_OTA_ROOTFS = "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${SDIMG_OTA_ROOTFS_TYPE}"
12
13IMAGE_TYPEDEP_porter-sdimg-ota = "${SDIMG_OTA_ROOTFS_TYPE}"
14IMAGE_DEPENDS_porter-sdimg-ota = " \
15 parted-native \
16 mtools-native \
17 dosfstools-native \
18 porter-bootfiles \
19 "
20
21SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.porter-sdimg-ota"
22
23IMAGE_CMD_porter-sdimg-ota () {
24 OTAROOT_SIZE=`du -Lb ${SDIMG_OTA_ROOTFS} | cut -f1`
25 OTAROOT_SIZE=$(expr ${OTAROOT_SIZE} / 1024 + 1)
26 BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1)
27 BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT})
28 SDIMG_OTA_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $OTAROOT_SIZE)
29
30 echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $OTAROOT_SIZE KiB"
31
32 # Initialize sdcard image file
33 dd if=/dev/zero of=${SDIMG_OTA} bs=1024 count=0 seek=${SDIMG_OTA_SIZE}
34
35 # Create partition table
36 parted -s ${SDIMG_OTA} mklabel msdos
37 # Create boot partition and mark it as bootable
38 parted -s ${SDIMG_OTA} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT})
39 parted -s ${SDIMG_OTA} set 1 boot on
40 # Create rootfs partition to the end of disk
41 parted -s ${SDIMG_OTA} -- unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) -1s
42 parted ${SDIMG_OTA} print
43
44 # Create a vfat image with boot files
45 BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG_OTA} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }')
46 rm -f ${WORKDIR}/boot.img
47 mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS
48 sync
49
50 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/porter-bootfiles/* ::/
51
52 sync
53 dd if=${WORKDIR}/boot.img of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
54
55 if echo "${SDIMG_OTA_ROOTFS_TYPE}" | egrep -q "*\.xz"
56 then
57 xzcat ${SDIMG_OTA_ROOTFS} | dd of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
58 else
59 dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
60 fi
61
62 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.porter-sdimg-ota
63 ln -s ${IMAGE_NAME}.porter-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.porter-sdimg-ota
64
65 # Optionally apply compression
66 case "${SDIMG_OTA_COMPRESSION}" in
67 "gzip")
68 gzip -k9 "${SDIMG_OTA}"
69 ;;
70 "bzip2")
71 bzip2 -k9 "${SDIMG_OTA}"
72 ;;
73 "xz")
74 xz -k "${SDIMG_OTA}"
75 ;;
76 esac
77}
78
diff --git a/classes/sdcard_image-rpi-ota.bbclass b/classes/sdcard_image-rpi-ota.bbclass
index ff234eb..6a6c6ad 100644
--- a/classes/sdcard_image-rpi-ota.bbclass
+++ b/classes/sdcard_image-rpi-ota.bbclass
@@ -35,6 +35,7 @@ KERNEL_INITRAMFS ?= ""
35# Kernel image name 35# Kernel image name
36SDIMG_OTA_KERNELIMAGE_raspberrypi ?= "kernel.img" 36SDIMG_OTA_KERNELIMAGE_raspberrypi ?= "kernel.img"
37SDIMG_OTA_KERNELIMAGE_raspberrypi2 ?= "kernel7.img" 37SDIMG_OTA_KERNELIMAGE_raspberrypi2 ?= "kernel7.img"
38SDIMG_OTA_KERNELIMAGE_raspberrypi3 ?= "kernel7.img"
38 39
39# Boot partition volume id 40# Boot partition volume id
40BOOTDD_VOLUME_ID ?= "${MACHINE}" 41BOOTDD_VOLUME_ID ?= "${MACHINE}"
@@ -72,6 +73,8 @@ SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.rpi-sdimg-ota"
72# Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS. 73# Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS.
73FATPAYLOAD ?= "" 74FATPAYLOAD ?= ""
74 75
76IMAGEDATESTAMP = "${@time.strftime('%Y.%m.%d',time.gmtime())}"
77IMAGE_CMD_rpi-sdimg-ota[vardepsexclude] += "IMAGEDATESTAMP"
75IMAGE_CMD_rpi-sdimg-ota[vardepsexclude] += "DATETIME" 78IMAGE_CMD_rpi-sdimg-ota[vardepsexclude] += "DATETIME"
76 79
77IMAGE_CMD_rpi-sdimg-ota () { 80IMAGE_CMD_rpi-sdimg-ota () {
@@ -123,8 +126,10 @@ IMAGE_CMD_rpi-sdimg-ota () {
123 # Copy device tree overlays to dedicated folder 126 # Copy device tree overlays to dedicated folder
124 mmd -i ${WORKDIR}/boot.img overlays 127 mmd -i ${WORKDIR}/boot.img overlays
125 for DTB in ${DT_OVERLAYS}; do 128 for DTB in ${DT_OVERLAYS}; do
126 DTB_BASE_NAME=`basename ${DTB} .dtb` 129 DTB_EXT=${DTB##*.}
127 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.dtb ::overlays/${DTB_BASE_NAME}.dtbo 130 DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
131
132 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.${DTB_EXT} ::overlays/${DTB_BASE_NAME}.${DTB_EXT}
128 done 133 done
129 fi 134 fi
130 135
@@ -145,6 +150,10 @@ IMAGE_CMD_rpi-sdimg-ota () {
145 done 150 done
146 fi 151 fi
147 152
153 # Add stamp file
154 echo "${IMAGE_NAME}-${IMAGEDATESTAMP}" > ${WORKDIR}/image-version-info
155 mcopy -i ${WORKDIR}/boot.img -v ${WORKDIR}//image-version-info ::
156
148 # Burn Partitions 157 # Burn Partitions
149 sync 158 sync
150 dd if=${WORKDIR}/boot.img of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync 159 dd if=${WORKDIR}/boot.img of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
@@ -156,9 +165,6 @@ IMAGE_CMD_rpi-sdimg-ota () {
156 dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync 165 dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
157 fi 166 fi
158 167
159 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rpi-sdimg-ota
160 ln -s ${IMAGE_NAME}.rpi-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rpi-sdimg-ota
161
162 # Optionally apply compression 168 # Optionally apply compression
163 case "${SDIMG_OTA_COMPRESSION}" in 169 case "${SDIMG_OTA_COMPRESSION}" in
164 "gzip") 170 "gzip")
diff --git a/classes/sota.bbclass b/classes/sota.bbclass
new file mode 100644
index 0000000..5073e29
--- /dev/null
+++ b/classes/sota.bbclass
@@ -0,0 +1,33 @@
1python __anonymous() {
2 if bb.utils.contains('DISTRO_FEATURES', 'sota', True, False, d):
3 d.appendVarFlag("do_image_wic", "depends", " %s:do_image_otaimg" % d.getVar("IMAGE_BASENAME", True))
4}
5
6OVERRIDES .= "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ':sota', '', d)}"
7
8SOTA_CLIENT ??= "aktualizr"
9IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT}"
10IMAGE_CLASSES += " image_types_ostree image_types_ota"
11IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush otaimg wic', ' ', d)}"
12
13WKS_FILE_sota ?= "sdimage-sota.wks"
14
15EXTRA_IMAGEDEPENDS_append_sota = " parted-native mtools-native dosfstools-native"
16
17# Please redefine OSTREE_REPO in order to have a persistent OSTree repo
18OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo"
19# For UPTANE operation, OSTREE_BRANCHNAME must start with "${MACHINE}-"
20OSTREE_BRANCHNAME ?= "${MACHINE}-ota"
21OSTREE_OSNAME ?= "poky"
22OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image"
23
24SOTA_MACHINE ??="none"
25SOTA_MACHINE_raspberrypi2 ?= "raspberrypi"
26SOTA_MACHINE_raspberrypi3 ?= "raspberrypi"
27SOTA_MACHINE_porter ?= "porter"
28SOTA_MACHINE_m3ulcb = "m3ulcb"
29SOTA_MACHINE_intel-corei7-64 ?= "minnowboard"
30SOTA_MACHINE_qemux86-64 ?= "qemux86-64"
31SOTA_MACHINE_am335x-evm ?= "am335x-evm-wifi"
32
33inherit sota_${SOTA_MACHINE}
diff --git a/classes/sota_am335x-evm-wifi.bbclass b/classes/sota_am335x-evm-wifi.bbclass
new file mode 100644
index 0000000..821e8fb
--- /dev/null
+++ b/classes/sota_am335x-evm-wifi.bbclass
@@ -0,0 +1,18 @@
1IMAGE_CLASSES += "image_types_uboot"
2
3KERNEL_IMAGETYPE_sota = "uImage"
4
5OSTREE_BOOTLOADER ?= "u-boot"
6
7EXTRA_IMAGEDEPENDS_append_sota = " acer-bootfiles"
8IMAGE_BOOT_FILES_sota = "bootfiles/*"
9OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 root=/dev/ram0 rw rootfstype=ext4 rootwait rootdelay=2 ostree_root=/dev/mmcblk0p2 console=ttyO0,115200n8l"
10
11IMAGE_INSTALL_append_sota = " uim iw wl18xx-calibrator wlconf wl18xx-fw hostapd wpa-supplicant"
12IMAGE_INSTALL_remove_sota = " connman connman-client"
13
14PREFERRED_VERSION_linux-ti-staging_sota = "4.4.54+gitAUTOINC+ecd4eada6f"
15
16KERNEL_EXTRA_ARGS_append_sota = " LOADADDR=${UBOOT_ENTRYPOINT}"
17
18VIRTUAL-RUNTIME_net_manager_sota = "systemd"
diff --git a/classes/sota_bleeding.inc b/classes/sota_bleeding.inc
new file mode 100644
index 0000000..fc5947d
--- /dev/null
+++ b/classes/sota_bleeding.inc
@@ -0,0 +1 @@
SRCREV_pn-aktualizr ?= "${AUTOREV}"
diff --git a/classes/sota_m3ulcb.bbclass b/classes/sota_m3ulcb.bbclass
new file mode 100644
index 0000000..21d04ba
--- /dev/null
+++ b/classes/sota_m3ulcb.bbclass
@@ -0,0 +1,9 @@
1# Commit united image to OSTree, not just uImage
2OSTREE_KERNEL = "Image"
3
4EXTRA_IMAGEDEPENDS_append_sota = " m3ulcb-ota-bootfiles"
5IMAGE_CLASSES_append_sota = " image_types_uboot "
6IMAGE_BOOT_FILES_sota += "m3ulcb-ota-bootfiles/*"
7
8OSTREE_BOOTLOADER ?= "u-boot"
9UBOOT_MACHINE_sota = "m3ulcb_defconfig"
diff --git a/classes/sota_minnowboard.bbclass b/classes/sota_minnowboard.bbclass
new file mode 100644
index 0000000..8417348
--- /dev/null
+++ b/classes/sota_minnowboard.bbclass
@@ -0,0 +1,7 @@
1OSTREE_BOOTLOADER ?= "grub"
2EFI_PROVIDER_sota = "grub-efi"
3
4WKS_FILE_sota = "efiimage-sota.wks"
5IMAGE_BOOT_FILES_sota = ""
6
7OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 console=ttyS0,115200 console=tty0"
diff --git a/classes/sota_minnowboard_uboot.inc b/classes/sota_minnowboard_uboot.inc
new file mode 100644
index 0000000..85d6a60
--- /dev/null
+++ b/classes/sota_minnowboard_uboot.inc
@@ -0,0 +1,8 @@
1PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot-ota"
2UBOOT_MACHINE_sota ?= "minnowmax_defconfig"
3
4EXTRA_IMAGEDEPENDS_append_sota = " minnowboard-bootfiles"
5IMAGE_BOOT_FILES_sota ?= "minnowboard-bootfiles/*"
6
7OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 ostree_root=/dev/hda console=ttyS0,115200 console=tty0"
8
diff --git a/classes/sota_none.bbclass b/classes/sota_none.bbclass
new file mode 100644
index 0000000..c11b070
--- /dev/null
+++ b/classes/sota_none.bbclass
@@ -0,0 +1,4 @@
1# null machine it's here to make bitbake happy when SOTA_MACHINE is undefined
2#python __anonymous() {
3# bb.warn("SOTA functionality is not yet supported for your machine")
4#}
diff --git a/classes/sota_porter.bbclass b/classes/sota_porter.bbclass
new file mode 100644
index 0000000..a8f5ba1
--- /dev/null
+++ b/classes/sota_porter.bbclass
@@ -0,0 +1,10 @@
1# Commit united image to OSTree, not just uImage
2OSTREE_KERNEL = "uImage+dtb"
3
4EXTRA_IMAGEDEPENDS_append_sota = " porter-bootfiles"
5IMAGE_CLASSES_append_sota = " image_types_uboot "
6IMAGE_BOOT_FILES_sota += "porter-bootfiles/*"
7
8OSTREE_BOOTLOADER ?= "u-boot"
9UBOOT_MACHINE_sota = "porter_config"
10
diff --git a/classes/sota_qemux86-64.bbclass b/classes/sota_qemux86-64.bbclass
new file mode 100644
index 0000000..5ec4f69
--- /dev/null
+++ b/classes/sota_qemux86-64.bbclass
@@ -0,0 +1,11 @@
1# See https://advancedtelematic.atlassian.net/browse/PRO-2693
2PREFERRED_VERSION_linux-yocto_qemux86-64_sota = "4.4%"
3
4IMAGE_FSTYPES_remove = "wic"
5
6# U-Boot support for SOTA
7PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot-ota"
8UBOOT_MACHINE_sota = "qemu-x86_defconfig"
9OSTREE_BOOTLOADER ?= "u-boot"
10
11OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 ostree_root=/dev/hda"
diff --git a/classes/sota_raspberrypi.bbclass b/classes/sota_raspberrypi.bbclass
new file mode 100644
index 0000000..cc6b666
--- /dev/null
+++ b/classes/sota_raspberrypi.bbclass
@@ -0,0 +1,11 @@
1IMAGE_CLASSES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'image_types_uboot sdcard_image-rpi-ota', '', d)}"
2IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'rpi-sdimg-ota.xz', 'rpi-sdimg.xz', d)}"
3
4IMAGE_FSTYPES_remove = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'wic rpi-sdimg rpi-sdimg.xz', '', d)}"
5
6KERNEL_IMAGETYPE_sota = "uImage"
7PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot"
8UBOOT_MACHINE_raspberrypi2_sota ?= "rpi_2_defconfig"
9UBOOT_MACHINE_raspberrypi3_sota ?= "rpi_3_32b_defconfig"
10
11OSTREE_BOOTLOADER ?= "u-boot"
diff --git a/conf/distro/poky-sota-systemd.conf b/conf/distro/poky-sota-systemd.conf
index f2313cd..7d008a9 100644
--- a/conf/distro/poky-sota-systemd.conf
+++ b/conf/distro/poky-sota-systemd.conf
@@ -1,4 +1,5 @@
1require conf/distro/poky.conf 1require conf/distro/poky.conf
2
2require conf/distro/sota.conf.inc 3require conf/distro/sota.conf.inc
3 4
4DISTRO = "poky-sota" 5DISTRO = "poky-sota"
diff --git a/conf/distro/sota.conf.inc b/conf/distro/sota.conf.inc
index 23e5a43..7438424 100644
--- a/conf/distro/sota.conf.inc
+++ b/conf/distro/sota.conf.inc
@@ -1,45 +1,10 @@
1IMAGE_INSTALL_append = " ostree rvi-sota-client" 1# Common settings to enable SOTA
2# This can be pulled into a custom distribution, or included in
3# local.conf directly with:
4#
5# require conf/distro/sota.conf.inc
2 6
3# live image for OSTree-enabled systems
4IMAGE_CLASSES_append = " image_types_ostree image_types_ota"
5IMAGE_FSTYPES += "ostreepush otaimg"
6
7# Please redefine OSTREE_REPO in order to have a persistent OSTree repo
8OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo"
9OSTREE_BRANCHNAME ?= "ota-${MACHINE}"
10OSTREE_OSNAME ?= "poky"
11OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image"
12
13# Platform-specific configurations
14
15## RaspberryPi
16IMAGE_CLASSES_append_raspberrypi2 = " image_types_uboot sdcard_image-rpi-ota"
17IMAGE_CLASSES_append_raspberrypi3 = " image_types_uboot sdcard_image-rpi-ota"
18IMAGE_FSTYPES += "${@'rpi-sdimg-ota' if d.getVar('MACHINE', True).startswith('raspberrypi') else ''}"
19IMAGE_FSTYPES_remove = "rpi-sdimg"
20
21KERNEL_IMAGETYPE_raspberrypi2 = "uImage"
22KERNEL_IMAGETYPE_raspberrypi3 = "uImage"
23
24UBOOT_MACHINE_raspberrypi2 = "rpi_2_defconfig"
25UBOOT_MACHINE_raspberrypi3 = "rpi_3_32b_defconfig"
26PREFERRED_PROVIDER_virtual/bootloader_raspberrypi2 = "u-boot"
27PREFERRED_PROVIDER_virtual/bootloader_raspberrypi3 = "u-boot"
28
29# Some BSPs (e.g. meta-raspberrypi) use this variable to turn debug on/off
30DISTRO_TYPE ?= "${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", "debug", "release",d)}"
31
32## Minnowboard
33PREFERRED_PROVIDER_virtual/bootloader_intel-corei7-64 = "u-boot-ota"
34UBOOT_MACHINE_intel-corei7-64 = "minnowmax_defconfig"
35IMAGE_CLASSES_append_intel-corei7-64 = " sdcard_image-minnowboard-ota"
36IMAGE_FSTYPES += "${@'minnowboard-sdimg-ota' if d.getVar('MACHINE', True).startswith('intel-corei7-64') else ''}"
37
38## QEMU
39PREFERRED_PROVIDER_virtual/bootloader_qemux86 = "u-boot-ota"
40UBOOT_MACHINE_qemux86 = "qemu-x86_defconfig"
41PREFERRED_PROVIDER_virtual/bootloader_qemux86-64= "u-boot-ota"
42UBOOT_MACHINE_qemux86-64 = "qemu-x86_defconfig"
43
44DISTROOVERRIDES_append = ":sota"
45DISTRO_FEATURES_append = " sota" 7DISTRO_FEATURES_append = " sota"
8INHERIT += " sota"
9# Prelinking increases the size of downloads and causes build errors
10USER_CLASSES_remove = "image-prelink"
diff --git a/conf/include/bblayers/sota.inc b/conf/include/bblayers/sota.inc
new file mode 100644
index 0000000..97edecb
--- /dev/null
+++ b/conf/include/bblayers/sota.inc
@@ -0,0 +1,5 @@
1
2BBLAYERS += "${METADIR}/meta-updater"
3BBLAYERS += "${METADIR}/meta-openembedded/meta-filesystems"
4BBLAYERS += "${METADIR}/meta-openembedded/meta-oe"
5BBLAYERS += "${METADIR}/meta-rust"
diff --git a/conf/include/bblayers/sota_am335x-evm.inc b/conf/include/bblayers/sota_am335x-evm.inc
new file mode 100644
index 0000000..f2d485d
--- /dev/null
+++ b/conf/include/bblayers/sota_am335x-evm.inc
@@ -0,0 +1,2 @@
1
2BBLAYERS += " ${METADIR}/meta-ti "
diff --git a/conf/include/bblayers/sota_intel-corei7-64.inc b/conf/include/bblayers/sota_intel-corei7-64.inc
new file mode 100644
index 0000000..1771e6c
--- /dev/null
+++ b/conf/include/bblayers/sota_intel-corei7-64.inc
@@ -0,0 +1,2 @@
1
2BBLAYERS += " ${METADIR}/meta-updater-minnowboard ${METADIR}/meta-intel "
diff --git a/conf/include/bblayers/sota_m3ulcb.inc b/conf/include/bblayers/sota_m3ulcb.inc
new file mode 100644
index 0000000..04f78e4
--- /dev/null
+++ b/conf/include/bblayers/sota_m3ulcb.inc
@@ -0,0 +1,2 @@
1
2BBLAYERS += " ${METADIR}/meta-renesas ${METADIR}/meta-renesas-rcar-gen3 ${METADIR}/meta-openembedded/meta-multimedia"
diff --git a/conf/include/bblayers/sota_porter.inc b/conf/include/bblayers/sota_porter.inc
new file mode 100644
index 0000000..6964ef0
--- /dev/null
+++ b/conf/include/bblayers/sota_porter.inc
@@ -0,0 +1,2 @@
1
2BBLAYERS += " ${METADIR}/meta-renesas ${METADIR}/meta-renesas/meta-rcar-gen2 ${METADIR}/meta-openembedded/meta-multimedia ${METADIR}/meta-updater-porter"
diff --git a/conf/include/bblayers/sota_qemux86-64.inc b/conf/include/bblayers/sota_qemux86-64.inc
new file mode 100644
index 0000000..22ace81
--- /dev/null
+++ b/conf/include/bblayers/sota_qemux86-64.inc
@@ -0,0 +1,2 @@
1
2BBLAYERS += " ${METADIR}/meta-updater-qemux86-64 "
diff --git a/conf/include/bblayers/sota_raspberrypi2.inc b/conf/include/bblayers/sota_raspberrypi2.inc
new file mode 100644
index 0000000..11ede20
--- /dev/null
+++ b/conf/include/bblayers/sota_raspberrypi2.inc
@@ -0,0 +1,2 @@
1
2BBLAYERS += " ${METADIR}/meta-updater-raspberrypi ${METADIR}/meta-raspberrypi "
diff --git a/conf/include/bblayers/sota_raspberrypi3.inc b/conf/include/bblayers/sota_raspberrypi3.inc
new file mode 100644
index 0000000..11ede20
--- /dev/null
+++ b/conf/include/bblayers/sota_raspberrypi3.inc
@@ -0,0 +1,2 @@
1
2BBLAYERS += " ${METADIR}/meta-updater-raspberrypi ${METADIR}/meta-raspberrypi "
diff --git a/recipes-bsp/grub/grub-efi_%.bbappend b/recipes-bsp/grub/grub-efi_%.bbappend
new file mode 100644
index 0000000..bebb006
--- /dev/null
+++ b/recipes-bsp/grub/grub-efi_%.bbappend
@@ -0,0 +1,2 @@
1
2GRUB_BUILDIN_append_sota = " configfile"
diff --git a/recipes-bsp/u-boot/u-boot_2016.11.bb b/recipes-bsp/u-boot/u-boot_2016.11.bb
index a05b37f..e6e1fcf 100644
--- a/recipes-bsp/u-boot/u-boot_2016.11.bb
+++ b/recipes-bsp/u-boot/u-boot_2016.11.bb
@@ -5,3 +5,9 @@ DEPENDS += "dtc-native"
5SRCREV = "5ea3e51fc481613a8dee8c02848d1b42c81ad892" 5SRCREV = "5ea3e51fc481613a8dee8c02848d1b42c81ad892"
6 6
7PV = "v2016.11+git${SRCPV}" 7PV = "v2016.11+git${SRCPV}"
8
9#This patch is not compliant with u-boot 2016.11
10#Version of u-boot from yocto 2.2 Morty is 2016.03 from:
11# meta/recipes-bsp/u-boot/u-boot_2016.03.bb
12SRC_URI_remove_raspberrypi3 = "file://0003-Include-lowlevel_init.o-for-rpi2.patch"
13SRC_URI_remove_raspberrypi2 = "file://0003-Include-lowlevel_init.o-for-rpi2.patch"
diff --git a/recipes-core/images/initramfs-ostree-image.bb b/recipes-core/images/initramfs-ostree-image.bb
index 8eea07c..cd872b8 100644
--- a/recipes-core/images/initramfs-ostree-image.bb
+++ b/recipes-core/images/initramfs-ostree-image.bb
@@ -15,11 +15,16 @@ LICENSE = "MIT"
15 15
16IMAGE_FSTYPES = "ext4.gz" 16IMAGE_FSTYPES = "ext4.gz"
17IMAGE_FSTYPES_append_arm = " ext4.gz.u-boot" 17IMAGE_FSTYPES_append_arm = " ext4.gz.u-boot"
18IMAGE_CLASSES_append_arm = " image_types_uboot"
18 19
19inherit core-image 20inherit core-image
20 21
21IMAGE_ROOTFS_SIZE = "8192" 22IMAGE_ROOTFS_SIZE = "8192"
22 23
24# Users will often ask for extra space in their rootfs by setting this
25# globally. Since this is a initramfs, we don't want to make it bigger
26IMAGE_ROOTFS_EXTRA_SPACE = "0"
27
23BAD_RECOMMENDATIONS += "busybox-syslog" 28BAD_RECOMMENDATIONS += "busybox-syslog"
24 29
25 30
diff --git a/recipes-devtools/pseudo/files/0001-Add-check-for-existence-of-old-file-to-renameat.patch b/recipes-devtools/pseudo/files/0001-Add-check-for-existence-of-old-file-to-renameat.patch
deleted file mode 100644
index 3da2ad7..0000000
--- a/recipes-devtools/pseudo/files/0001-Add-check-for-existence-of-old-file-to-renameat.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From 41bb6c818a7ec9eeb33b60302c55c9c5ee393c5f Mon Sep 17 00:00:00 2001
2From: Anton Gerasimov <anton@advancedtelematic.com>
3Date: Fri, 30 Sep 2016 17:12:19 +0200
4Subject: [PATCH 1/1] Add check for existence of old file to renameat
5
6---
7 ports/unix/guts/renameat.c | 7 ++++++-
8 1 file changed, 6 insertions(+), 1 deletion(-)
9
10diff --git a/ports/unix/guts/renameat.c b/ports/unix/guts/renameat.c
11index ade0509..d5e36fa 100644
12--- a/ports/unix/guts/renameat.c
13+++ b/ports/unix/guts/renameat.c
14@@ -11,6 +11,7 @@
15 int oldrc, newrc;
16 int save_errno;
17 int old_db_entry = 0;
18+ int may_unlinked = 0;
19
20 pseudo_debug(PDBGF_FILE, "renameat: %d,%s->%d,%s\n",
21 olddirfd, oldpath ? oldpath : "<nil>",
22@@ -44,10 +45,14 @@
23 /* as with unlink, we have to mark that the file may get deleted */
24 msg = pseudo_client_op(OP_MAY_UNLINK, 0, -1, newdirfd, newpath, newrc ? NULL : &newbuf);
25 if (msg && msg->result == RESULT_SUCCEED)
26+ may_unlinked = 1;
27+ msg = pseudo_client_op(OP_STAT, 0, -1, olddirfd, oldpath, oldrc ? NULL : &oldbuf);
28+ if (msg && msg->result == RESULT_SUCCEED)
29 old_db_entry = 1;
30+
31 rc = real_renameat(olddirfd, oldpath, newdirfd, newpath);
32 save_errno = errno;
33- if (old_db_entry) {
34+ if (may_unlinked) {
35 if (rc == -1) {
36 /* since we failed, that wasn't really unlinked -- put
37 * it back.
38--
392.9.3
40
diff --git a/recipes-devtools/pseudo/files/fallback-group b/recipes-devtools/pseudo/files/fallback-group
deleted file mode 100644
index 81bf732..0000000
--- a/recipes-devtools/pseudo/files/fallback-group
+++ /dev/null
@@ -1,2 +0,0 @@
1root:*:0:
2mail:*:8:
diff --git a/recipes-devtools/pseudo/files/fallback-passwd b/recipes-devtools/pseudo/files/fallback-passwd
deleted file mode 100644
index c1458dc..0000000
--- a/recipes-devtools/pseudo/files/fallback-passwd
+++ /dev/null
@@ -1 +0,0 @@
1root::0:0:root:/home/root:/bin/sh
diff --git a/recipes-devtools/pseudo/pseudo_1.7.5.bbappend b/recipes-devtools/pseudo/pseudo_1.7.5.bbappend
deleted file mode 100644
index 73b43df..0000000
--- a/recipes-devtools/pseudo/pseudo_1.7.5.bbappend
+++ /dev/null
@@ -1,3 +0,0 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
2
3SRC_URI += "file://0001-Add-check-for-existence-of-old-file-to-renameat.patch"
diff --git a/recipes-devtools/pseudo/pseudo_1.8.1.bb b/recipes-devtools/pseudo/pseudo_1.8.1.bb
deleted file mode 100644
index 211439e..0000000
--- a/recipes-devtools/pseudo/pseudo_1.8.1.bb
+++ /dev/null
@@ -1,20 +0,0 @@
1require recipes-devtools/pseudo/pseudo.inc
2
3SRC_URI = " \
4 http://downloads.yoctoproject.org/releases/pseudo/${BPN}-${PV}.tar.bz2 \
5 file://fallback-passwd \
6 file://fallback-group \
7 file://0001-Add-check-for-existence-of-old-file-to-renameat.patch \
8"
9
10SRC_URI[md5sum] = "ee38e4fb62ff88ad067b1a5a3825bac7"
11SRC_URI[sha256sum] = "dac4ad2d21228053151121320f629d41dd5c0c87695ac4e7aea286c414192ab5"
12
13PSEUDO_EXTRA_OPTS ?= "--enable-force-async --without-passwd-fallback"
14
15do_install_append_class-native () {
16 install -d ${D}${sysconfdir}
17 # The fallback files should never be modified
18 install -m 444 ${WORKDIR}/fallback-passwd ${D}${sysconfdir}/passwd
19 install -m 444 ${WORKDIR}/fallback-group ${D}${sysconfdir}/group
20}
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index 045c142..359c9fb 100644
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -2,23 +2,44 @@ SUMMARY = "Aktualizr SOTA Client"
2DESCRIPTION = "SOTA Client application written in C++" 2DESCRIPTION = "SOTA Client application written in C++"
3HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" 3HOMEPAGE = "https://github.com/advancedtelematic/aktualizr"
4SECTION = "base" 4SECTION = "base"
5
6LICENSE = "MPL-2.0" 5LICENSE = "MPL-2.0"
7LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" 6LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3"
8 7DEPENDS = "boost curl openssl jansson libsodium ostree"
9inherit cmake systemd 8RDEPENDS_${PN} = "lshw"
9
10SRC_URI = " \
11 git://github.com/advancedtelematic/aktualizr \
12 file://aktualizr-manual-provision.service \
13 file://aktualizr-autoprovision.service \
14 file://sota_autoprov.toml \
15 "
16SRCREV = "c24f1fc9b600113cf9f2d3d7215e406cbbb70ac4"
17PV = "1.0+git${SRCPV}"
10 18
11S = "${WORKDIR}/git" 19S = "${WORKDIR}/git"
20SYSTEMD_SERVICE_${PN} = "aktualizr.service"
12 21
13SRCREV = "f2275e9938f5c942c9e51a3966b1ad91acd65367" 22inherit cmake systemd
14 23
15SRC_URI = "git://github.com/advancedtelematic/aktualizr" 24EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_OSTREE=ON -DAKTUALIZR_VERSION=${PV}"
16 25
17DEPENDS = "boost curl openssl jansson" 26export SOTA_AUTOPROVISION_CREDENTIALS
18RDEPENDS = "" 27export SOTA_PACKED_CREDENTIALS
19 28
20EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF" 29do_install_append() {
30 if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" -o -n "${SOTA_PACKED_CREDENTIALS}" ]; then
31 install -d ${D}/${systemd_unitdir}/system
32 install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service
33 install -d ${D}/usr/lib/sota
34 install -m "0644" ${WORKDIR}/sota_autoprov.toml ${D}/usr/lib/sota/sota.toml
35 else
36 install -d ${D}/${systemd_unitdir}/system
37 install -m 0644 ${WORKDIR}/aktualizr-manual-provision.service ${D}/${systemd_unitdir}/system/aktualizr.service
38 fi
39}
21 40
22FILES_${PN} = " \ 41FILES_${PN} = " \
23 ${bindir}/aktualizr \ 42 ${bindir}/aktualizr \
24 " 43 ${systemd_unitdir}/system/aktualizr.service \
44 /usr/lib/sota/sota.toml \
45 "
diff --git a/recipes-sota/aktualizr/files/aktualizr-autoprovision.service b/recipes-sota/aktualizr/files/aktualizr-autoprovision.service
new file mode 100644
index 0000000..fd0ab09
--- /dev/null
+++ b/recipes-sota/aktualizr/files/aktualizr-autoprovision.service
@@ -0,0 +1,14 @@
1[Unit]
2Description=Aktualizr SOTA Client
3Wants=network-online.target
4After=network.target network-online.target
5Requires=network-online.target
6
7[Service]
8RestartSec=10
9Restart=always
10EnvironmentFile=/var/sota/sota_provisioning_url.env
11ExecStart=/usr/bin/aktualizr --disable-keyid-validation --tls-server ${SOTA_GATEWAY_URI} --config /usr/lib/sota/sota.toml
12
13[Install]
14WantedBy=multi-user.target
diff --git a/recipes-sota/aktualizr/files/aktualizr-manual-provision.service b/recipes-sota/aktualizr/files/aktualizr-manual-provision.service
new file mode 100644
index 0000000..a70f2f9
--- /dev/null
+++ b/recipes-sota/aktualizr/files/aktualizr-manual-provision.service
@@ -0,0 +1,13 @@
1[Unit]
2Description=Aktualizr SOTA Client
3Wants=network-online.target
4After=network.target network-online.target
5Requires=network-online.target
6
7[Service]
8RestartSec=10
9Restart=always
10ExecStart=/usr/bin/aktualizr --config /sysroot/boot/sota.toml --loglevel 2
11
12[Install]
13WantedBy=multi-user.target
diff --git a/recipes-sota/aktualizr/files/sota_autoprov.toml b/recipes-sota/aktualizr/files/sota_autoprov.toml
new file mode 100644
index 0000000..8799553
--- /dev/null
+++ b/recipes-sota/aktualizr/files/sota_autoprov.toml
@@ -0,0 +1,18 @@
1[device]
2packages_dir = "/tmp/packages_dir"
3certificates_directory = "/var/sota"
4system_info = "system_info.sh"
5
6[tls]
7ca_file = "root.crt"
8client_certificate = "client.pem"
9pkey_file = "pkey.pem"
10
11[uptane]
12metadata_path = "/var/sota/metadata"
13private_key_path = "ecukey.der"
14public_key_path = "ecukey.pub"
15
16[provision]
17p12_path = "sota_provisioning_credentials.p12"
18
diff --git a/recipes-sota/ostree-initrd/files/init.sh b/recipes-sota/ostree-initrd/files/init.sh
index 806a7b1..0b0693d 100644
--- a/recipes-sota/ostree-initrd/files/init.sh
+++ b/recipes-sota/ostree-initrd/files/init.sh
@@ -1,17 +1,13 @@
1#!/bin/sh 1#!/bin/sh
2 2set -eu
3# global variables
4
5SMACK=n
6DEBUG=n
7 3
8# ------------------------------------------- 4# -------------------------------------------
9 5
10log_info() { echo "$0[$$]: $@" >&2; } 6log_info() { echo "$0[$$]: $*" >&2; }
11log_error() { echo "$0[$$]: ERROR $@" >&2; } 7log_error() { echo "$0[$$]: ERROR $*" >&2; }
12 8
13do_mount_fs() { 9do_mount_fs() {
14 log_info "mounting FS: $@" 10 log_info "mounting FS: $*"
15 [[ -e /proc/filesystems ]] && { grep -q "$1" /proc/filesystems || { log_error "Unknown filesystem"; return 1; } } 11 [[ -e /proc/filesystems ]] && { grep -q "$1" /proc/filesystems || { log_error "Unknown filesystem"; return 1; } }
16 [[ -d "$2" ]] || mkdir -p "$2" 12 [[ -d "$2" ]] || mkdir -p "$2"
17 [[ -e /proc/mounts ]] && { grep -q -e "^$1 $2 $1" /proc/mounts && { log_info "$2 ($1) already mounted"; return 0; } } 13 [[ -e /proc/mounts ]] && { grep -q -e "^$1 $2 $1" /proc/mounts && { log_info "$2 ($1) already mounted"; return 0; } }
@@ -26,18 +22,19 @@ bail_out() {
26} 22}
27 23
28get_ostree_sysroot() { 24get_ostree_sysroot() {
29 for opt in `cat /proc/cmdline`; do 25 for opt in $(cat /proc/cmdline); do
30 arg=`echo $opt | cut -d'=' -f1` 26 arg=$(echo "$opt" | cut -d'=' -f1)
31 if [ $arg == "ostree_root" ]; then 27 if [ "$arg" == "ostree_root" ]; then
32 echo $opt | cut -d'=' -f2 28 echo "$opt" | cut -d'=' -f2-
33 return 29 return
34 fi 30 fi
35 done 31 done
32 echo "LABEL=otaroot"
36} 33}
37 34
38export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/ostree 35export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/ostree
39 36
40log_info "starting initrd script" 37log_info "Starting OSTree initrd script"
41 38
42do_mount_fs proc /proc 39do_mount_fs proc /proc
43do_mount_fs sysfs /sys 40do_mount_fs sysfs /sys
@@ -49,8 +46,6 @@ do_mount_fs tmpfs /run
49 46
50# check if smack is active (and if so, mount smackfs) 47# check if smack is active (and if so, mount smackfs)
51grep -q smackfs /proc/filesystems && { 48grep -q smackfs /proc/filesystems && {
52 SMACK=y
53
54 do_mount_fs smackfs /sys/fs/smackfs 49 do_mount_fs smackfs /sys/fs/smackfs
55 50
56 # adjust current label and network label 51 # adjust current label and network label
@@ -61,14 +56,20 @@ grep -q smackfs /proc/filesystems && {
61mkdir -p /sysroot 56mkdir -p /sysroot
62ostree_sysroot=$(get_ostree_sysroot) 57ostree_sysroot=$(get_ostree_sysroot)
63 58
64mount $ostree_sysroot /sysroot || bail_out "Unable to mount $ostree_sysroot as physical sysroot" 59mount "$ostree_sysroot" /sysroot || {
60 # The SD card in the R-Car M3 takes a bit of time to come up
61 # Retry the mount if it fails the first time
62 log_info "Mounting $ostree_sysroot failed, waiting 5s for the device to be available..."
63 sleep 5
64 mount "$ostree_sysroot" /sysroot || bail_out "Unable to mount $ostree_sysroot as physical sysroot"
65}
65ostree-prepare-root /sysroot 66ostree-prepare-root /sysroot
66 67
67# move mounted devices to new root 68# move mounted devices to new root
68cd /sysroot 69cd /sysroot
69for x in dev proc; do 70for x in dev proc; do
70 log_info "Moving /$x to new rootfs" 71 log_info "Moving /$x to new rootfs"
71 mount -o move /$x $x 72 mount -o move "/$x" "$x"
72done 73done
73 74
74# switch to new rootfs 75# switch to new rootfs
diff --git a/recipes-sota/ostree-initrd/ostree-initrd.bb b/recipes-sota/ostree-initrd/ostree-initrd.bb
index 5c85bee..6046c81 100644
--- a/recipes-sota/ostree-initrd/ostree-initrd.bb
+++ b/recipes-sota/ostree-initrd/ostree-initrd.bb
@@ -5,15 +5,16 @@ SRC_URI = "file://init.sh"
5 5
6S = "${WORKDIR}" 6S = "${WORKDIR}"
7 7
8PV = "3"
9
8do_install() { 10do_install() {
9 install -dm 0755 ${D}/etc 11 install -dm 0755 ${D}/etc
10 touch ${D}/etc/initrd-release 12 touch ${D}/etc/initrd-release
11 install -dm 0755 ${D}/dev 13 install -dm 0755 ${D}/dev
12 install -dm 0755 ${D}/sbin 14 install -dm 0755 ${D}/sbin
13 install -m 0755 ${WORKDIR}/init.sh ${D}/sbin/init 15 install -m 0755 ${WORKDIR}/init.sh ${D}/sbin/init
14} 16}
15 17
16inherit allarch 18inherit allarch
17 19
18FILES_${PN} += " /dev /etc/initrd-release /sbin/init " 20FILES_${PN} += " /dev /etc/initrd-release /sbin/init "
19
diff --git a/recipes-sota/ostree/ostree_git.bb b/recipes-sota/ostree/ostree_git.bb
index 67b5047..84e86e2 100644
--- a/recipes-sota/ostree/ostree_git.bb
+++ b/recipes-sota/ostree/ostree_git.bb
@@ -8,31 +8,37 @@ INHERIT_remove_class-native = "systemd"
8 8
9SRC_URI = "gitsm://github.com/ostreedev/ostree.git;branch=master" 9SRC_URI = "gitsm://github.com/ostreedev/ostree.git;branch=master"
10 10
11SRCREV="37c07d2f1c90b12bcfba85a7d900f81a7c362eb4" 11SRCREV="3b09620c2738bce4ed45e099cf2e4c5df7671d39"
12
13PV = "2017.3-31-g3b09620c"
12 14
13S = "${WORKDIR}/git" 15S = "${WORKDIR}/git"
14 16
15BBCLASSEXTEND = "native" 17BBCLASSEXTEND = "native"
16 18
17DEPENDS += "attr libarchive glib-2.0 pkgconfig gpgme libgsystem fuse libsoup-2.4 e2fsprogs" 19DEPENDS += "attr libarchive glib-2.0 pkgconfig gpgme libgsystem fuse libsoup-2.4 e2fsprogs gtk-doc-native curl"
18DEPENDS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' systemd', '', d)}" 20DEPENDS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' systemd', '', d)}"
19
20DEPENDS_remove_class-native = "systemd-native" 21DEPENDS_remove_class-native = "systemd-native"
21 22
22RDEPENDS_${PN} = "python util-linux-libuuid util-linux-libblkid util-linux-libmount libcap xz os-release ca-certificates" 23RDEPENDS_${PN} = "python util-linux-libuuid util-linux-libblkid util-linux-libmount libcap xz bash"
23RDEPENDS_${PN}_remove_class-native = "python-native os-release-native" 24RDEPENDS_${PN}_remove_class-native = "python-native"
24 25
25EXTRA_OECONF = "CFLAGS='-g' --with-libarchive --disable-gtk-doc --disable-gtk-doc-html --disable-gtk-doc-pdf --disable-man" 26EXTRA_OECONF = "--with-libarchive --disable-gtk-doc --disable-gtk-doc-html --disable-gtk-doc-pdf --disable-man --with-smack --with-builtin-grub2-mkconfig --with-curl"
26EXTRA_OEMAKE = "CFLAGS='-g'"
27EXTRA_OECONF_append_class-native = " --enable-wrpseudo-compat" 27EXTRA_OECONF_append_class-native = " --enable-wrpseudo-compat"
28 28
29# Path to ${prefix}/lib/ostree/ostree-grub-generator is hardcoded on the
30# do_configure stage so we do depend on it
31SYSROOT_DIR = "${STAGING_DIR_TARGET}"
32SYSROOT_DIR_class-native = "${STAGING_DIR_NATIVE}"
33do_configure[vardeps] += "SYSROOT_DIR"
34
29SYSTEMD_REQUIRED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}" 35SYSTEMD_REQUIRED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}"
30SYSTEMD_REQUIRED_class-native = "false" 36SYSTEMD_REQUIRED_class-native = ""
31 37
32SYSTEMD_SERVICE_${PN} = "ostree-prepare-root.service ostree-remount.service" 38SYSTEMD_SERVICE_${PN} = "ostree-prepare-root.service ostree-remount.service"
33SYSTEMD_SERVICE_${PN}_class-native = "" 39SYSTEMD_SERVICE_${PN}_class-native = ""
34 40
35PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" 41PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
36PACKAGECONFIG_class-native = "" 42PACKAGECONFIG_class-native = ""
37PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/ --with-dracut" 43PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/ --with-dracut"
38 44
@@ -42,7 +48,8 @@ export STAGING_INCDIR
42export STAGING_LIBDIR 48export STAGING_LIBDIR
43 49
44do_configure() { 50do_configure() {
45 NOCONFIGURE=true ./autogen.sh 51 unset docdir
52 NOCONFIGURE=1 ./autogen.sh
46 oe_runconf 53 oe_runconf
47} 54}
48 55
@@ -54,11 +61,17 @@ do_compile_prepend() {
54export SYSTEMD_REQUIRED 61export SYSTEMD_REQUIRED
55 62
56do_install_append() { 63do_install_append() {
57 if [ "$SYSTEMD_REQUIRED" == "true" ]; then 64 if [ -n ${SYSTEMD_REQUIRED} ]; then
65 install -p -D ${S}/src/boot/ostree-prepare-root.service ${D}${systemd_unitdir}/system/ostree-prepare-root.service
58 install -p -D ${S}/src/boot/ostree-remount.service ${D}${systemd_unitdir}/system/ostree-remount.service 66 install -p -D ${S}/src/boot/ostree-remount.service ${D}${systemd_unitdir}/system/ostree-remount.service
59 fi 67 fi
60} 68}
61 69
70do_install_append_class-native() {
71 create_wrapper ${D}${bindir}/ostree OSTREE_GRUB2_EXEC="${STAGING_LIBDIR_NATIVE}/ostree/ostree-grub-generator"
72}
73
74
62FILES_${PN} += " \ 75FILES_${PN} += " \
63 ${@'${systemd_unitdir}/system/' if d.getVar('SYSTEMD_REQUIRED', True) else ''} \ 76 ${@'${systemd_unitdir}/system/' if d.getVar('SYSTEMD_REQUIRED', True) else ''} \
64 ${@'${libdir}/dracut/modules.d/98ostree/module-setup.sh' if d.getVar('SYSTEMD_REQUIRED', True) else ''} \ 77 ${@'${libdir}/dracut/modules.d/98ostree/module-setup.sh' if d.getVar('SYSTEMD_REQUIRED', True) else ''} \
diff --git a/recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service b/recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service
new file mode 100644
index 0000000..0431455
--- /dev/null
+++ b/recipes-sota/rvi-sota-client/files/sota-client-autoprovision.service
@@ -0,0 +1,16 @@
1[Unit]
2Description=SOTA Client Autoprovisioning
3Requires=network-online.target
4After=network-online.target
5
6[Service]
7Type=oneshot
8WorkingDirectory=/var/sota
9EnvironmentFile=/var/sota/sota_provisioning_url.env
10Environment=SOTA_CERT_DIR=/var/sota
11ExecStart=/usr/bin/sota_provision.sh sota_provisioning_credentials
12RemainAfterExit=true
13StandardOutput=journal
14
15[Install]
16WantedBy=multi-user.target
diff --git a/recipes-sota/rvi-sota-client/files/sota-client-ostree.service b/recipes-sota/rvi-sota-client/files/sota-client-ostree.service
new file mode 100644
index 0000000..093a994
--- /dev/null
+++ b/recipes-sota/rvi-sota-client/files/sota-client-ostree.service
@@ -0,0 +1,13 @@
1[Unit]
2Description=SOTA Client
3Requires=network-online.target
4After=network.target network-online.target
5
6[Service]
7RestartSec=5
8Restart=on-failure
9Environment="RUST_LOG=debug"
10ExecStart=/usr/bin/sota_client --config /sysroot/boot/sota.toml --device-package-manager ostree
11
12[Install]
13WantedBy=multi-user.target
diff --git a/recipes-sota/rvi-sota-client/files/sota-client-uptane.service b/recipes-sota/rvi-sota-client/files/sota-client-uptane.service
new file mode 100644
index 0000000..a2d80ce
--- /dev/null
+++ b/recipes-sota/rvi-sota-client/files/sota-client-uptane.service
@@ -0,0 +1,15 @@
1[Unit]
2Description=SOTA Client
3Requires=network-online.target
4After=network.target network-online.target
5Requires=sota-client-autoprovision
6After=sota-client-autoprovision
7
8[Service]
9RestartSec=5
10Restart=on-failure
11Environment="RUST_LOG=debug"
12ExecStart=/usr/bin/sota_client --config /var/sota/sota.toml --device-package-manager uptane
13
14[Install]
15WantedBy=multi-user.target
diff --git a/recipes-sota/rvi-sota-client/files/sota-installer.service b/recipes-sota/rvi-sota-client/files/sota-installer.service
new file mode 100644
index 0000000..a4fd99e
--- /dev/null
+++ b/recipes-sota/rvi-sota-client/files/sota-installer.service
@@ -0,0 +1,12 @@
1[Unit]
2Description=SOTA Secondary ECU Installer
3Requires=network-online.target
4After=network-online.target
5
6[Service]
7RestartSec=10
8Restart=always
9ExecStart=/usr/bin/sota-installer --level debug --oneshot --config /var/sota/installer.toml
10
11[Install]
12WantedBy=multi-user.target
diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client.inc b/recipes-sota/rvi-sota-client/rvi-sota-client.inc
new file mode 100644
index 0000000..2a27c9a
--- /dev/null
+++ b/recipes-sota/rvi-sota-client/rvi-sota-client.inc
@@ -0,0 +1,143 @@
1inherit cargo systemd
2
3DESCRIPTION = "rvi-sota-client recipe"
4HOMEPAGE = "https://github.com/advancedtelematic/rvi_sota_client"
5LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea"
7
8BBCLASSEXTEND = "native"
9
10S = "${WORKDIR}/git"
11
12SRC_URI[index.md5sum] = "6a635e8a081b4d4ba4cebffd721c2d7d"
13SRC_URI[index.sha256sum] = "1913c41d4b8de89a931b6f9e418f83e70a083e12e6c247e8510ee932571ebae2"
14
15# also update PV and SRC_URI crates when updating SRCREV
16SRCREV = "b9170dfd92981505c77f8f6e51d477eb1ec57071"
17
18# generate with: `make package-version`
19PV = "0.2.33-61-gb9170df"
20
21# generate with: `make yocto-version`
22SRC_URI = " \
23git://github.com/advancedtelematic/rvi_sota_client \
24file://sota-client-autoprovision.service \
25file://sota-client-ostree.service \
26file://sota-client-uptane.service \
27file://sota-installer.service \
28crate://crates.io/advapi32-sys/0.2.0 \
29crate://crates.io/aho-corasick/0.6.3 \
30crate://crates.io/ansi_term/0.9.0 \
31crate://crates.io/antidote/1.0.0 \
32crate://crates.io/atty/0.2.2 \
33crate://crates.io/backtrace/0.3.2 \
34crate://crates.io/backtrace-sys/0.1.11 \
35crate://crates.io/base64/0.5.2 \
36crate://crates.io/bit-set/0.4.0 \
37crate://crates.io/bit-vec/0.4.4 \
38crate://crates.io/bitflags/0.9.1 \
39crate://crates.io/byteorder/1.1.0 \
40crate://crates.io/bytes/0.4.4 \
41crate://crates.io/cfg-if/0.1.2 \
42crate://crates.io/chan/0.1.19 \
43crate://crates.io/chan-signal/0.2.0 \
44crate://crates.io/chrono/0.4.0 \
45crate://crates.io/clap/2.25.0 \
46crate://crates.io/core-foundation/0.2.3 \
47crate://crates.io/core-foundation-sys/0.2.3 \
48crate://crates.io/crossbeam/0.2.10 \
49crate://crates.io/crypt32-sys/0.2.0 \
50crate://crates.io/dbghelp-sys/0.2.0 \
51crate://crates.io/dbus/0.5.3 \
52crate://crates.io/dtoa/0.4.1 \
53crate://crates.io/env_logger/0.4.3 \
54crate://crates.io/error-chain/0.10.0 \
55crate://crates.io/filetime/0.1.10 \
56crate://crates.io/foreign-types/0.2.0 \
57crate://crates.io/gcc/0.3.51 \
58crate://crates.io/getopts/0.2.14 \
59crate://crates.io/hex/0.2.0 \
60crate://crates.io/httparse/1.2.3 \
61crate://crates.io/hyper/0.10.12 \
62crate://crates.io/hyper-native-tls/0.2.4 \
63crate://crates.io/idna/0.1.4 \
64crate://crates.io/iovec/0.1.0 \
65crate://crates.io/itoa/0.3.1 \
66crate://crates.io/kernel32-sys/0.2.2 \
67crate://crates.io/language-tags/0.2.2 \
68crate://crates.io/lazy_static/0.2.8 \
69crate://crates.io/libc/0.2.26 \
70crate://crates.io/libflate/0.1.5 \
71crate://crates.io/log/0.3.8 \
72crate://crates.io/maplit/0.1.4 \
73crate://crates.io/matches/0.1.6 \
74crate://crates.io/memchr/1.0.1 \
75crate://crates.io/metadeps/1.1.2 \
76crate://crates.io/mime/0.2.6 \
77crate://crates.io/native-tls/0.1.4 \
78crate://crates.io/net2/0.2.29 \
79crate://crates.io/num/0.1.40 \
80crate://crates.io/num-integer/0.1.35 \
81crate://crates.io/num-iter/0.1.34 \
82crate://crates.io/num-traits/0.1.40 \
83crate://crates.io/num_cpus/1.6.2 \
84crate://crates.io/openssl/0.9.14 \
85crate://crates.io/openssl-sys/0.9.14 \
86crate://crates.io/pem/0.4.0 \
87crate://crates.io/percent-encoding/1.0.0 \
88crate://crates.io/pkg-config/0.3.9 \
89crate://crates.io/quote/0.3.15 \
90crate://crates.io/rand/0.3.15 \
91crate://crates.io/redox_syscall/0.1.26 \
92crate://crates.io/regex/0.2.2 \
93crate://crates.io/regex-syntax/0.4.1 \
94crate://crates.io/reqwest/0.6.2 \
95crate://crates.io/ring/0.7.1 \
96crate://crates.io/rust-crypto/0.2.36 \
97crate://crates.io/rustc-demangle/0.1.4 \
98crate://crates.io/rustc-serialize/0.3.24 \
99crate://crates.io/schannel/0.1.7 \
100crate://crates.io/secur32-sys/0.2.0 \
101crate://crates.io/security-framework/0.1.14 \
102crate://crates.io/security-framework-sys/0.1.14 \
103crate://crates.io/serde/1.0.10 \
104crate://crates.io/serde_derive/1.0.10 \
105crate://crates.io/serde_derive_internals/0.15.1 \
106crate://crates.io/serde_json/1.0.2 \
107crate://crates.io/serde_urlencoded/0.5.1 \
108crate://crates.io/sha1/0.2.0 \
109crate://crates.io/strsim/0.6.0 \
110crate://crates.io/syn/0.11.11 \
111crate://crates.io/synom/0.11.3 \
112crate://crates.io/tar/0.4.13 \
113crate://crates.io/tempdir/0.3.5 \
114crate://crates.io/term_size/0.3.0 \
115crate://crates.io/textwrap/0.6.0 \
116crate://crates.io/thread_local/0.3.4 \
117crate://crates.io/time/0.1.38 \
118crate://crates.io/toml/0.2.1 \
119crate://crates.io/toml/0.4.2 \
120crate://crates.io/traitobject/0.1.0 \
121crate://crates.io/tungstenite/0.2.4 \
122crate://crates.io/typeable/0.1.2 \
123crate://crates.io/unicase/1.4.2 \
124crate://crates.io/unicode-bidi/0.3.3 \
125crate://crates.io/unicode-normalization/0.1.5 \
126crate://crates.io/unicode-segmentation/1.1.0 \
127crate://crates.io/unicode-width/0.1.4 \
128crate://crates.io/unicode-xid/0.0.4 \
129crate://crates.io/unix_socket/0.5.0 \
130crate://crates.io/unreachable/1.0.0 \
131crate://crates.io/untrusted/0.3.2 \
132crate://crates.io/url/1.5.1 \
133crate://crates.io/utf-8/0.7.1 \
134crate://crates.io/utf8-ranges/1.0.0 \
135crate://crates.io/uuid/0.5.1 \
136crate://crates.io/vec_map/0.8.0 \
137crate://crates.io/version_check/0.1.3 \
138crate://crates.io/void/1.0.2 \
139crate://crates.io/winapi/0.2.8 \
140crate://crates.io/winapi-build/0.1.1 \
141crate://crates.io/ws2_32-sys/0.2.1 \
142crate://crates.io/xattr/0.1.11 \
143"
diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb
index 15aa7a4..7ce3ab5 100644
--- a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb
+++ b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb
@@ -1,137 +1,60 @@
1DESCRIPTION = "sota-client rust recipe" 1require rvi-sota-client.inc
2HOMEPAGE = "https://github.com/advancedtelematic/rvi_sota_client"
3 2
4LICENSE = "MPL-2.0"
5LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea"
6 3
7inherit cargo systemd 4SYSTEMD_SERVICE_${PN} = "sota-client.service sota-client-autoprovision.service"
8
9S = "${WORKDIR}/git"
10
11SRCREV = "022cf8501f9eb84bf334a2490e6e0c67842882ab"
12
13# Generate with:
14# git describe --tags | cut -b2-
15PV = "0.2.30-2-g022cf85"
16
17BBCLASSEXTEND = "native"
18 5
19FILES_${PN} = " \ 6FILES_${PN} = " \
20 ${bindir}/sota_client \ 7/lib64 \
21 ${bindir}/sota_sysinfo.sh \ 8${bindir}/sota_client \
22 ${bindir}/system_info.sh \ 9${bindir}/sota_sysinfo.sh \
23 ${bindir}/sota_ostree.sh \ 10${bindir}/sota_provision.sh \
24 ${sysconfdir}/sota_client.version \ 11${sysconfdir}/sota_client.version \
25 ${sysconfdir}/sota_certificates \ 12${sysconfdir}/sota_certificates \
26 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota_client.service', '', d)} \ 13${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client.service', '', d)} \
27 " 14${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-client-autoprovision.service', '', d)} \
28
29SRC_URI = " \
30crate://crates.io/aho-corasick/0.5.3 \
31crate://crates.io/bit-set/0.2.0 \
32crate://crates.io/bit-vec/0.4.3 \
33crate://crates.io/bitflags/0.4.0 \
34crate://crates.io/bitflags/0.7.0 \
35crate://crates.io/bytes/0.3.0 \
36crate://crates.io/cfg-if/0.1.0 \
37crate://crates.io/chan-signal/0.1.7 \
38crate://crates.io/chan/0.1.18 \
39crate://crates.io/cookie/0.2.5 \
40crate://crates.io/crossbeam/0.2.10 \
41crate://crates.io/dbus/0.4.1 \
42crate://crates.io/env_logger/0.3.5 \
43crate://crates.io/gcc/0.3.40 \
44crate://crates.io/gdi32-sys/0.2.0 \
45crate://crates.io/getopts/0.2.14 \
46crate://crates.io/hpack/0.2.0 \
47crate://crates.io/httparse/1.2.1 \
48crate://crates.io/hyper/0.9.14 \
49crate://crates.io/idna/0.1.0 \
50crate://crates.io/kernel32-sys/0.2.2 \
51crate://crates.io/language-tags/0.2.2 \
52crate://crates.io/lazy_static/0.1.16 \
53crate://crates.io/lazy_static/0.2.2 \
54crate://crates.io/lazycell/0.4.0 \
55crate://crates.io/libc/0.2.18 \
56crate://crates.io/log/0.3.6 \
57crate://crates.io/matches/0.1.4 \
58crate://crates.io/memchr/0.1.11 \
59crate://crates.io/mime/0.2.2 \
60crate://crates.io/mio/0.6.1 \
61crate://crates.io/miow/0.1.4 \
62crate://crates.io/net2/0.2.26 \
63crate://crates.io/nix/0.7.0 \
64crate://crates.io/nom/1.2.4 \
65crate://crates.io/num_cpus/1.2.0 \
66crate://crates.io/openssl-sys/0.9.3 \
67crate://crates.io/openssl/0.9.3 \
68crate://crates.io/pkg-config/0.3.8 \
69crate://crates.io/rand/0.3.15 \
70crate://crates.io/regex-syntax/0.3.9 \
71crate://crates.io/regex/0.1.80 \
72crate://crates.io/rust-crypto/0.2.36 \
73crate://crates.io/rustc-serialize/0.3.22 \
74crate://crates.io/rustc_version/0.1.7 \
75crate://crates.io/semver/0.1.20 \
76crate://crates.io/sha1/0.2.0 \
77crate://crates.io/slab/0.3.0 \
78crate://crates.io/solicit/0.4.4 \
79crate://crates.io/thread-id/2.0.0 \
80crate://crates.io/thread_local/0.2.7 \
81crate://crates.io/time/0.1.35 \
82crate://crates.io/toml/0.2.1 \
83crate://crates.io/traitobject/0.0.1 \
84crate://crates.io/typeable/0.1.2 \
85crate://crates.io/unicase/1.4.0 \
86crate://crates.io/unicode-bidi/0.2.3 \
87crate://crates.io/unicode-normalization/0.1.2 \
88crate://crates.io/unix_socket/0.5.0 \
89crate://crates.io/url/1.2.3 \
90crate://crates.io/user32-sys/0.2.0 \
91crate://crates.io/utf8-ranges/0.1.3 \
92crate://crates.io/void/1.0.2 \
93crate://crates.io/winapi-build/0.1.1 \
94crate://crates.io/winapi/0.2.8 \
95crate://crates.io/ws/0.5.3 \
96crate://crates.io/ws2_32-sys/0.2.1 \
97git://github.com/advancedtelematic/rvi_sota_client \
98crate-index://crates.io/213b1a455d9270888c03a42c8d29975369102caa \
99" 15"
100SRC_URI[index.md5sum] = "79f10f436dbf26737cc80445746f16b4"
101SRC_URI[index.sha256sum] = "86114b93f1f51aaf0aec3af0751d214b351f4ff9839ba031315c1b19dcbb1913"
102 16
103SYSTEMD_SERVICE_${PN} = "sota_client.service" 17DEPENDS += " openssl openssl-native dbus "
18RDEPENDS_${PN} = " \
19bash \
20curl \
21libcrypto \
22libssl \
23lshw \
24jq \
25python-petname \
26sota-launcher \
27"
104 28
105DEPENDS += " openssl " 29export SOTA_PACKED_CREDENTIALS
106RDEPENDS_${PN} = " libcrypto \ 30export SOTA_AUTOPROVISION_CREDENTIALS
107 libssl \ 31export SOTA_AUTOPROVISION_URL
108 dbus \
109 bash \
110 lshw \
111 jq \
112 "
113 32
114do_compile_prepend() { 33do_compile_prepend() {
115 export SOTA_VERSION=$(make sota-version) 34 export SOTA_VERSION=$(make sota-version)
35 cd sota-client
116} 36}
117 37
118do_install() { 38do_install() {
39 ln -fs /lib ${D}/lib64
40
119 install -d ${D}${bindir} 41 install -d ${D}${bindir}
42 install -d ${D}${sysconfdir}
43
44 echo `git log -1 --pretty=format:%H` > ${D}${sysconfdir}/sota_client.version
45 install -c ${S}/sota-client/docker/sota_certificates ${D}${sysconfdir}
46
120 install -m 0755 target/${TARGET_SYS}/release/sota_client ${D}${bindir} 47 install -m 0755 target/${TARGET_SYS}/release/sota_client ${D}${bindir}
121 install -m 0755 run/sota_sysinfo.sh ${D}${bindir} 48 install -m 0755 ${S}/sota-client/docker/sota_provision.sh ${D}${bindir}
122 ln -fs ${bindir}/sota_sysinfo.sh ${D}${bindir}/system_info.sh # For compatibilty with old sota.toml files 49 install -m 0755 ${S}/sota-client/docker/sota_sysinfo.sh ${D}${bindir}
123 install -m 0755 run/sota_ostree.sh ${D}${bindir}
124 50
125 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then 51 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
126 install -d ${D}${systemd_unitdir}/system 52 install -d ${D}/${systemd_unitdir}/system
127 if ${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'true', 'false', d)}; then 53 if [ -n "$SOTA_AUTOPROVISION_CREDENTIALS" -o -n "$SOTA_PACKED_CREDENTIALS" ]; then
128 install -c ${S}/run/sota_client_ostree.service ${D}${systemd_unitdir}/system/sota_client.service 54 install -m 0644 ${WORKDIR}/sota-client-uptane.service ${D}/${systemd_unitdir}/system/sota-client.service
129 else 55 else
130 install -c ${S}/run/sota_client.service ${D}${systemd_unitdir}/system/sota_client.service 56 install -m 0644 ${WORKDIR}/sota-client-ostree.service ${D}/${systemd_unitdir}/system/sota-client.service
131 fi 57 fi
58 install -m 0644 ${WORKDIR}/sota-client-autoprovision.service ${D}/${systemd_unitdir}/system/sota-client-autoprovision.service
132 fi 59 fi
133
134 install -d ${D}${sysconfdir}
135 echo `git log -1 --pretty=format:%H` > ${D}${sysconfdir}/sota_client.version
136 install -c ${S}/run/sota_certificates ${D}${sysconfdir}
137} 60}
diff --git a/recipes-sota/rvi-sota-client/sota-installer_git.bb b/recipes-sota/rvi-sota-client/sota-installer_git.bb
new file mode 100644
index 0000000..09f6e5d
--- /dev/null
+++ b/recipes-sota/rvi-sota-client/sota-installer_git.bb
@@ -0,0 +1,25 @@
1require rvi-sota-client.inc
2
3
4SYSTEMD_SERVICE_${PN} = "sota-installer.service"
5
6DEPENDS += " rvi-sota-client "
7
8FILES_${PN} = " \
9${bindir}/sota-installer \
10${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota-installer.service', '', d)} \
11"
12
13do_compile_prepend() {
14 cd sota-installer
15}
16
17do_install() {
18 install -d ${D}${bindir}
19 install -m 0755 target/${TARGET_SYS}/release/sota-installer ${D}${bindir}
20
21 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
22 install -d ${D}/${systemd_unitdir}/system
23 install -m 0644 ${WORKDIR}/sota-installer.service ${D}/${systemd_unitdir}/system/sota-installer.service
24 fi
25}
diff --git a/recipes-sota/rvi-sota-client/sota-launcher_git.bb b/recipes-sota/rvi-sota-client/sota-launcher_git.bb
new file mode 100644
index 0000000..e9874e7
--- /dev/null
+++ b/recipes-sota/rvi-sota-client/sota-launcher_git.bb
@@ -0,0 +1,15 @@
1require rvi-sota-client.inc
2
3
4DEPENDS += " rvi-sota-client "
5FILES_${PN} = "${bindir}/sota-launcher"
6
7
8do_compile_prepend() {
9 cd sota-launcher
10}
11
12do_install() {
13 install -d ${D}${bindir}
14 install -m 0755 target/${TARGET_SYS}/release/sota-launcher ${D}${bindir}
15}
diff --git a/recipes-sota/sota-tools/sota-tools_git.bb b/recipes-sota/sota-tools/sota-tools_git.bb
index e472ff8..2b9d0cb 100644
--- a/recipes-sota/sota-tools/sota-tools_git.bb
+++ b/recipes-sota/sota-tools/sota-tools_git.bb
@@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea"
6S = "${WORKDIR}/git" 6S = "${WORKDIR}/git"
7 7
8SRC_URI = "gitsm://github.com/advancedtelematic/sota-tools.git;branch=master" 8SRC_URI = "gitsm://github.com/advancedtelematic/sota-tools.git;branch=master"
9SRCREV = "c6ecec3e86c423dd6caaa362a5ff0a1a6f4072a8" 9SRCREV = "216cb84db98e9b0f8c6c1c407f480c5dd0b3cf62"
10 10
11inherit cmake 11inherit cmake
12 12
diff --git a/recipes-support/fuse/fuse_%.bbappend b/recipes-support/fuse/fuse_%.bbappend
index 4f23349..85bdf50 100644
--- a/recipes-support/fuse/fuse_%.bbappend
+++ b/recipes-support/fuse/fuse_%.bbappend
@@ -1,3 +1,3 @@
1BBCLASSEXTEND = "native" 1BBCLASSEXTEND_append_sota = " native"
2 2
3PACKAGES_append_class-native = "fuse-utils-dbg-native fuse-utils-native libulockmgr-native libulockmgr-dev-native libulockmgr-dbg-native" 3PACKAGES_append_class-native_sota = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ' fuse-utils-dbg-native fuse-utils-native libulockmgr-native libulockmgr-dev-native libulockmgr-dbg-native', ' ', d)}"
diff --git a/recipes-support/glib-networking/glib-networking_%.bbappend b/recipes-support/glib-networking/glib-networking_%.bbappend
index d3267ac..fccb949 100644
--- a/recipes-support/glib-networking/glib-networking_%.bbappend
+++ b/recipes-support/glib-networking/glib-networking_%.bbappend
@@ -1 +1 @@
BBCLASSEXTEND = "native" BBCLASSEXTEND_append_sota = " native"
diff --git a/recipes-support/gpgme/gpgme_%.bbappend b/recipes-support/gpgme/gpgme_%.bbappend
index d3267ac..fccb949 100644
--- a/recipes-support/gpgme/gpgme_%.bbappend
+++ b/recipes-support/gpgme/gpgme_%.bbappend
@@ -1 +1 @@
BBCLASSEXTEND = "native" BBCLASSEXTEND_append_sota = " native"
diff --git a/recipes-support/libgit2/libgit2-release.inc b/recipes-support/libgit2/libgit2-release.inc
deleted file mode 100644
index 62a13cf..0000000
--- a/recipes-support/libgit2/libgit2-release.inc
+++ /dev/null
@@ -1,2 +0,0 @@
1require libgit2.inc
2SRC_URI = "https://github.com/libgit2/libgit2/archive/v${PV}.tar.gz"
diff --git a/recipes-support/libgit2/libgit2.inc b/recipes-support/libgit2/libgit2.inc
deleted file mode 100644
index fe0f647..0000000
--- a/recipes-support/libgit2/libgit2.inc
+++ /dev/null
@@ -1,19 +0,0 @@
1SUMMARY = "the Git linkable library"
2HOMEPAGE = "http://libgit2.github.com/"
3LICENSE = "GPL-2.0-with-GCC-exception"
4
5DEPENDS = "openssl zlib"
6
7inherit cmake
8
9# CLAR = tests, needs python-native
10EXTRA_OECMAKE = "\
11 -DTHREADSAFE=ON \
12 -DBUILD_CLAR=OFF \
13 -DSHA1_TYPE="builtin" \
14 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
15 -DBUILD_SHARED_LIBS=OFF \
16 -DBUILD_EXAMPLES=OFF \
17"
18
19BBCLASSEXTEND = "native"
diff --git a/recipes-support/libgit2/libgit2_0.24.1.bb b/recipes-support/libgit2/libgit2_0.24.1.bb
deleted file mode 100644
index 2d0c6ff..0000000
--- a/recipes-support/libgit2/libgit2_0.24.1.bb
+++ /dev/null
@@ -1,4 +0,0 @@
1LIC_FILES_CHKSUM = "file://COPYING;md5=34197a479f637beb9e09e56893f48bc2"
2SRC_URI[md5sum] = "3674ca2d40388b1175e25b6f5a3a82ad"
3SRC_URI[sha256sum] = "60198cbb34066b9b5c1613d15c0479f6cd25f4aef42f7ec515cd1cc13a77fede"
4require libgit2-release.inc
diff --git a/recipes-support/libgsystem/libgsystem_git.bb b/recipes-support/libgsystem/libgsystem_git.bb
index 048c44b..e2b362f 100644
--- a/recipes-support/libgsystem/libgsystem_git.bb
+++ b/recipes-support/libgsystem/libgsystem_git.bb
@@ -9,9 +9,10 @@ S = "${WORKDIR}/git"
9 9
10inherit autotools-brokensep gobject-introspection 10inherit autotools-brokensep gobject-introspection
11 11
12DEPENDS += "attr glib-2.0 pkgconfig libcap xz" 12DEPENDS += "attr glib-2.0 pkgconfig libcap gtk-doc-native gpgme"
13 13RDEPENDS_${PN} = "xz "
14RDEPENDS_${PN}_append = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' systemd', '', d)}" 14RDEPENDS_${PN}_append = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' systemd', '', d)}"
15
15RDEPENDS_${PN}_remove_class-native = "systemd-native" 16RDEPENDS_${PN}_remove_class-native = "systemd-native"
16 17
17BBCLASSEXTEND = "native" 18BBCLASSEXTEND = "native"
@@ -20,7 +21,8 @@ export STAGING_INCDIR
20export STAGING_LIBDIR 21export STAGING_LIBDIR
21 22
22do_configure() { 23do_configure() {
23 NOCONFIGURE=true ./autogen.sh 24 #NOCONFIGURE=true ./autogen.sh
25 autoreconf -vfi
24 oe_runconf 26 oe_runconf
25} 27}
26 28
diff --git a/recipes-support/libsoup/libsoup-2.4_%.bbappend b/recipes-support/libsoup/libsoup-2.4_%.bbappend
index ed24273..ce4df6d 100644
--- a/recipes-support/libsoup/libsoup-2.4_%.bbappend
+++ b/recipes-support/libsoup/libsoup-2.4_%.bbappend
@@ -1,3 +1,3 @@
1BBCLASSEXTEND = "native" 1BBCLASSEXTEND_append_sota = " native"
2 2
3DEPENDS_append_class-native = " glib-networking-native" 3DEPENDS_append_class-native = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ' glib-networking-native', ' ', d)}"
diff --git a/recipes-support/libssh2/libssh2_%.bbappend b/recipes-support/libssh2/libssh2_%.bbappend
index ce4807e..bebaf84 100644
--- a/recipes-support/libssh2/libssh2_%.bbappend
+++ b/recipes-support/libssh2/libssh2_%.bbappend
@@ -1,2 +1,2 @@
1# meta-oe/recipes-support/libssh2 1# meta-oe/recipes-support/libssh2
2BBCLASSEXTEND = "native" 2BBCLASSEXTEND_append_sota = " native"
diff --git a/recipes-support/lshw/lshw_02.16.bb b/recipes-support/lshw/lshw_02.16.bb
index 0b057bd..99901ff 100644
--- a/recipes-support/lshw/lshw_02.16.bb
+++ b/recipes-support/lshw/lshw_02.16.bb
@@ -14,11 +14,10 @@ DEPENDS = "pciutils \
14 usbutils" 14 usbutils"
15COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux" 15COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux"
16 16
17PR="r1"
18
19SRC_URI="http://ezix.org/software/files/lshw-B.${PV}.tar.gz \ 17SRC_URI="http://ezix.org/software/files/lshw-B.${PV}.tar.gz \
20 file://cross-compile.patch \ 18 file://cross-compile.patch \
21 file://ldflags.patch" 19 file://ldflags.patch \
20 "
22 21
23SRC_URI[md5sum] = "67479167add605e8f001097c30e96d0d" 22SRC_URI[md5sum] = "67479167add605e8f001097c30e96d0d"
24SRC_URI[sha256sum] = "809882429555b93259785cc261dbff04c16c93d064db5f445a51945bc47157cb" 23SRC_URI[sha256sum] = "809882429555b93259785cc261dbff04c16c93d064db5f445a51945bc47157cb"
diff --git a/recipes-support/python-canonicaljson/python-canonicaljson.bb b/recipes-support/python-canonicaljson/python-canonicaljson.bb
new file mode 100644
index 0000000..d8a0728
--- /dev/null
+++ b/recipes-support/python-canonicaljson/python-canonicaljson.bb
@@ -0,0 +1,18 @@
1DESCRIPTION = "python-canonicaljson recipe"
2
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=2ee41112a44fe7014dce33e26468ba93"
5
6SRCREV = "92e2c06871cc275c2a8b8e3e899141a212aae0e8"
7SRC_URI = "git://github.com/matrix-org/python-canonicaljson.git"
8S = "${WORKDIR}/git"
9
10# Generate with:
11# git describe --tags | cut -b2-
12PV = "1.0.0"
13inherit setuptools
14
15RDEPENDS_${PN} = "\
16 python-simplejson \
17 python-frozendict \
18 "
diff --git a/recipes-support/python-frozendict/python-frozendict.bb b/recipes-support/python-frozendict/python-frozendict.bb
new file mode 100644
index 0000000..79fe5c8
--- /dev/null
+++ b/recipes-support/python-frozendict/python-frozendict.bb
@@ -0,0 +1,12 @@
1DESCRIPTION = "python-frozendict recipe"
2
3LICENSE = "BSD"
4LIC_FILES_CHKSUM = "file://${S}/LICENSE.txt;md5=f4da037a49c09b456fdbbc7a5bd36132"
5
6SRCREV = "c5d16bafcca7b72ff3e8f40d3a9081e4c9233f1b"
7SRC_URI = "git://github.com/slezica/python-frozendict.git"
8S = "${WORKDIR}/git"
9
10PV = "1.2"
11inherit setuptools
12
diff --git a/recipes-support/python-petname/python-petname.bb b/recipes-support/python-petname/python-petname.bb
new file mode 100644
index 0000000..9abd5d9
--- /dev/null
+++ b/recipes-support/python-petname/python-petname.bb
@@ -0,0 +1,16 @@
1DESCRIPTION = "python-petname recipe"
2
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
5
6SRCREV = "d0b767cdb1567defb104f29c3fd022239a7f231e"
7SRC_URI = "git://github.com/dustinkirkland/python-petname.git"
8S = "${WORKDIR}/git"
9
10PV = "2.2"
11inherit setuptools
12RDEPENDS_${PN} = " python-setuptools \
13 python-argparse \
14 "
15
16FILES_${PN} = "${libdir} ${bindir}/petname"
diff --git a/recipes-support/util-linux/util-linux_%.bbappend b/recipes-support/util-linux/util-linux_%.bbappend
index bd3f686..d653bb2 100644
--- a/recipes-support/util-linux/util-linux_%.bbappend
+++ b/recipes-support/util-linux/util-linux_%.bbappend
@@ -1,10 +1,3 @@
1PACKAGES_append_class-native = "util-linux-agetty-native util-linux-fdisk-native util-linux-cfdisk-native util-linux-sfdisk-native \ 1PACKAGES_append_class-native = "${@bb.utils.contains('DISTRO_FEATURES', 'sota', ' util-linux-agetty-native util-linux-fdisk-native util-linux-cfdisk-native util-linux-sfdisk-native util-linux-swaponoff-native util-linux-losetup-native util-linux-umount-native util-linux-mount-native util-linux-readprofile-native util-linux-uuidd-native util-linux-uuidgen-native util-linux-lscpu-native util-linux-fsck-native util-linux-blkid util-linux-mkfs-native util-linux-mcookie-native util-linux-reset-native util-linux-mkfs.cramfs-native util-linux-fsck.cramfs-native util-linux-fstrim-native util-linux-partx-native ${PN}-bash-completion-native util-linux-hwclock util-linux-findfs-native util-linux-getopt-native util-linux-sulogin-native', ' ', d)}"
2 util-linux-swaponoff-native util-linux-losetup-native util-linux-umount-native \
3 util-linux-mount-native util-linux-readprofile-native util-linux-uuidd-native \
4 util-linux-uuidgen-native util-linux-lscpu-native util-linux-fsck-native util-linux-blkid \
5 util-linux-mkfs-native util-linux-mcookie-native util-linux-reset-native \
6 util-linux-mkfs.cramfs-native util-linux-fsck.cramfs-native util-linux-fstrim-native \
7 util-linux-partx-native ${PN}-bash-completion-native util-linux-hwclock \
8 util-linux-findfs-native util-linux-getopt-native util-linux-sulogin-native \
9 ${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', 'util-linux-pylibmount-native', '', d)}"
10 2
3PACKAGES_append_class-native = "${@' util-linux-pylibmount-native' if bb.utils.contains('DISTRO_FEATURES', 'sota', True, False, d) and bb.utils.contains('PACKAGECONFIG', 'pylibmount', True, False, d) else ' '}"
diff --git a/recipes-test/big-update/big-update_1.0.bb b/recipes-test/big-update/big-update_1.0.bb
new file mode 100644
index 0000000..78852a9
--- /dev/null
+++ b/recipes-test/big-update/big-update_1.0.bb
@@ -0,0 +1,11 @@
1DESCRIPTION = "Example Package with 10MB of random, seeded content"
2LICENSE = "CLOSED"
3
4SRC_URI = "file://rand_file.py"
5
6FILES_${PN} = "/usr/lib/big-update"
7
8do_install() {
9 install -d ${D}/usr/lib/big-update
10 python ${S}/../rand_file.py ${D}/usr/lib/big-update/a-big-file $(numfmt --from=iec 10M)
11}
diff --git a/recipes-test/big-update/big-update_2.0.bb b/recipes-test/big-update/big-update_2.0.bb
new file mode 100644
index 0000000..6d32557
--- /dev/null
+++ b/recipes-test/big-update/big-update_2.0.bb
@@ -0,0 +1,11 @@
1DESCRIPTION = "Example Package with 12MB of random, seeded content"
2LICENSE = "CLOSED"
3
4SRC_URI = "file://rand_file.py"
5
6FILES_${PN} = "/usr/lib/big-update"
7
8do_install() {
9 install -d ${D}/usr/lib/big-update
10 python ${S}/../rand_file.py ${D}/usr/lib/big-update/a-big-file $(numfmt --from=iec 12M)
11}
diff --git a/recipes-test/big-update/files/rand_file.py b/recipes-test/big-update/files/rand_file.py
new file mode 100644
index 0000000..0f4f16e
--- /dev/null
+++ b/recipes-test/big-update/files/rand_file.py
@@ -0,0 +1,16 @@
1import sys
2from random import seed, randint
3
4def main():
5 n = int(sys.argv[2])
6 ba = bytearray(n)
7
8 seed(42)
9 for i in range(0, n):
10 ba[i] = randint(0, 255)
11
12 with open(sys.argv[1], 'wb') as f:
13 f.write(bytes(ba))
14
15if __name__ == "__main__":
16 main()
diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh
new file mode 100755
index 0000000..ff78681
--- /dev/null
+++ b/scripts/envsetup.sh
@@ -0,0 +1,35 @@
1#!/bin/bash
2
3SCRIPT="envsetup.sh"
4MACHINE="$1"
5BUILDDIR="build"
6
7[[ "$#" -lt 1 ]] && { echo "Usage: ${SCRIPT} <machine> [builddir]"; return 1; }
8[[ "$#" -eq 2 ]] && { BUILDDIR="$2"; }
9
10# detect if this script is sourced: see http://stackoverflow.com/a/38128348/6255594
11SOURCED=0
12if [ -n "$ZSH_EVAL_CONTEXT" ]; then
13 [[ "$ZSH_EVAL_CONTEXT" =~ :file$ ]] && { SOURCED=1; SOURCEDIR=$(cd "$(dirname -- "$0")" && pwd -P); }
14elif [ -n "$BASH_VERSION" ]; then
15 [[ "$0" != "${BASH_SOURCE[0]}" ]] && { SOURCED=1; SOURCEDIR=$(cd "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P); }
16fi
17
18if [[ $SOURCED -ne 1 ]]; then
19 echo "Error: this script needs to be sourced in a supported shell" >&2
20 echo "Please check that the current shell is bash or zsh and run this script as '. $0 <args>'" >&2
21 exit 1
22fi
23
24METADIR="${SOURCEDIR}/../.."
25
26if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then
27 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR"
28 echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf
29 cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf
30 cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf
31 echo "MACHINE = \"${MACHINE}\"" >> conf/local.conf
32 echo "DISTRO = \"poky-sota-systemd\"" >> conf/local.conf
33else
34 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR"
35fi
diff --git a/scripts/lib/wic/canned-wks/efiimage-sota.wks b/scripts/lib/wic/canned-wks/efiimage-sota.wks
new file mode 100644
index 0000000..1e37d96
--- /dev/null
+++ b/scripts/lib/wic/canned-wks/efiimage-sota.wks
@@ -0,0 +1,8 @@
1# short-description: Create an OTA-enabled EFI disk image
2# long-description: Creates an OTA-enabled EFI disk image that the user
3# can directly dd to boot media.
4
5part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --ondisk hda --label msdos --active --align 1024
6part / --source otaimage --ondisk hda --fstype=ext4 --align 1024 --use-uuid
7
8bootloader --ptable gpt --timeout=5 --append="rootfstype=ext4 console=ttyS0,115200 console=tty0" --configfile="grub-ota.cfg"
diff --git a/scripts/lib/wic/canned-wks/grub-ota.cfg b/scripts/lib/wic/canned-wks/grub-ota.cfg
new file mode 100644
index 0000000..fcd8d70
--- /dev/null
+++ b/scripts/lib/wic/canned-wks/grub-ota.cfg
@@ -0,0 +1,2 @@
1search.fs_label otaroot root
2configfile /boot/loader/grub.cfg
diff --git a/scripts/lib/wic/canned-wks/sdimage-sota.wks b/scripts/lib/wic/canned-wks/sdimage-sota.wks
new file mode 100644
index 0000000..c31c3a5
--- /dev/null
+++ b/scripts/lib/wic/canned-wks/sdimage-sota.wks
@@ -0,0 +1,7 @@
1# short-description: Create OTA-enabled SD card image
2# long-description: Creates a partitioned SD card image with OSTree
3# physical sysroot as a payload. Boot files are located in the
4# first vfat partition.
5
6part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat --label boot --active --align 4096 --size 20
7part / --source otaimage --ondisk mmcblk --fstype=ext4 --label root --align 4096
diff --git a/scripts/lib/wic/plugins/source/otaimage.py b/scripts/lib/wic/plugins/source/otaimage.py
new file mode 100644
index 0000000..dc507a8
--- /dev/null
+++ b/scripts/lib/wic/plugins/source/otaimage.py
@@ -0,0 +1,68 @@
1# ex:ts=4:sw=4:sts=4:et
2# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License version 2 as
6# published by the Free Software Foundation.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License along
14# with this program; if not, write to the Free Software Foundation, Inc.,
15# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16#
17
18import os
19
20from wic import msger
21from wic.pluginbase import SourcePlugin
22from wic.utils.oe.misc import get_bitbake_var
23
24class OTAImagePlugin(SourcePlugin):
25 """
26 Add an already existing filesystem image to the partition layout.
27 """
28
29 name = 'otaimage'
30
31 @classmethod
32 def do_install_disk(cls, disk, disk_name, cr, workdir, oe_builddir,
33 bootimg_dir, kernel_dir, native_sysroot):
34 """
35 Called after all partitions have been prepared and assembled into a
36 disk image. Do nothing.
37 """
38 pass
39
40 @classmethod
41 def do_configure_partition(cls, part, source_params, cr, cr_workdir,
42 oe_builddir, bootimg_dir, kernel_dir,
43 native_sysroot):
44 """
45 Called before do_prepare_partition(). Possibly prepare
46 configuration files of some sort.
47 """
48 pass
49
50 @classmethod
51 def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
52 oe_builddir, bootimg_dir, kernel_dir,
53 rootfs_dir, native_sysroot):
54 """
55 Called to do the actual content population for a partition i.e. it
56 'prepares' the partition to be incorporated into the image.
57 """
58 bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
59 if not bootimg_dir:
60 msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n")
61
62 msger.debug('Bootimg dir: %s' % bootimg_dir)
63
64 src = bootimg_dir + "/" + get_bitbake_var("IMAGE_LINK_NAME") + ".otaimg"
65
66 msger.debug('Preparing partition using image %s' % (src))
67 part.prepare_rootfs_from_fs_image(cr_workdir, src, "")
68
diff --git a/scripts/qa b/scripts/qa
new file mode 100755
index 0000000..e5133f0
--- /dev/null
+++ b/scripts/qa
@@ -0,0 +1,60 @@
1#!/usr/bin/env python3
2
3from subprocess import Popen, PIPE
4from glob import glob
5from os.path import dirname, join, abspath, exists
6from os import chdir
7import signal
8
9root = abspath(dirname(dirname(dirname(__file__))))
10print("Root dir is:" + root)
11
12args = ['bitbake', 'core-image-minimal']
13
14
15class Runner(object):
16 UNKNOWN = 'unknown'
17 PASS = 'pass'
18 FAIL = 'fail'
19 SKIP = 'skipped'
20
21 def __init__(self, dirs):
22 self._dirs = dirs
23 self._child = None
24 self._results = {}
25 for d in dirs:
26 self._results[d] = self.UNKNOWN
27
28 def run(self):
29 for d in self._dirs:
30 chdir(d)
31 if exists(join(d, '.qaskip')):
32 print("Skipping %s because of .qaskip file" % d)
33 self._results[d] = self.SKIP
34 continue
35 print("Building in " + d)
36 self._child = Popen(args=args, cwd=d, stdin=PIPE)
37 retcode = self._child.wait()
38 self._child = None
39 if retcode == 0:
40 self._results[d] = self.PASS
41 else:
42 self._results[d] = self.FAIL
43 print("Error, stopping qa script at %s" % d)
44 break
45 for d, result in self._results.items():
46 print("%20s %s" % (d, result))
47
48 def handle_signal(self, signo, stack_frame):
49 if self._child:
50 self._child
51
52
53def main():
54 dirs = glob(join(root, 'build*'))
55 runner = Runner(dirs)
56 signal.signal(signalnum=signal.SIGINT, handler=runner.handle_signal)
57 runner.run()
58
59if __name__ == "__main__":
60 main()
diff --git a/scripts/run-qemu-ota b/scripts/run-qemu-ota
new file mode 100755
index 0000000..181558c
--- /dev/null
+++ b/scripts/run-qemu-ota
@@ -0,0 +1,150 @@
1#! /usr/bin/env python
2
3from argparse import ArgumentParser
4from subprocess import Popen
5from os.path import exists, join, realpath
6from os import listdir
7import random
8import sys
9import socket
10
11DEFAULT_DIR = 'tmp/deploy/images'
12
13EXTENSIONS = {
14 'intel-corei7-64': 'wic',
15 'qemux86-64': 'otaimg'
16}
17
18
19def find_local_port(start_port):
20 """"
21 Find the next free TCP port after 'start_port'.
22 """
23
24 for port in range(start_port, start_port + 10):
25 try:
26 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
27 s.bind(('', port))
28 return port
29 except socket.error:
30 print("Skipping port %d" % port)
31 finally:
32 s.close()
33 raise Exception("Could not find a free TCP port")
34
35
36def random_mac():
37 """Return a random Ethernet MAC address
38 @link https://www.iana.org/assignments/ethernet-numbers/ethernet-numbers.xhtml#ethernet-numbers-2
39 """
40 head = "ca:fe:"
41 hex_digits = '0123456789abcdef'
42 tail = ':'.join([random.choice(hex_digits) + random.choice(hex_digits) for _ in range(4)])
43 return head + tail
44
45
46class QemuCommand(object):
47 def __init__(self, args):
48 if args.machine:
49 self.machine = args.machine
50 else:
51 machines = listdir(args.dir)
52 if len(machines) == 1:
53 self.machine = machines[0]
54 else:
55 raise ValueError("Could not autodetect machine type from %s" % args.dir)
56 if args.efi:
57 self.bios = 'OVMF.fd'
58 else:
59 uboot = join(args.dir, self.machine, 'u-boot-qemux86-64.rom')
60 if not exists(uboot):
61 raise ValueError("U-Boot image %s does not exist" % uboot)
62 self.bios = uboot
63 ext = EXTENSIONS.get(self.machine, 'wic')
64 image = join(args.dir, self.machine, '%s-%s.%s' % (args.imagename, self.machine, ext))
65 self.image = realpath(image)
66 if not exists(self.image):
67 raise ValueError("OS image %s does not exist" % self.image)
68 if args.mac:
69 self.mac_address = args.mac
70 else:
71 self.mac_address = random_mac()
72 self.serial_port = find_local_port(8990)
73 self.ssh_port = find_local_port(2222)
74 self.kvm = not args.no_kvm
75 self.gui = not args.no_gui
76 self.gdb = args.gdb
77 self.pcap = args.pcap
78
79 def command_line(self):
80 netuser = 'user,hostfwd=tcp:0.0.0.0:%d-:22,restrict=off' % self.ssh_port
81 if self.gdb:
82 netuser += ',hostfwd=tcp:0.0.0.0:2159-:2159'
83 cmdline = [
84 "qemu-system-x86_64",
85 "-bios", self.bios,
86 "-drive", "file=%s,if=ide,format=raw,snapshot=on" % self.image,
87 "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port,
88 "-m", "1G",
89 "-usb",
90 "-usbdevice", "tablet",
91 "-show-cursor",
92 "-vga", "std",
93 "-net", netuser,
94 "-net", "nic,macaddr=%s" % self.mac_address
95 ]
96 if self.pcap:
97 cmdline += ['-net', 'dump,file=' + self.pcap]
98 if self.gui:
99 cmdline += ["-serial", "stdio"]
100 else:
101 cmdline.append('-nographic')
102 if self.kvm:
103 cmdline.append('-enable-kvm')
104 else:
105 cmdline += ['-cpu', 'Haswell']
106 return cmdline
107
108
109def main():
110 parser = ArgumentParser(description='Run meta-updater image in qemu')
111 parser.add_argument('imagename', default='core-image-minimal', nargs='?')
112 parser.add_argument('mac', default=None, nargs='?')
113 parser.add_argument('--dir', default=DEFAULT_DIR,
114 help='Path to build directory containing the image and u-boot-qemux86-64.rom')
115 parser.add_argument('--efi',
116 help='Boot using UEFI rather than U-Boot. This requires the image to be built with ' +
117 'OSTREE_BOOTLOADER = "grub" and OVMF.fd firmware to be installed (try "apt install ovmf")',
118 action='store_true')
119 parser.add_argument('--machine', default=None, help="Target MACHINE")
120 parser.add_argument('--no-kvm', help='Disable KVM in QEMU', action='store_true')
121 parser.add_argument('--no-gui', help='Disable GUI', action='store_true')
122 parser.add_argument('--gdb', help='Export gdbserver port 2159 from the image', action='store_true')
123 parser.add_argument('--pcap', default=None, help='Dump all network traffic')
124 parser.add_argument('-n', '--dry-run', help='Print qemu command line rather then run it', action='store_true')
125 args = parser.parse_args()
126 try:
127 qemu_command = QemuCommand(args)
128 except ValueError as e:
129 print(e.message)
130 sys.exit(1)
131
132 print("Launching %s with mac address %s" % (args.imagename, qemu_command.mac_address))
133 print("To connect via SSH:")
134 print(" ssh -o StrictHostKeyChecking=no root@localhost -p %d" % qemu_command.ssh_port)
135 print("To connect to the serial console:")
136 print(" nc localhost %d" % qemu_command.serial_port)
137
138 cmdline = qemu_command.command_line()
139 if args.dry_run:
140 print(" ".join(cmdline))
141 else:
142 s = Popen(cmdline)
143 try:
144 s.wait()
145 except KeyboardInterrupt:
146 pass
147
148
149if __name__ == '__main__':
150 main()
diff --git a/scripts/runqemu b/scripts/runqemu
deleted file mode 100755
index b6c9b54..0000000
--- a/scripts/runqemu
+++ /dev/null
@@ -1,575 +0,0 @@
1#!/bin/bash
2#
3# Handle running OE images standalone with QEMU
4#
5# Copyright (C) 2006-2011 Linux Foundation
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 2 as
9# published by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program; if not, write to the Free Software Foundation, Inc.,
18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20usage() {
21 MYNAME=`basename $0`
22cat <<_EOF
23
24Usage: you can run this script with any valid combination
25of the following environment variables (in any order):
26 KERNEL - the kernel image file to use
27 ROOTFS - the rootfs image file or nfsroot directory to use
28 MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)
29 Simplified QEMU command-line options can be passed with:
30 nographic - disables video console
31 serial - enables a serial console on /dev/ttyS0
32 kvm - enables KVM when running qemux86/qemux86-64 (VT-capable CPU required)
33 kvm-vhost - enables KVM with vhost support when running qemux86/qemux86-64 (VT-capable CPU required)
34 publicvnc - enable a VNC server open to all hosts
35 qemuparams="xyz" - specify custom parameters to QEMU
36 bootparams="xyz" - specify custom kernel parameters during boot
37
38Examples:
39 $MYNAME qemuarm
40 $MYNAME qemux86-64 core-image-sato ext4
41 $MYNAME qemux86-64 wic-image-minimal wic
42 $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial
43 $MYNAME qemux86 iso/hddimg/vmdk/qcow2/vdi/ramfs/cpio.gz...
44 $MYNAME qemux86 qemuparams="-m 256"
45 $MYNAME qemux86 bootparams="psplash=false"
46 $MYNAME path/to/<image>-<machine>.vmdk
47 $MYNAME path/to/<image>-<machine>.wic
48_EOF
49 exit 1
50}
51
52if [ "x$1" = "x" ]; then
53 usage
54fi
55
56error() {
57 echo "Error: "$*
58 usage
59}
60
61MACHINE=${MACHINE:=""}
62KERNEL=${KERNEL:=""}
63ROOTFS=${ROOTFS:=""}
64FSTYPE=${FSTYPE:=""}
65LAZY_ROOTFS=""
66SCRIPT_QEMU_OPT=""
67SCRIPT_QEMU_EXTRA_OPT=""
68SCRIPT_KERNEL_OPT=""
69SERIALSTDIO=""
70TCPSERIAL_PORTNUM=""
71KVM_ENABLED="no"
72KVM_ACTIVE="no"
73VHOST_ENABLED="no"
74VHOST_ACTIVE="no"
75IS_VM="false"
76
77# Determine whether the file is a kernel or QEMU image, and set the
78# appropriate variables
79process_filename() {
80 filename=$1
81
82 # Extract the filename extension
83 EXT=`echo $filename | awk -F . '{ print \$NF }'`
84 case /$EXT/ in
85 /bin/)
86 # A file ending in .bin is a kernel
87 [ -z "$KERNEL" ] && KERNEL=$filename || \
88 error "conflicting KERNEL args [$KERNEL] and [$filename]"
89 ;;
90 /ext[234]/|/jffs2/|/btrfs/)
91 # A file ending in a supportted fs type is a rootfs image
92 if [ -z "$FSTYPE" -o "$FSTYPE" = "$EXT" ]; then
93 FSTYPE=$EXT
94 ROOTFS=$filename
95 else
96 error "conflicting FSTYPE types [$FSTYPE] and [$EXT]"
97 fi
98 ;;
99 /hddimg/|/hdddirect/|/vmdk/|/wic/|/qcow2/|/vdi/|/otaimg/)
100 FSTYPE=$EXT
101 VM=$filename
102 ROOTFS=$filename
103 IS_VM="true"
104 ;;
105 *)
106 error "unknown file arg [$filename]"
107 ;;
108 esac
109}
110
111check_fstype_conflicts() {
112 if [ -z "$FSTYPE" -o "$FSTYPE" = "$1" ]; then
113 FSTYPE=$1
114 else
115 error "conflicting FSTYPE types [$FSTYPE] and [$1]"
116 fi
117}
118# Parse command line args without requiring specific ordering. It's a
119# bit more complex, but offers a great user experience.
120while true; do
121 arg=${1}
122 case "$arg" in
123 "qemux86" | "qemux86-64" | "qemuarm" | "qemuarm64" | "qemumips" | "qemumipsel" | \
124 "qemumips64" | "qemush4" | "qemuppc" | "qemumicroblaze" | "qemuzynq" | "qemuzynqmp")
125 [ -z "$MACHINE" -o "$MACHINE" = "$arg" ] && MACHINE=$arg || \
126 error "conflicting MACHINE types [$MACHINE] and [$arg]"
127 ;;
128 "ext"[234] | "jffs2" | "nfs" | "btrfs")
129 check_fstype_conflicts $arg
130 ;;
131 "hddimg" | "hdddirect" | "wic" | "vmdk" | "qcow2" | "vdi" | "iso" | "otaimg")
132 check_fstype_conflicts $arg
133 IS_VM="true"
134 ;;
135 "ramfs" | "cpio.gz")
136 FSTYPE=cpio.gz
137 ;;
138 "nographic")
139 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -nographic"
140 SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
141 ;;
142 "serial")
143 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -serial stdio"
144 SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
145 SERIALSTDIO="1"
146 ;;
147 "tcpserial="*)
148 TCPSERIAL_PORTNUM=${arg##tcpserial=}
149 ;;
150 "biosdir="*)
151 CUSTOMBIOSDIR="${arg##biosdir=}"
152 ;;
153 "biosfilename="*)
154 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -bios ${arg##biosfilename=}"
155 ;;
156 "qemuparams="*)
157 SCRIPT_QEMU_EXTRA_OPT="${arg##qemuparams=}"
158
159 # Warn user if they try to specify serial or kvm options
160 # to use simplified options instead
161 serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'`
162 kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'`
163 vga_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-vga\)'`
164 [ ! -z "$serial_option" -o ! -z "$kvm_option" ] && \
165 echo "Please use simplified serial or kvm options instead"
166 ;;
167 "bootparams="*)
168 SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT ${arg##bootparams=}"
169 ;;
170 "audio")
171 if [ "x$MACHINE" = "xqemux86" -o "x$MACHINE" = "xqemux86-64" ]; then
172 echo "Enabling audio in qemu."
173 echo "Please install snd_intel8x0 or snd_ens1370 driver in linux guest."
174 QEMU_AUDIO_DRV="alsa"
175 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -soundhw ac97,es1370"
176 fi
177 ;;
178 "kvm")
179 KVM_ENABLED="yes"
180 KVM_CAPABLE=`grep -q 'vmx\|svm' /proc/cpuinfo && echo 1`
181 ;;
182 "kvm-vhost")
183 KVM_ENABLED="yes"
184 KVM_CAPABLE=`grep -q 'vmx\|svm' /proc/cpuinfo && echo 1`
185 VHOST_ENABLED="yes"
186 ;;
187 "slirp")
188 SLIRP_ENABLED="yes"
189 ;;
190 "publicvnc")
191 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -vnc :0"
192 ;;
193 *-image*)
194 [ -z "$ROOTFS" ] || \
195 error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
196 if [ -f "$arg" ]; then
197 process_filename $arg
198 elif [ -d "$arg" ]; then
199 # Handle the case where the nfsroot dir has -image-
200 # in the pathname
201 echo "Assuming $arg is an nfs rootfs"
202 FSTYPE=nfs
203 ROOTFS=$arg
204 else
205 ROOTFS=$arg
206 LAZY_ROOTFS="true"
207 fi
208 ;;
209 "") break ;;
210 *)
211 # A directory name is an nfs rootfs
212 if [ -d "$arg" ]; then
213 echo "Assuming $arg is an nfs rootfs"
214 if [ -z "$FSTYPE" -o "$FSTYPE" = "nfs" ]; then
215 FSTYPE=nfs
216 else
217 error "conflicting FSTYPE types [$arg] and nfs"
218 fi
219
220 if [ -z "$ROOTFS" ]; then
221 ROOTFS=$arg
222 else
223 error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
224 fi
225 elif [ -f "$arg" ]; then
226 process_filename $arg
227 else
228 error "unable to classify arg [$arg]"
229 fi
230 ;;
231 esac
232 shift
233done
234
235if [ ! -c /dev/net/tun ] ; then
236 echo "TUN control device /dev/net/tun is unavailable; you may need to enable TUN (e.g. sudo modprobe tun)"
237 exit 1
238elif [ ! -w /dev/net/tun ] ; then
239 echo "TUN control device /dev/net/tun is not writable, please fix (e.g. sudo chmod 666 /dev/net/tun)"
240 exit 1
241fi
242
243# Report errors for missing combinations of options
244if [ -z "$MACHINE" -a -z "$KERNEL" -a -z "$VM" -a "$FSTYPE" != "wic" ]; then
245 error "you must specify at least a MACHINE or KERNEL argument"
246fi
247if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then
248 error "NFS booting without an explicit ROOTFS path is not yet supported"
249fi
250
251if [ -z "$MACHINE" ]; then
252 if [ "$IS_VM" = "true" ]; then
253 [ "x$FSTYPE" = "xwic" ] && filename=$ROOTFS || filename=$VM
254 MACHINE=`basename $filename | sed -n 's/.*\(qemux86-64\|qemux86\|qemuarm64\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'`
255 if [ -z "$MACHINE" ]; then
256 error "Unable to set MACHINE from image filename [$VM]"
257 fi
258 echo "Set MACHINE to [$MACHINE] based on image [$VM]"
259 else
260 MACHINE=`basename $KERNEL | sed -n 's/.*\(qemux86-64\|qemux86\|qemuarm64\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'`
261 if [ -z "$MACHINE" ]; then
262 error "Unable to set MACHINE from kernel filename [$KERNEL]"
263 fi
264 echo "Set MACHINE to [$MACHINE] based on kernel [$KERNEL]"
265 fi
266fi
267
268YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu"
269YOCTO_PARAVIRT_KVM_WIKI="https://wiki.yoctoproject.org/wiki/Running_an_x86_Yocto_Linux_image_under_QEMU_KVM"
270# Detect KVM configuration
271if [ "x$KVM_ENABLED" = "xyes" ]; then
272 if [ -z "$KVM_CAPABLE" ]; then
273 echo "You are trying to enable KVM on a cpu without VT support."
274 echo "Remove kvm from the command-line, or refer"
275 echo "$YOCTO_KVM_WIKI";
276 exit 1;
277 fi
278 if [ "x$MACHINE" != "xqemux86" -a "x$MACHINE" != "xqemux86-64" ]; then
279 echo "KVM only support x86 & x86-64. Remove kvm from the command-line";
280 exit 1;
281 fi
282 if [ ! -e /dev/kvm ]; then
283 echo "Missing KVM device. Have you inserted kvm modules?"
284 echo "For further help see:"
285 echo "$YOCTO_KVM_WIKI";
286 exit 1;
287 fi
288 if [ -w /dev/kvm -a -r /dev/kvm ]; then
289 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm"
290 KVM_ACTIVE="yes"
291 else
292 echo "You have no rights on /dev/kvm."
293 echo "Please change the ownership of this file as described at:"
294 echo "$YOCTO_KVM_WIKI";
295 exit 1;
296 fi
297 if [ "x$VHOST_ENABLED" = "xyes" ]; then
298 if [ ! -e /dev/vhost-net ]; then
299 echo "Missing virtio net device. Have you inserted vhost-net module?"
300 echo "For further help see:"
301 echo "$YOCTO_PARAVIRT_KVM_WIKI";
302 exit 1;
303 fi
304
305 if [ -w /dev/vhost-net -a -r /dev/vhost-net ]; then
306 VHOST_ACTIVE="yes"
307 else
308 echo "You have no rights on /dev/vhost-net."
309 echo "Please change the ownership of this file as described at:"
310 echo "$YOCTO_KVM_WIKI";
311 exit 1;
312 fi
313 fi
314fi
315
316machine2=`echo $MACHINE | tr 'a-z' 'A-Z' | sed 's/-/_/'`
317# MACHINE is now set for all cases
318
319# Defaults used when these vars need to be inferred
320QEMUX86_DEFAULT_KERNEL=bzImage-qemux86.bin
321QEMUX86_DEFAULT_FSTYPE=ext4
322
323QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin
324QEMUX86_64_DEFAULT_FSTYPE=ext4
325
326QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin
327QEMUARM_DEFAULT_FSTYPE=ext4
328
329QEMUARM64_DEFAULT_KERNEL=Image-qemuarm64.bin
330QEMUARM64_DEFAULT_FSTYPE=ext4
331
332QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin
333QEMUMIPS_DEFAULT_FSTYPE=ext4
334
335QEMUMIPSEL_DEFAULT_KERNEL=vmlinux-qemumipsel.bin
336QEMUMIPSEL_DEFAULT_FSTYPE=ext4
337
338QEMUMIPS64_DEFAULT_KERNEL=vmlinux-qemumips64.bin
339QEMUMIPS64_DEFAULT_FSTYPE=ext4
340
341QEMUSH4_DEFAULT_KERNEL=vmlinux-qemumips.bin
342QEMUSH4_DEFAULT_FSTYPE=ext4
343
344QEMUPPC_DEFAULT_KERNEL=vmlinux-qemuppc.bin
345QEMUPPC_DEFAULT_FSTYPE=ext4
346
347QEMUMICROBLAZE_DEFAULT_KERNEL=linux.bin.ub
348QEMUMICROBLAZE_DEFAULT_FSTYPE=cpio
349
350QEMUZYNQ_DEFAULT_KERNEL=uImage
351QEMUZYNQ_DEFAULT_FSTYPE=cpio
352
353QEMUZYNQMP_DEFAULT_KERNEL=Image
354QEMUZYNQMP_DEFAULT_FSTYPE=cpio
355
356setup_path_vars() {
357 if [ -z "$OE_TMPDIR" ] ; then
358 PATHS_REQUIRED=true
359 elif [ "$1" = "1" -a -z "$DEPLOY_DIR_IMAGE" ] ; then
360 PATHS_REQUIRED=true
361 else
362 PATHS_REQUIRED=false
363 fi
364
365 if [ "$PATHS_REQUIRED" = "true" ]; then
366 # Try to get the variable values from bitbake
367 type -P bitbake &>/dev/null || {
368 echo "In order for this script to dynamically infer paths";
369 echo "to kernels or filesystem images, you either need";
370 echo "bitbake in your PATH or to source oe-init-build-env";
371 echo "before running this script" >&2;
372 exit 1; }
373
374 # We have bitbake in PATH, get the variable values from bitbake
375 BITBAKE_ENV_TMPFILE=`mktemp --tmpdir runqemu.XXXXXXXXXX`
376 if [ "$?" != "0" ] ; then
377 echo "Error: mktemp failed for bitbake environment output"
378 exit 1
379 fi
380
381 MACHINE=$MACHINE bitbake -e > $BITBAKE_ENV_TMPFILE
382 if [ -z "$OE_TMPDIR" ] ; then
383 OE_TMPDIR=`sed -n 's/^TMPDIR=\"\(.*\)\"/\1/p' $BITBAKE_ENV_TMPFILE`
384 fi
385 if [ -z "$DEPLOY_DIR_IMAGE" ] ; then
386 DEPLOY_DIR_IMAGE=`sed -n 's/^DEPLOY_DIR_IMAGE=\"\(.*\)\"/\1/p' $BITBAKE_ENV_TMPFILE`
387 fi
388 if [ -z "$QEMU_DTB" ] ; then
389 QEMU_DTB=`sed -n 's/^QEMU_DTB=\"\(.*\)\"/\1/p' $BITBAKE_ENV_TMPFILE`
390 fi
391 if [ -z "$OE_TMPDIR" ]; then
392 # Check for errors from bitbake that the user needs to know about
393 BITBAKE_OUTPUT=`cat $BITBAKE_ENV_TMPFILE | wc -l`
394 if [ "$BITBAKE_OUTPUT" -eq "0" ]; then
395 echo "Error: this script needs to be run from your build directory, or you need"
396 echo "to explicitly set OE_TMPDIR and DEPLOY_DIR_IMAGE in your environment"
397 else
398 echo "There was an error running bitbake to determine TMPDIR"
399 echo "Here is the output from 'bitbake -e':"
400 cat $BITBAKE_ENV_TMPFILE
401 fi
402 rm $BITBAKE_ENV_TMPFILE
403 exit 1
404 fi
405 rm $BITBAKE_ENV_TMPFILE
406 fi
407}
408
409setup_sysroot() {
410 # Toolchain installs set up $OECORE_NATIVE_SYSROOT in their
411 # environment script. If that variable isn't set, we're
412 # either in an in-tree build scenario or the environment
413 # script wasn't source'd.
414 if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
415 setup_path_vars
416 BUILD_ARCH=`uname -m`
417 BUILD_OS=`uname | tr '[A-Z]' '[a-z]'`
418 BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
419
420 OECORE_NATIVE_SYSROOT=$OE_TMPDIR/sysroots/$BUILD_SYS
421 fi
422
423 # Some recipes store the BIOS under $OE_TMPDIR/sysroots/$MACHINE,
424 # now defined as OECORE_MACHINE_SYSROOT. The latter is used when searching
425 # BIOS, VGA BIOS and keymaps.
426 if [ -z "$OECORE_MACHINE_SYSROOT" ]; then
427 OECORE_MACHINE_SYSROOT=$OE_TMPDIR/sysroots/$MACHINE
428 fi
429}
430
431# Locate a rootfs image to boot which matches our expected
432# machine and fstype.
433findimage() {
434 where=$1
435 machine=$2
436 extension=$3
437
438 # Sort rootfs candidates by modification time - the most
439 # recently created one is the one we most likely want to boot.
440 filename=`ls -t1 $where/*-image*$machine.$extension 2>/dev/null | head -n1`
441 if [ "x$filename" != "x" ]; then
442 ROOTFS=$filename
443 return
444 fi
445
446 echo "Couldn't find a $machine rootfs image in $where."
447 exit 1
448}
449
450# Bios is necessary when using otaimg, look for it
451if [ "$FSTYPE" = "otaimg" ]; then
452 setup_path_vars 1
453 bios_option=`expr "$SCRIPT_QEMU_OPT" : '.*\(-bios\)'`
454 echo "bios_option: $bios_option"
455 if [ -z $bios_option ]; then
456 echo "LOOK FOR BIOS at ${DEPLOY_DIR_IMAGE}"
457 # if -bios wasn't specified explicitly, try to look at the default location
458 if [ -e "${DEPLOY_DIR_IMAGE}/u-boot.rom" ]; then
459 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -bios ${DEPLOY_DIR_IMAGE}/u-boot.rom"
460 else
461 error "OTA image requires specifying u-boot as BIOS"
462 fi
463 fi
464fi
465
466
467# Kernel command line is stored in compressed format as u-boot environment
468# which breaks determining drive interface with grep in runqemu-internal
469if [ "$FSTYPE" = "otaimg" ]; then
470 FORCE_DRIVE_IF="ide"
471fi
472
473if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then
474 # Extract the filename extension
475 EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'`
476 if [ "x$EXT" = "xext2" -o "x$EXT" = "xext3" -o \
477 "x$EXT" = "xjffs2" -o "x$EXT" = "xbtrfs" -o \
478 "x$EXT" = "xext4" ]; then
479 FSTYPE=$EXT
480 else
481 echo "Note: Unable to determine filesystem extension for $ROOTFS"
482 echo "We will use the default FSTYPE for $MACHINE"
483 # ...which is done further below...
484 fi
485fi
486
487if [ -z "$KERNEL" -a "$IS_VM" = "false" ]; then \
488 setup_path_vars 1
489 eval kernel_file=\$${machine2}_DEFAULT_KERNEL
490 KERNEL=$DEPLOY_DIR_IMAGE/$kernel_file
491
492 if [ -z "$KERNEL" ]; then
493 error "Unable to determine default kernel for MACHINE [$MACHINE]"
494 fi
495fi
496# KERNEL is now set for all cases
497
498if [ -z "$FSTYPE" ]; then
499 eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE
500
501 if [ -z "$FSTYPE" ]; then
502 error "Unable to determine default fstype for MACHINE [$MACHINE]"
503 fi
504fi
505
506# FSTYPE is now set for all cases
507
508# Handle cases where a ROOTFS type is given instead of a filename, e.g.
509# core-image-sato
510if [ "$LAZY_ROOTFS" = "true" ]; then
511 setup_path_vars 1
512 echo "Assuming $ROOTFS really means $DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE"
513 if [ "$IS_VM" = "true" ]; then
514 VM=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE
515 else
516 ROOTFS=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE
517 fi
518fi
519
520if [ -z "$ROOTFS" ]; then
521 setup_path_vars 1
522 T=$DEPLOY_DIR_IMAGE
523 eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS
524 findimage $T $MACHINE $FSTYPE
525
526 if [ -z "$ROOTFS" ]; then
527 error "Unable to determine default rootfs for MACHINE [$MACHINE]"
528 elif [ "$IS_VM" = "true" ]; then
529 VM=$ROOTFS
530 fi
531fi
532# ROOTFS is now set for all cases, now expand it to be an absolute path, it should exist at this point
533
534ROOTFS=`readlink -f $ROOTFS`
535
536echo ""
537echo "Continuing with the following parameters:"
538if [ "$IS_VM" = "false" ]; then
539 echo "KERNEL: [$KERNEL]"
540 echo "ROOTFS: [$ROOTFS]"
541else
542 echo "VM: [$VM]"
543fi
544echo "FSTYPE: [$FSTYPE]"
545
546setup_sysroot
547# OECORE_NATIVE_SYSROOT and OECORE_MACHINE_SYSROOT are now set for all cases
548
549INTERNAL_SCRIPT="$0-internal"
550if [ ! -f "$INTERNAL_SCRIPT" -o ! -r "$INTERNAL_SCRIPT" ]; then
551INTERNAL_SCRIPT=`which runqemu-internal`
552fi
553
554# Specify directory for BIOS, VGA BIOS and keymaps
555if [ ! -z "$CUSTOMBIOSDIR" ]; then
556 if [ -d "$OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR" ]; then
557 echo "Assuming biosdir is $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
558 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -L $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
559 elif [ -d "$OECORE_MACHINE_SYSROOT/$CUSTOMBIOSDIR" ]; then
560 echo "Assuming biosdir is $OECORE_MACHINE_SYSROOT/$CUSTOMBIOSDIR"
561 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -L $OECORE_MACHINE_SYSROOT/$CUSTOMBIOSDIR"
562 else
563 if [ ! -d "$CUSTOMBIOSDIR" ]; then
564 echo "Custom BIOS directory not found. Tried: $CUSTOMBIOSDIR"
565 echo "and $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
566 echo "and $OECORE_MACHINE_SYSROOT/$CUSTOMBIOSDIR"
567 exit 1;
568 fi
569 echo "Assuming biosdir is $CUSTOMBIOSDIR"
570 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -L $CUSTOMBIOSDIR"
571 fi
572fi
573
574. $INTERNAL_SCRIPT
575exit $?
diff --git a/scripts/runqemu-addptable2image b/scripts/runqemu-addptable2image
deleted file mode 100755
index f0195ad..0000000
--- a/scripts/runqemu-addptable2image
+++ /dev/null
@@ -1,51 +0,0 @@
1#!/bin/sh
2
3# Add a partion table to an ext2 image file
4#
5# Copyright (C) 2006-2007 OpenedHand Ltd.
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
21
22IMAGE=$1
23IMAGEOUT=$2
24
25echo $IMAGE
26echo $IMAGEOUT
27
28size=`ls -l $IMAGE | awk '{ print $5}'`
29size2=`expr $size / 512 / 16 / 63`
30
31echo $size
32echo $size2
33
34# MBR Size = 512 * 63 bytes
35dd if=/dev/zero of=$IMAGEOUT count=63
36
37echo "x" > /tmp/fdisk.cmds
38echo "c" >> /tmp/fdisk.cmds
39echo "1024" >> /tmp/fdisk.cmds
40echo "h" >> /tmp/fdisk.cmds
41echo "16" >> /tmp/fdisk.cmds
42echo "r" >> /tmp/fdisk.cmds
43echo "n" >> /tmp/fdisk.cmds
44echo "p" >> /tmp/fdisk.cmds
45echo "1" >> /tmp/fdisk.cmds
46echo "1" >> /tmp/fdisk.cmds
47echo "$size2" >> /tmp/fdisk.cmds
48echo "w" >> /tmp/fdisk.cmds
49
50/sbin/fdisk $IMAGEOUT < /tmp/fdisk.cmds
51cat $IMAGE >> $IMAGEOUT
diff --git a/scripts/runqemu-export-rootfs b/scripts/runqemu-export-rootfs
deleted file mode 100755
index 3dee131..0000000
--- a/scripts/runqemu-export-rootfs
+++ /dev/null
@@ -1,163 +0,0 @@
1#!/bin/bash
2#
3# Copyright (c) 2005-2009 Wind River Systems, Inc.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 2 as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12# See the GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18usage() {
19 echo "Usage: $0 {start|stop|restart} <nfs-export-dir>"
20}
21
22if [ $# != 2 ]; then
23 usage
24 exit 1
25fi
26
27if [[ "$1" != "start" && "$1" != "stop" && "$1" != "restart" ]]; then
28 echo "Unknown command '$1'"
29 usage
30 exit 1
31fi
32
33if [ ! -d "$2" ]; then
34 echo "Error: '$2' does not exist"
35 usage
36 exit 1
37fi
38# Ensure the nfs-export-dir is an absolute path
39NFS_EXPORT_DIR=$(cd "$2" && pwd)
40
41SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot 2> /dev/null`
42if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
43 echo "Error: Unable to find the oe-find-native-sysroot script"
44 echo "Did you forget to source your build environment setup script?"
45 exit 1
46fi
47. $SYSROOT_SETUP_SCRIPT
48
49if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/bin/unfsd" ]; then
50 echo "Error: Unable to find unfsd binary in $OECORE_NATIVE_SYSROOT/usr/bin/"
51
52 if [ "x$OECORE_DISTRO_VERSION" = "x" ]; then
53 echo "Have you run 'bitbake meta-ide-support'?"
54 else
55 echo "This shouldn't happen - something is missing from your toolchain installation"
56 fi
57 exit 1
58fi
59
60if [ ! -d ~/.runqemu-sdk ]; then
61 mkdir -p ~/.runqemu-sdk
62fi
63
64NFS_INSTANCE=${NFS_INSTANCE:=0}
65EXPORTS=~/.runqemu-sdk/exports$NFS_INSTANCE
66RMTAB=~/.runqemu-sdk/rmtab$NFS_INSTANCE
67NFSPID=~/.runqemu-sdk/nfs$NFS_INSTANCE.pid
68MOUNTPID=~/.runqemu-sdk/mount$NFS_INSTANCE.pid
69
70PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr"
71PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/../$(basename $NFS_EXPORT_DIR).pseudo_state"
72export PSEUDO_LOCALSTATEDIR
73
74if [ ! -d "$PSEUDO_LOCALSTATEDIR" ]; then
75 echo "Error: $PSEUDO_LOCALSTATEDIR does not exist."
76 echo "Did you create the export directory using runqemu-extract-sdk?"
77 exit 1
78fi
79
80# rpc.mountd RPC port
81NFS_MOUNTPROG=$[ 21111 + $NFS_INSTANCE ]
82# rpc.nfsd RPC port
83NFS_NFSPROG=$[ 11111 + $NFS_INSTANCE ]
84# NFS port number
85NFS_PORT=$[ 3049 + 2 * $NFS_INSTANCE ]
86# mountd port number
87MOUNT_PORT=$[ 3048 + 2 * $NFS_INSTANCE ]
88
89## For debugging you would additionally add
90## --debug all
91UNFSD_OPTS="-p -N -i $NFSPID -e $EXPORTS -x $NFS_NFSPROG -n $NFS_PORT -y $NFS_MOUNTPROG -m $MOUNT_PORT"
92
93# Setup the exports file
94if [ "$1" = "start" ]; then
95 echo "Creating exports file..."
96 echo "$NFS_EXPORT_DIR (rw,async,no_root_squash,no_all_squash,insecure)" > $EXPORTS
97fi
98
99# See how we were called.
100case "$1" in
101 start)
102 PORTMAP_RUNNING=`ps -ef | grep portmap | grep -v grep`
103 RPCBIND_RUNNING=`ps -ef | grep rpcbind | grep -v grep`
104 if [[ "x$PORTMAP_RUNNING" = "x" && "x$RPCBIND_RUNNING" = "x" ]]; then
105 echo "======================================================="
106 echo "Error: neither rpcbind nor portmap appear to be running"
107 echo "Please install and start one of these services first"
108 echo "======================================================="
109 echo "Tip: for recent Ubuntu hosts, run:"
110 echo " sudo apt-get install rpcbind"
111 echo "Then add OPTIONS=\"-i -w\" to /etc/default/rpcbind and run"
112 echo " sudo service portmap restart"
113
114 exit 1
115 fi
116
117 echo "Starting User Mode nfsd"
118 echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/bin/unfsd $UNFSD_OPTS"
119 $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/bin/unfsd $UNFSD_OPTS
120 if [ ! $? = 0 ]; then
121 echo "Error starting nfsd"
122 exit 1
123 fi
124 # Check to make sure everything started ok.
125 if [ ! -f $NFSPID ]; then
126 echo "rpc.nfsd did not start correctly"
127 exit 1
128 fi
129 ps -fp `cat $NFSPID` > /dev/null 2> /dev/null
130 if [ ! $? = 0 ]; then
131 echo "rpc.nfsd did not start correctly"
132 exit 1
133 fi
134 echo " "
135 echo "On your target please remember to add the following options for NFS"
136 echo "nfsroot=IP_ADDRESS:$NFS_EXPORT_DIR,nfsvers=3,port=$NFSD_PORT,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,mountport=$MOUNTD_PORT"
137 ;;
138 stop)
139 if [ -f "$NFSPID" ]; then
140 echo "Stopping rpc.nfsd"
141 kill `cat $NFSPID`
142 rm -f $NFSPID
143 else
144 echo "No PID file, not stopping rpc.nfsd"
145 fi
146 if [ -f "$EXPORTS" ]; then
147 echo "Removing exports file"
148 rm -f $EXPORTS
149 fi
150 ;;
151 restart)
152 $0 stop $NFS_EXPORT_DIR
153 $0 start $NFS_EXPORT_DIR
154 if [ ! $? = 0 ]; then
155 exit 1
156 fi
157 ;;
158 *)
159 echo "$0 {start|stop|restart} <nfs-export-dir>"
160 ;;
161esac
162
163exit 0
diff --git a/scripts/runqemu-extract-sdk b/scripts/runqemu-extract-sdk
deleted file mode 100755
index 32ddd48..0000000
--- a/scripts/runqemu-extract-sdk
+++ /dev/null
@@ -1,104 +0,0 @@
1#!/bin/bash
2#
3# This utility extracts an SDK image tarball using pseudo, and stores
4# the pseudo database in var/pseudo within the rootfs. If you want to
5# boot QEMU using an nfsroot, you *must* use this script to create the
6# rootfs to ensure it is done correctly with pseudo.
7#
8# Copyright (c) 2010 Intel Corp.
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License version 2 as
12# published by the Free Software Foundation.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17# See the GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program; if not, write to the Free Software
21# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
23function usage() {
24 echo "Usage: $0 <image-tarball> <extract-dir>"
25}
26
27if [ $# -ne 2 ]; then
28 usage
29 exit 1
30fi
31
32SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot 2> /dev/null`
33if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
34 echo "Error: Unable to find the oe-find-native-sysroot script"
35 echo "Did you forget to source your build system environment setup script?"
36 exit 1
37fi
38. $SYSROOT_SETUP_SCRIPT
39PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr"
40
41ROOTFS_TARBALL=$1
42SDK_ROOTFS_DIR=$2
43
44if [ ! -e "$ROOTFS_TARBALL" ]; then
45 echo "Error: sdk tarball '$ROOTFS_TARBALL' does not exist"
46 usage
47 exit 1
48fi
49
50# Convert SDK_ROOTFS_DIR to a full pathname
51if [[ ${SDK_ROOTFS_DIR:0:1} != "/" ]]; then
52 SDK_ROOTFS_DIR=$(readlink -f $(pwd)/$SDK_ROOTFS_DIR)
53fi
54
55TAR_OPTS=""
56if [[ "$ROOTFS_TARBALL" =~ tar\.bz2$ ]]; then
57 TAR_OPTS="--numeric-owner -xjf"
58fi
59if [[ "$ROOTFS_TARBALL" =~ tar\.gz$ ]]; then
60 TAR_OPTS="--numeric-owner -xzf"
61fi
62if [[ "$ROOTFS_TARBALL" =~ \.tar$ ]]; then
63 TAR_OPTS="--numeric-owner -xf"
64fi
65if [ -z "$TAR_OPTS" ]; then
66 echo "Error: Unable to determine sdk tarball format"
67 echo "Accepted types: .tar / .tar.gz / .tar.bz2"
68 exit 1
69fi
70
71if [ ! -d "$SDK_ROOTFS_DIR" ]; then
72 echo "Creating directory $SDK_ROOTFS_DIR"
73 mkdir -p "$SDK_ROOTFS_DIR"
74fi
75
76pseudo_state_dir="$SDK_ROOTFS_DIR/../$(basename "$SDK_ROOTFS_DIR").pseudo_state"
77pseudo_state_dir="$(readlink -f $pseudo_state_dir)"
78
79if [ -e "$pseudo_state_dir" ]; then
80 echo "Error: $pseudo_state_dir already exists!"
81 echo "Please delete the rootfs tree and pseudo directory manually"
82 echo "if this is really what you want."
83 exit 1
84fi
85
86mkdir -p "$pseudo_state_dir"
87touch "$pseudo_state_dir/pseudo.pid"
88PSEUDO_LOCALSTATEDIR="$pseudo_state_dir"
89export PSEUDO_LOCALSTATEDIR
90
91echo "Extracting rootfs tarball using pseudo..."
92echo "$PSEUDO $PSEUDO_OPTS tar -C \"$SDK_ROOTFS_DIR\" $TAR_OPTS \"$ROOTFS_TARBALL\""
93$PSEUDO $PSEUDO_OPTS tar -C "$SDK_ROOTFS_DIR" $TAR_OPTS "$ROOTFS_TARBALL"
94
95DIRCHECK=`ls -l "$SDK_ROOTFS_DIR" | wc -l`
96if [ "$DIRCHECK" -lt 5 ]; then
97 echo "Warning: I don't see many files in $SDK_ROOTFS_DIR"
98 echo "Please double-check the extraction worked as intended"
99 exit 0
100fi
101
102echo "SDK image successfully extracted to $SDK_ROOTFS_DIR"
103
104exit 0
diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs
deleted file mode 100755
index 624deac..0000000
--- a/scripts/runqemu-gen-tapdevs
+++ /dev/null
@@ -1,100 +0,0 @@
1#!/bin/bash
2#
3# Create a "bank" of tap network devices that can be used by the
4# runqemu script. This script needs to be run as root, and will
5# use the tunctl binary from the build system sysroot. Note: many Linux
6# distros these days still use an older version of tunctl which does not
7# support the group permissions option, hence the need to use the build
8# system provided version.
9#
10# Copyright (C) 2010 Intel Corp.
11#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License version 2 as
14# published by the Free Software Foundation.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License along
22# with this program; if not, write to the Free Software Foundation, Inc.,
23# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
25usage() {
26 echo "Usage: sudo $0 <uid> <gid> <num> <native-sysroot-basedir>"
27 echo "Where <uid> is the numeric user id the tap devices will be owned by"
28 echo "Where <gid> is the numeric group id the tap devices will be owned by"
29 echo "<num> is the number of tap devices to create (0 to remove all)"
30 echo "<native-sysroot-basedir> is the path to the build system's native sysroot"
31 exit 1
32}
33
34if [ $EUID -ne 0 ]; then
35 echo "Error: This script must be run with root privileges"
36 exit
37fi
38
39if [ $# -ne 4 ]; then
40 echo "Error: Incorrect number of arguments"
41 usage
42fi
43
44TUID=$1
45GID=$2
46COUNT=$3
47SYSROOT=$4
48
49TUNCTL=$SYSROOT/usr/bin/tunctl
50if [[ ! -x "$TUNCTL" || -d "$TUNCTL" ]]; then
51 echo "Error: $TUNCTL is not an executable"
52 usage
53fi
54
55SCRIPT_DIR=`dirname $0`
56RUNQEMU_IFUP="$SCRIPT_DIR/runqemu-ifup"
57if [ ! -x "$RUNQEMU_IFUP" ]; then
58 echo "Error: Unable to find the runqemu-ifup script in $SCRIPT_DIR"
59 exit 1
60fi
61
62IFCONFIG=`which ip 2> /dev/null`
63if [ -z "$IFCONFIG" ]; then
64 # Is it ever anywhere else?
65 IFCONFIG=/sbin/ip
66fi
67if [ ! -x "$IFCONFIG" ]; then
68 echo "$IFCONFIG cannot be executed"
69 exit 1
70fi
71
72# Ensure we start with a clean slate
73for tap in `$IFCONFIG link | grep tap | awk '{ print \$2 }' | sed s/://`; do
74 echo "Note: Destroying pre-existing tap interface $tap..."
75 $TUNCTL -d $tap
76done
77
78echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..."
79for ((index=0; index < $COUNT; index++)); do
80 echo "Creating tap$index"
81 ifup=`$RUNQEMU_IFUP $TUID $GID $SYSROOT 2>&1`
82 if [ $? -ne 0 ]; then
83 echo "Error running tunctl: $ifup"
84 exit 1
85 fi
86done
87
88if [ $COUNT -gt 0 ]; then
89 echo "Note: For systems running NetworkManager, it's recommended"
90 echo "Note: that the tap devices be set as unmanaged in the"
91 echo "Note: NetworkManager.conf file. Add the following lines to"
92 echo "Note: /etc/NetworkManager/NetworkManager.conf"
93 echo "[keyfile]"
94 echo "unmanaged-devices=interface-name:tap*"
95fi
96
97# The runqemu script will check for this file, and if it exists,
98# will use the existing bank of tap devices without creating
99# additional ones via sudo.
100touch /etc/runqemu-nosudo
diff --git a/scripts/runqemu-ifdown b/scripts/runqemu-ifdown
deleted file mode 100755
index 8f66cfa..0000000
--- a/scripts/runqemu-ifdown
+++ /dev/null
@@ -1,66 +0,0 @@
1#!/bin/bash
2#
3# QEMU network configuration script to bring down tap devices. This
4# utility needs to be run as root, and will use the tunctl binary
5# from the native sysroot.
6#
7# If you find yourself calling this script a lot, you can add the
8# the following to your /etc/sudoers file to be able to run this
9# command without entering your password each time:
10#
11# <my-username> ALL=NOPASSWD: /path/to/runqemu-ifup
12# <my-username> ALL=NOPASSWD: /path/to/runqemu-ifdown
13#
14# Copyright (c) 2006-2011 Linux Foundation
15#
16# This program is free software; you can redistribute it and/or modify
17# it under the terms of the GNU General Public License version 2 as
18# published by the Free Software Foundation.
19#
20# This program is distributed in the hope that it will be useful,
21# but WITHOUT ANY WARRANTY; without even the implied warranty of
22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23# GNU General Public License for more details.
24#
25# You should have received a copy of the GNU General Public License along
26# with this program; if not, write to the Free Software Foundation, Inc.,
27# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28
29usage() {
30 echo "sudo $(basename $0) <tap-dev> <native-sysroot-basedir>"
31}
32
33if [ $EUID -ne 0 ]; then
34 echo "Error: This script (runqemu-ifdown) must be run with root privileges"
35 exit 1
36fi
37
38if [ $# -ne 2 ]; then
39 usage
40 exit 1
41fi
42
43TAP=$1
44NATIVE_SYSROOT_DIR=$2
45
46TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl
47if [ ! -e "$TUNCTL" ]; then
48 echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin', please bitbake qemu-helper-native"
49 exit 1
50fi
51
52$TUNCTL -d $TAP
53
54# cleanup the remaining iptables rules
55IPTABLES=`which iptables 2> /dev/null`
56if [ "x$IPTABLES" = "x" ]; then
57 IPTABLES=/sbin/iptables
58fi
59if [ ! -x "$IPTABLES" ]; then
60 echo "$IPTABLES cannot be executed"
61 exit 1
62fi
63n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
64dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
65$IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32
66$IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$dest/32
diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup
deleted file mode 100755
index d9bd894..0000000
--- a/scripts/runqemu-ifup
+++ /dev/null
@@ -1,121 +0,0 @@
1#!/bin/bash
2#
3# QEMU network interface configuration script. This utility needs to
4# be run as root, and will use the tunctl binary from a native sysroot.
5# Note: many Linux distros these days still use an older version of
6# tunctl which does not support the group permissions option, hence
7# the need to use build system's version.
8#
9# If you find yourself calling this script a lot, you can add the
10# the following to your /etc/sudoers file to be able to run this
11# command without entering your password each time:
12#
13# <my-username> ALL=NOPASSWD: /path/to/runqemu-ifup
14# <my-username> ALL=NOPASSWD: /path/to/runqemu-ifdown
15#
16# If you'd like to create a bank of tap devices at once, you should use
17# the runqemu-gen-tapdevs script instead. If tap devices are set up using
18# that script, the runqemu script will never end up calling this
19# script.
20#
21# Copyright (c) 2006-2011 Linux Foundation
22#
23# This program is free software; you can redistribute it and/or modify
24# it under the terms of the GNU General Public License version 2 as
25# published by the Free Software Foundation.
26#
27# This program is distributed in the hope that it will be useful,
28# but WITHOUT ANY WARRANTY; without even the implied warranty of
29# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30# GNU General Public License for more details.
31#
32# You should have received a copy of the GNU General Public License along
33# with this program; if not, write to the Free Software Foundation, Inc.,
34# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
35
36usage() {
37 echo "sudo $(basename $0) <uid> <gid> <native-sysroot-basedir>"
38}
39
40if [ $EUID -ne 0 ]; then
41 echo "Error: This script (runqemu-ifup) must be run with root privileges"
42 exit 1
43fi
44
45if [ $# -ne 3 ]; then
46 usage
47 exit 1
48fi
49
50USERID="-u $1"
51GROUP="-g $2"
52NATIVE_SYSROOT_DIR=$3
53
54TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl
55if [ ! -x "$TUNCTL" ]; then
56 echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin', please bitbake qemu-helper-native"
57 exit 1
58fi
59
60TAP=`$TUNCTL -b $GROUP 2>&1`
61STATUS=$?
62if [ $STATUS -ne 0 ]; then
63# If tunctl -g fails, try using tunctl -u, for older host kernels
64# which do not support the TUNSETGROUP ioctl
65 TAP=`$TUNCTL -b $USERID 2>&1`
66 STATUS=$?
67 if [ $STATUS -ne 0 ]; then
68 echo "tunctl failed:"
69 exit 1
70 fi
71fi
72
73IFCONFIG=`which ip 2> /dev/null`
74if [ "x$IFCONFIG" = "x" ]; then
75 # better than nothing...
76 IFCONFIG=/sbin/ip
77fi
78if [ ! -x "$IFCONFIG" ]; then
79 echo "$IFCONFIG cannot be executed"
80 exit 1
81fi
82
83IPTABLES=`which iptables 2> /dev/null`
84if [ "x$IPTABLES" = "x" ]; then
85 IPTABLES=/sbin/iptables
86fi
87if [ ! -x "$IPTABLES" ]; then
88 echo "$IPTABLES cannot be executed"
89 exit 1
90fi
91
92n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
93$IFCONFIG addr add 192.168.7.$n/32 broadcast 192.168.7.255 dev $TAP
94STATUS=$?
95if [ $STATUS -ne 0 ]; then
96 echo "Failed to set up IP addressing on $TAP"
97 exit 1
98fi
99$IFCONFIG link set dev $TAP up
100STATUS=$?
101if [ $STATUS -ne 0 ]; then
102 echo "Failed to bring up $TAP"
103 exit 1
104fi
105
106dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
107$IFCONFIG route add to 192.168.7.$dest dev $TAP
108STATUS=$?
109if [ $STATUS -ne 0 ]; then
110 echo "Failed to add route to 192.168.7.$dest using $TAP"
111 exit 1
112fi
113
114# setup NAT for tap0 interface to have internet access in QEMU
115$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32
116$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$dest/32
117echo 1 > /proc/sys/net/ipv4/ip_forward
118echo 1 > /proc/sys/net/ipv4/conf/$TAP/proxy_arp
119$IPTABLES -P FORWARD ACCEPT
120
121echo $TAP
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
deleted file mode 100755
index 9811cf9..0000000
--- a/scripts/runqemu-internal
+++ /dev/null
@@ -1,760 +0,0 @@
1#!/bin/bash -x
2
3# Handle running OE images under qemu
4#
5# Copyright (C) 2006-2011 Linux Foundation
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 2 as
9# published by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program; if not, write to the Free Software Foundation, Inc.,
18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20# Call setting:
21# QEMU_MEMORY (optional) - set the amount of memory in the emualted system.
22# SERIAL_LOGFILE (optional) - log the serial port output to a file
23#
24# Image options:
25# MACHINE - the machine to run
26# FSTYPE - the image type to run
27# KERNEL - the kernel image file to use
28# ROOTFS - the disk image file to use
29#
30
31mem_size=-1
32
33#Get rid of <> and get the contents of extra qemu running params
34SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e 's/<//' -e 's/>//'`
35#if user set qemu memory, eg: -m 256 in qemu extra params, we need to do some
36# validation check
37mem_set=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-m[[:space:]] *[0-9]*\)'`
38if [ ! -z "$mem_set" ] ; then
39#Get memory setting size from user input
40 mem_size=`echo $mem_set | sed 's/-m[[:space:]] *//'`
41fi
42
43# This file is created when runqemu-gen-tapdevs creates a bank of tap
44# devices, indicating that the user should not bring up new ones using
45# sudo.
46NOSUDO_FLAG="/etc/runqemu-nosudo"
47
48QEMUIFUP=`which runqemu-ifup 2> /dev/null`
49QEMUIFDOWN=`which runqemu-ifdown 2> /dev/null`
50if [ -z "$QEMUIFUP" -o ! -x "$QEMUIFUP" ]; then
51 echo "runqemu-ifup cannot be found or executed"
52 exit 1
53fi
54if [ -z "$QEMUIFDOWN" -o ! -x "$QEMUIFDOWN" ]; then
55 echo "runqemu-ifdown cannot be found or executed"
56 exit 1
57fi
58
59NFSRUNNING="false"
60
61#capture original stty values
62ORIG_STTY=$(stty -g)
63
64if [ "$SLIRP_ENABLED" = "yes" ]; then
65 KERNEL_NETWORK_CMD="ip=dhcp"
66 QEMU_TAP_CMD=""
67 QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice tablet"
68 QEMU_NETWORK_CMD=""
69 DROOT="/dev/vda"
70 ROOTFS_OPTIONS="-drive file=$ROOTFS,if=virtio,format=raw"
71else
72 acquire_lock() {
73 lockfile=$1
74 if [ -z "$lockfile" ]; then
75 echo "Error: missing lockfile arg passed to acquire_lock()"
76 return 1
77 fi
78
79 touch $lockfile.lock 2>/dev/null
80 if [ $? -ne 0 ]; then
81 echo "Acquiring lockfile for $lockfile.lock failed"
82 return 1
83 fi
84 exec 8>$lockfile.lock
85 flock -n -x 8
86 if [ $? -ne 0 ]; then
87 exec 8>&-
88 return 1
89 fi
90
91 return 0
92 }
93
94 release_lock() {
95 lockfile=$1
96 if [ -z "$lockfile" ]; then
97 echo "Error: missing lockfile arg passed to release_lock()"
98 return 1
99 fi
100
101 rm -f $lockfile.lock
102 exec 8>&-
103 }
104
105 LOCKDIR="/tmp/qemu-tap-locks"
106 if [ ! -d "$LOCKDIR" ]; then
107 mkdir $LOCKDIR
108 chmod 777 $LOCKDIR
109 fi
110
111 IFCONFIG=`which ip 2> /dev/null`
112 if [ -z "$IFCONFIG" ]; then
113 IFCONFIG=/sbin/ip
114 fi
115 if [ ! -x "$IFCONFIG" ]; then
116 echo "$IFCONFIG cannot be executed"
117 exit 1
118 fi
119
120 POSSIBLE=`$IFCONFIG link | grep 'tap' | awk '{print $2}' | sed -e 's/://' -e 's/@.*//'`
121 TAP=""
122 LOCKFILE=""
123 USE_PRECONF_TAP="no"
124 for tap in $POSSIBLE; do
125 LOCKFILE="$LOCKDIR/$tap"
126 if [ -e "$LOCKFILE.skip" ]; then
127 echo "Found $LOCKFILE.skip, skipping $tap"
128 continue
129 fi
130 echo "Acquiring lockfile for $tap..."
131 acquire_lock $LOCKFILE
132 if [ $? -eq 0 ]; then
133 TAP=$tap
134 USE_PRECONF_TAP="yes"
135 break
136 fi
137 done
138
139 if [ "$TAP" = "" ]; then
140 if [ -e "$NOSUDO_FLAG" ]; then
141 echo "Error: There are no available tap devices to use for networking,"
142 echo "and I see $NOSUDO_FLAG exists, so I am not going to try creating"
143 echo "a new one with sudo."
144 exit 1
145 fi
146
147 GROUPID=`id -g`
148 USERID=`id -u`
149 echo "Setting up tap interface under sudo"
150 # Redirect stderr since we could see a LD_PRELOAD warning here if pseudo is loaded
151 # but inactive. This looks scary but is harmless
152 tap=`sudo $QEMUIFUP $USERID $GROUPID $OECORE_NATIVE_SYSROOT 2> /dev/null`
153 if [ $? -ne 0 ]; then
154 # Re-run standalone to see verbose errors
155 sudo $QEMUIFUP $USERID $GROUPID $OECORE_NATIVE_SYSROOT
156 return 1
157 fi
158 LOCKFILE="$LOCKDIR/$tap"
159 echo "Acquiring lockfile for $tap..."
160 acquire_lock $LOCKFILE
161 if [ $? -eq 0 ]; then
162 TAP=$tap
163 fi
164 else
165 echo "Using preconfigured tap device '$TAP'"
166 echo "If this is not intended, touch $LOCKFILE.skip to make runqemu skip $TAP."
167 fi
168
169 cleanup() {
170 if [ ! -e "$NOSUDO_FLAG" -a "$USE_PRECONF_TAP" = "no" ]; then
171 # Redirect stderr since we could see a LD_PRELOAD warning here if pseudo is loaded
172 # but inactive. This looks scary but is harmless
173 sudo $QEMUIFDOWN $TAP $OECORE_NATIVE_SYSROOT 2> /dev/null
174 fi
175 echo "Releasing lockfile of preconfigured tap device '$TAP'"
176 release_lock $LOCKFILE
177
178 if [ "$NFSRUNNING" = "true" ]; then
179 echo "Shutting down the userspace NFS server..."
180 echo "runqemu-export-rootfs stop $ROOTFS"
181 runqemu-export-rootfs stop $ROOTFS
182 fi
183 # If QEMU crashes or somehow tty properties are not restored
184 # after qemu exits, we need to run stty sane
185 #stty sane
186
187 #instead of using stty sane we set the original stty values
188 stty ${ORIG_STTY}
189
190 }
191
192
193 n0=$(echo $TAP | sed 's/tap//')
194
195 case $n0 in
196 ''|*[!0-9]*)
197 echo "Error Couldn't turn $TAP into an interface number?"
198 exit 1
199 ;;
200 esac
201
202 n1=$(($n0 * 2 + 1))
203 n2=$(($n1 + 1))
204
205 KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0"
206 QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no"
207 if [ "$VHOST_ACTIVE" = "yes" ]; then
208 QEMU_NETWORK_CMD="-net nic,model=virtio $QEMU_TAP_CMD,vhost=on"
209 else
210 QEMU_NETWORK_CMD="-net nic,model=virtio $QEMU_TAP_CMD"
211 fi
212 DROOT="/dev/vda"
213 ROOTFS_OPTIONS="-drive file=$ROOTFS,if=virtio,format=raw"
214
215 KERNCMDLINE="mem=$QEMU_MEMORY"
216 QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice tablet"
217
218 NFS_INSTANCE=`echo $TAP | sed 's/tap//'`
219 export NFS_INSTANCE
220
221 SERIALOPTS=""
222 if [ "x$SERIAL_LOGFILE" != "x" ]; then
223 SERIALOPTS="-serial file:$SERIAL_LOGFILE"
224 fi
225fi
226
227if [ ! -f "$KERNEL" -a "$IS_VM" = "false" ]; then
228 echo "Error: Kernel image file $KERNEL doesn't exist"
229 cleanup
230 return 1
231fi
232
233if [ "$FSTYPE" != "nfs" -a "$IS_VM" = "false" -a ! -f "$ROOTFS" ]; then
234 echo "Error: Image file $ROOTFS doesn't exist"
235 cleanup
236 return 1
237fi
238
239if [ "$NFS_SERVER" = "" ]; then
240 NFS_SERVER="192.168.7.1"
241 if [ "$SLIRP_ENABLED" = "yes" ]; then
242 NFS_SERVER="10.0.2.2"
243 fi
244fi
245
246if [ "$FSTYPE" = "nfs" ]; then
247 NFS_DIR=`echo $ROOTFS | sed 's/^[^:]*:\(.*\)/\1/'`
248 if [ "$NFS_INSTANCE" = "" ] ; then
249 NFS_INSTANCE=0
250 fi
251 MOUNTD_RPCPORT=$[ 21111 + $NFS_INSTANCE ]
252 NFSD_RPCPORT=$[ 11111 + $NFS_INSTANCE ]
253 NFSD_PORT=$[ 3049 + 2 * $NFS_INSTANCE ]
254 MOUNTD_PORT=$[ 3048 + 2 * $NFS_INSTANCE ]
255 UNFS_OPTS="nfsvers=3,port=$NFSD_PORT,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,mountport=$MOUNTD_PORT"
256
257 PSEUDO_LOCALSTATEDIR=~/.runqemu-sdk/pseudo
258 export PSEUDO_LOCALSTATEDIR
259
260 # Start the userspace NFS server
261 echo "runqemu-export-rootfs restart $ROOTFS"
262 runqemu-export-rootfs restart $ROOTFS
263 if [ $? != 0 ]; then
264 return 1
265 fi
266 NFSRUNNING="true"
267fi
268
269
270set_mem_size() {
271 if [ ! -z "$mem_set" ] ; then
272 #Get memory setting size from user input
273 mem_size=`echo $mem_set | sed 's/-m[[:space:]] *//'`
274 else
275 mem_size=$1
276 fi
277 # QEMU_MEMORY has 'M' appended to mem_size
278 QEMU_MEMORY="$mem_size"M
279
280}
281
282config_qemuarm() {
283 set_mem_size 128
284 QEMU=qemu-system-arm
285 MACHINE_SUBTYPE=versatilepb
286 export QEMU_AUDIO_DRV="none"
287 QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
288 if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then
289 KERNCMDLINE="root=$DROOT rw console=ttyAMA0,115200 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY highres=off"
290 QEMUOPTIONS="$QEMU_NETWORK_CMD -M ${MACHINE_SUBTYPE} $ROOTFS_OPTIONS -no-reboot $QEMU_UI_OPTIONS"
291 fi
292 if [ "$FSTYPE" = "nfs" ]; then
293 if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
294 echo "Error: NFS mount point $ROOTFS doesn't exist"
295 cleanup
296 return 1
297 fi
298 KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw console=ttyAMA0,115200 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
299 QEMUOPTIONS="$QEMU_NETWORK_CMD -M ${MACHINE_SUBTYPE} --no-reboot $QEMU_UI_OPTIONS"
300 fi
301 if [ "$MACHINE" = "qemuarmv6" ]; then
302 QEMUOPTIONS="$QEMUOPTIONS -cpu arm1136"
303 fi
304 if [ "$MACHINE" = "qemuarmv7" ]; then
305 QEMUOPTIONS="$QEMUOPTIONS -cpu cortex-a8"
306 fi
307}
308
309config_qemuarm64() {
310 set_mem_size 512
311 QEMU=qemu-system-aarch64
312
313 QEMU_NETWORK_CMD="-netdev tap,id=net0,ifname=$TAP,script=no,downscript=no -device virtio-net-device,netdev=net0 "
314 DROOT="/dev/vda"
315 ROOTFS_OPTIONS="-drive id=disk0,file=$ROOTFS,if=none,format=raw -device virtio-blk-device,drive=disk0"
316
317 export QEMU_AUDIO_DRV="none"
318 if [ "x$SERIALSTDIO" = "x" ] ; then
319 QEMU_UI_OPTIONS="-nographic"
320 else
321 QEMU_UI_OPTIONS=""
322 fi
323 if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then
324 KERNCMDLINE="root=$DROOT rw console=ttyAMA0,38400 mem=$QEMU_MEMORY highres=off $KERNEL_NETWORK_CMD"
325 # qemu-system-aarch64 only support '-machine virt -cpu cortex-a57' for now
326 QEMUOPTIONS="$QEMU_NETWORK_CMD -machine virt -cpu cortex-a57 $ROOTFS_OPTIONS $QEMU_UI_OPTIONS"
327 fi
328 if [ "$FSTYPE" = "nfs" ]; then
329 if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
330 echo "Error: NFS mount point $ROOTFS doesn't exist"
331 cleanup
332 return 1
333 fi
334 KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw console=ttyAMA0,38400 mem=$QEMU_MEMORY highres=off $KERNEL_NETWORK_CMD"
335 QEMUOPTIONS="$QEMU_NETWORK_CMD -machine virt -cpu cortex-a57 $QEMU_UI_OPTIONS"
336 fi
337}
338
339config_qemux86() {
340 set_mem_size 256
341 QEMU=qemu-system-i386
342 if [ "$KVM_ACTIVE" = "yes" ]; then
343 CPU_SUBTYPE=kvm32
344 else
345 CPU_SUBTYPE=qemu32
346 fi
347 if [ ! -z "$vga_option" ]; then
348 QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
349 else
350 QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware"
351 fi
352 if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then
353 KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
354 QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $ROOTFS_OPTIONS $QEMU_UI_OPTIONS"
355 fi
356 if [ "${FSTYPE:0:4}" = "cpio" ]; then
357 KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=/dev/ram0 rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
358 QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -initrd $ROOTFS $QEMU_UI_OPTIONS"
359 fi
360
361 if [ "$FSTYPE" = "nfs" ]; then
362 if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
363 echo "Error: NFS mount point $ROOTFS doesn't exist."
364 cleanup
365 return 1
366 fi
367 KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
368 QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS"
369 fi
370 if [ "$IS_VM" = "true" ]; then
371 QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS"
372 fi
373 # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in
374 # qemux86 and qemux86-64. We can use timer interrupt mode for now.
375 KERNCMDLINE="$KERNCMDLINE oprofile.timer=1"
376}
377
378config_qemux86_64() {
379 set_mem_size 256
380 QEMU=qemu-system-x86_64
381 if [ "$KVM_ACTIVE" = "yes" ]; then
382 CPU_SUBTYPE=kvm64
383 else
384 CPU_SUBTYPE=core2duo
385 fi
386 if [ ! -z "$vga_option" ]; then
387 QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
388 else
389 QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware"
390 fi
391 if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then
392 KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
393 QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $ROOTFS_OPTIONS $QEMU_UI_OPTIONS"
394 fi
395 if [ "$FSTYPE" = "nfs" ]; then
396 if [ "x$ROOTFS" = "x" ]; then
397 ROOTFS=/srv/nfs/qemux86-64
398 fi
399 if [ ! -d "$ROOTFS" ]; then
400 echo "Error: NFS mount point $ROOTFS doesn't exist."
401 cleanup
402 return 1
403 fi
404 KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
405 QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $QEMU_UI_OPTIONS"
406 fi
407 if [ "$IS_VM" = "true" ]; then
408 QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $QEMU_UI_OPTIONS"
409 fi
410 # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in
411 # qemux86 and qemux86-64. We can use timer interrupt mode for now.
412 KERNCMDLINE="$KERNCMDLINE oprofile.timer=1"
413}
414
415config_qemumips() {
416 set_mem_size 256
417 case "$MACHINE" in
418 qemumips) QEMU=qemu-system-mips ;;
419 qemumipsel) QEMU=qemu-system-mipsel ;;
420 qemumips64) QEMU=qemu-system-mips64 ;;
421 esac
422 MACHINE_SUBTYPE=malta
423 QEMU_UI_OPTIONS="-vga cirrus $QEMU_UI_OPTIONS"
424 if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then
425 #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
426 KERNCMDLINE="root=$DROOT rw console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
427 QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE $ROOTFS_OPTIONS -no-reboot $QEMU_UI_OPTIONS"
428 fi
429 if [ "$FSTYPE" = "nfs" ]; then
430 if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
431 echo "Error: NFS mount point $ROOTFS doesn't exist"
432 cleanup
433 return 1
434 fi
435 KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
436 QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS"
437 fi
438}
439
440config_qemuppc() {
441 set_mem_size 256
442 QEMU=qemu-system-ppc
443 MACHINE_SUBTYPE=mac99
444 CPU_SUBTYPE=G4
445 QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
446 if [ "$SLIRP_ENABLED" = "yes" ]; then
447 QEMU_NETWORK_CMD=""
448 else
449 QEMU_NETWORK_CMD="-net nic,model=pcnet $QEMU_TAP_CMD"
450 fi
451 if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then
452 KERNCMDLINE="root=$DROOT rw console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
453 QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE $ROOTFS_OPTIONS -no-reboot $QEMU_UI_OPTIONS"
454 fi
455 if [ "$FSTYPE" = "nfs" ]; then
456 if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
457 echo "Error: NFS mount point $ROOTFS doesn't exist"
458 cleanup
459 return 1
460 fi
461 KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
462 QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS"
463 fi
464}
465
466config_qemush4() {
467 set_mem_size 1024
468 QEMU=qemu-system-sh4
469 MACHINE_SUBTYPE=r2d
470 QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
471 if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then
472 #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
473 KERNCMDLINE="root=/dev/hda rw console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
474 QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio"
475 SERIALSTDIO="1"
476 fi
477 if [ "$FSTYPE" = "nfs" ]; then
478 if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
479 echo "Error: NFS mount point $ROOTFS doesn't exist"
480 cleanup
481 return 1
482 fi
483 KERNCMDLINE="root=/dev/nfs console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
484 QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio"
485 SERIALSTDIO="1"
486 fi
487}
488
489config_qemuzynq() {
490 set_mem_size 1024
491 QEMU=qemu-system-arm
492 QEMU_NETWORK_CMD="-net nic -net nic $QEMU_TAP_CMD"
493 QEMU_SYSTEM_OPTIONS="$QEMU_NETWORK_CMD -M xilinx-zynq-a9 -serial null -serial mon:stdio -nographic -dtb $KERNEL-$MACHINE.dtb"
494 # zynq serial ports are named 'ttyPS0' and 'ttyPS1', fixup the default values
495 SCRIPT_KERNEL_OPT=$(echo "$SCRIPT_KERNEL_OPT" | sed 's/console=ttyS/console=ttyPS/g')
496 if [ "${FSTYPE:0:3}" = "ext" -o "${FSTYPE:0:4}" = "cpio" ]; then
497 KERNCMDLINE="earlyprintk root=/dev/ram rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
498 QEMUOPTIONS="$QEMU_SYSTEM_OPTIONS -initrd $ROOTFS"
499 fi
500}
501
502config_qemuzynqmp() {
503 set_mem_size 2048
504 QEMU=qemu-system-aarch64
505
506 export QEMU_AUDIO_DRV="none"
507 if [ "x$SERIALSTDIO" = "x" ] ; then
508 QEMU_UI_OPTIONS="-nographic"
509 else
510 QEMU_UI_OPTIONS=""
511 fi
512
513 # Networking and system options required for QEMU ZynqMP machine
514 QEMU_NETWORK_CMD="-net nic -net nic -net nic -net nic -net user,net=10.10.70.0,dhcpstart=10.10.70.1,host=10.10.70.101"
515 QEMU_SYSTEM_OPTIONS="$QEMU_NETWORK_CMD -M xlnx-ep108 -serial mon:stdio -dtb $DEPLOY_DIR_IMAGE/${QEMU_DTB}.dtb"
516
517 QEMUOPTIONS="$QEMU_SYSTEM_OPTIONS $QEMU_UI_OPTIONS -initrd $ROOTFS"
518}
519
520config_qemumicroblaze() {
521 set_mem_size 256
522 QEMU=qemu-system-microblazeel
523 QEMU_SYSTEM_OPTIONS="$QEMU_NETWORK_CMD -M petalogix-ml605 -serial mon:stdio"
524 if [ "${FSTYPE:0:3}" = "ext" -o "${FSTYPE:0:4}" = "cpio" ]; then
525 KERNCMDLINE="earlyprintk root=/dev/ram rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
526 QEMUOPTIONS="$QEMU_SYSTEM_OPTIONS -initrd $ROOTFS"
527 fi
528}
529
530case "$MACHINE" in
531 "qemuarm" | "qemuarmv6" | "qemuarmv7")
532 config_qemuarm
533 ;;
534 "qemuarm64")
535 config_qemuarm64
536 ;;
537 "qemux86")
538 config_qemux86
539 ;;
540 "qemux86-64")
541 config_qemux86_64
542 ;;
543 "qemumips" | "qemumipsel" | "qemumips64")
544 config_qemumips
545 ;;
546 "qemuppc")
547 config_qemuppc
548 ;;
549 "qemush4")
550 config_qemush4
551 ;;
552 "qemuzynq")
553 config_qemuzynq
554 ;;
555 "qemuzynqmp")
556 config_qemuzynqmp
557 ;;
558 "qemumicroblaze")
559 config_qemumicroblaze
560 ;;
561 *)
562 echo "Error: Unsupported machine type $MACHINE"
563 return 1
564 ;;
565esac
566
567# We need to specify -m <mem_size> to overcome a bug in qemu 0.14.0
568# https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/584480
569if [ -z "$mem_set" ] ; then
570 SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT -m $mem_size"
571fi
572
573if [ "${FSTYPE:0:3}" = "ext" ]; then
574 KERNCMDLINE="$KERNCMDLINE rootfstype=$FSTYPE"
575fi
576
577if [ "$FSTYPE" = "cpio.gz" ]; then
578 QEMUOPTIONS="-initrd $ROOTFS -nographic"
579 KERNCMDLINE="root=/dev/ram0 console=ttyS0 debugshell"
580fi
581
582if [ "$FSTYPE" = "iso" ]; then
583 QEMUOPTIONS="$QEMU_NETWORK_CMD -cdrom $ROOTFS $QEMU_UI_OPTIONS"
584fi
585
586if [ "x$QEMUOPTIONS" = "x" ]; then
587 echo "Error: Unable to support this combination of options"
588 cleanup
589 return 1
590fi
591
592if [ "$TCPSERIAL_PORTNUM" != "" ]; then
593 if [ "$MACHINE" = "qemuarm64" ]; then
594 SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT -device virtio-serial-device -chardev socket,id=virtcon,port=$TCPSERIAL_PORTNUM,host=127.0.0.1 -device virtconsole,chardev=virtcon"
595 else
596 SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT -serial tcp:127.0.0.1:$TCPSERIAL_PORTNUM"
597 fi
598fi
599
600PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$PATH
601
602QEMUBIN=`which $QEMU 2> /dev/null`
603if [ ! -x "$QEMUBIN" ]; then
604 echo "Error: No QEMU binary '$QEMU' could be found."
605 cleanup
606 return 1
607fi
608
609NEED_GL=`ldd $QEMUBIN/$QEMU 2>&1 | grep libGLU`
610# We can't run without a libGL.so
611if [ "$NEED_GL" != "" ]; then
612 libgl='no'
613
614 [ -e /usr/lib/libGL.so -a -e /usr/lib/libGLU.so ] && libgl='yes'
615 [ -e /usr/lib64/libGL.so -a -e /usr/lib64/libGLU.so ] && libgl='yes'
616 [ -e /usr/lib/*-linux-gnu/libGL.so -a -e /usr/lib/*-linux-gnu/libGLU.so ] && libgl='yes'
617
618 if [ "$libgl" != 'yes' ]; then
619 echo "You need libGL.so and libGLU.so to exist in your library path to run the QEMU emulator.
620 Ubuntu package names are: libgl1-mesa-dev and libglu1-mesa-dev.
621 Fedora package names are: mesa-libGL-devel mesa-libGLU-devel."
622 return 1;
623 fi
624fi
625
626do_quit() {
627 cleanup
628 return 1
629}
630
631trap do_quit INT TERM QUIT
632
633# qemu got segfault if linked with nVidia's libgl
634GL_LD_PRELOAD=$LD_PRELOAD
635
636if ldd $QEMUBIN | grep -i nvidia &> /dev/null
637then
638cat << EOM
639WARNING: nVidia proprietary OpenGL libraries detected.
640nVidia's OpenGL libraries are known to have compatibility issues with qemu,
641resulting in a segfault. Please uninstall these drivers or ensure the mesa libGL
642libraries precede nvidia's via LD_PRELOAD(Already do it on Ubuntu 10).
643EOM
644
645# Automatically use Ubuntu system's mesa libGL, other distro can add its own path
646if grep -i ubuntu /etc/lsb-release &> /dev/null
647then
648 # precede nvidia's driver on Ubuntu 10
649 UBUNTU_MAIN_VERSION=`cat /etc/lsb-release |grep DISTRIB_RELEASE |cut -d= -f 2| cut -d. -f 1`
650 if [ "$UBUNTU_MAIN_VERSION" = "10" ];
651 then
652 GL_PATH=""
653 if test -e /usr/lib/libGL.so
654 then
655 GL_PATH="/usr/lib/libGL.so"
656 elif test -e /usr/lib/x86_64-linux-gnu/libGL.so
657 then
658 GL_PATH="/usr/lib/x86_64-linux-gnu/libGL.so"
659 fi
660
661 echo "Skip nVidia's libGL on Ubuntu 10!"
662 GL_LD_PRELOAD="$GL_PATH $LD_PRELOAD"
663 fi
664fi
665fi
666
667if [ "x$SERIALSTDIO" = "x1" ]; then
668 echo "Interrupt character is '^]'"
669 stty intr ^]
670fi
671
672
673# Preserve the multiplexing behavior for the monitor that would be there based
674# on whether nographic is used.
675if echo "$QEMUOPTIONS $SERIALOPTS $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT" | grep -- "-nographic"; then
676 FIRST_SERIAL_OPT="-serial mon:stdio"
677else
678 FIRST_SERIAL_OPT="-serial mon:vc"
679fi
680
681# qemuarm64 uses virtio for any additional serial ports so the normal mechanism
682# of using -serial will not work
683if [ "$MACHINE" = "qemuarm64" ]; then
684 SECOND_SERIAL_OPT="-device virtio-serial-device -chardev null,id=virtcon -device virtconsole,chardev=virtcon"
685else
686 SECOND_SERIAL_OPT="-serial null"
687fi
688
689# We always want a ttyS1. Since qemu by default adds a serial port when
690# nodefaults is not specified, it seems that all that would be needed is to
691# make sure a "-serial" is there. However, it appears that when "-serial" is
692# specified, it ignores the default serial port that is normally added.
693# So here we make sure to add two -serial if there are none. And only one
694# if there is one -serial already.
695NUM_SERIAL_OPTS=`echo $QEMUOPTIONS $SERIALOPTS $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT | sed -e 's/ /\n/g' | grep --count -- -serial`
696
697if [ "$NUM_SERIAL_OPTS" = "0" ]; then
698 SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT $FIRST_SERIAL_OPT $SECOND_SERIAL_OPT"
699elif [ "$NUM_SERIAL_OPTS" = "1" ]; then
700 SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT $SECOND_SERIAL_OPT"
701fi
702
703echo "Running $QEMU..."
704# -no-reboot is a mandatory option - see bug #100
705if [ "$IS_VM" = "true" ]; then
706 # Check root=/dev/sdX or root=/dev/vdX
707 [ ! -e "$VM" ] && error "VM image is not found!"
708
709 case "$FORCE_DRIVE_IF" in
710 "ide")
711 echo "Using ide drive"
712 VM_DRIVE="$VM"
713 ;;
714 "scsi")
715 echo "Using scsi drive"
716 VM_DRIVE="-drive if=none,id=hd,file=$VM -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd"
717 ;;
718 "virtio")
719 echo "Using virtio block drive"
720 VM_DRIVE="-drive if=virtio,file=$VM"
721 ;;
722 "")
723 if grep -q 'root=/dev/sd' $VM; then
724 echo "Using scsi drive"
725 VM_DRIVE="-drive if=none,id=hd,file=$VM -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd"
726 elif grep -q 'root=/dev/hd' $VM; then
727 echo "Using ide drive"
728 VM_DRIVE="$VM"
729 else
730 echo "Using virtio block drive"
731 VM_DRIVE="-drive if=virtio,file=$VM"
732 fi
733 ;;
734 *)
735 error "Invalid drive interface: $FORCE_DRIVE_IF"
736 ;;
737 esac
738
739 QEMU_FIRE="$QEMUBIN $VM_DRIVE $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT"
740 echo $QEMU_FIRE
741 LD_PRELOAD="$GL_LD_PRELOAD" $QEMU_FIRE
742elif [ "$FSTYPE" = "iso" -o "$FSTYPE" = "wic" ]; then
743 QEMU_FIRE="$QEMUBIN $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT"
744 echo $QEMU_FIRE
745 LD_PRELOAD="$GL_LD_PRELOAD" $QEMU_FIRE
746else
747 QEMU_FIRE="$QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SLIRP_CMD $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT"
748 echo $QEMU_FIRE -append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"'
749 LD_PRELOAD="$GL_LD_PRELOAD" $QEMU_FIRE -append "$KERNCMDLINE $SCRIPT_KERNEL_OPT"
750fi
751ret=$?
752if [ "$SLIRP_ENABLED" != "yes" ]; then
753 cleanup
754fi
755
756#set the original stty values before exit
757stty ${ORIG_STTY}
758trap - INT TERM QUIT
759
760return $ret
diff --git a/scripts/runqemu.README b/scripts/runqemu.README
deleted file mode 100644
index 5908d83..0000000
--- a/scripts/runqemu.README
+++ /dev/null
@@ -1,42 +0,0 @@
1Using OE images with QEMU
2=========================
3
4OE-Core can generate qemu bootable kernels and images with can be used
5on a desktop system. The scripts currently support booting ARM, MIPS, PowerPC
6and x86 (32 and 64 bit) images. The scripts can be used within the OE build
7system or externaly.
8
9The runqemu script is run as:
10
11 runqemu <machine> <zimage> <filesystem>
12
13where:
14
15 <machine> is the machine/architecture to use (qemuarm/qemumips/qemuppc/qemux86/qemux86-64)
16 <zimage> is the path to a kernel (e.g. zimage-qemuarm.bin)
17 <filesystem> is the path to an ext2 image (e.g. filesystem-qemuarm.ext2) or an nfs directory
18
19If <machine> isn't specified, the script will try to detect the machine name
20from the name of the <zimage> file.
21
22If <filesystem> isn't specified, nfs booting will be assumed.
23
24When used within the build system, it will default to qemuarm, ext2 and the last kernel and
25core-image-sato-sdk image built by the build system. If an sdk image isn't present it will look
26for sato and minimal images.
27
28Full usage instructions can be seen by running the command with no options specified.
29
30
31Notes
32=====
33
34 - The scripts run qemu using sudo. Change perms on /dev/net/tun to
35 run as non root. The runqemu-gen-tapdevs script can also be used by
36 root to prepopulate the appropriate network devices.
37 - You can access the host computer at 192.168.7.1 within the image.
38 - Your qemu system will be accessible as 192.16.7.2.
39 - The script extracts the root filesystem specified under pseudo and sets up a userspace
40 NFS server to share the image over by default meaning the filesystem can be accessed by
41 both the host and guest systems.
42
diff --git a/templates/README.md b/templates/README.md
deleted file mode 100644
index f43a67e..0000000
--- a/templates/README.md
+++ /dev/null
@@ -1,10 +0,0 @@
1AGL templates
2=============
3
4This directory contains templates for integration with AGL's aglsetup.sh.
5To use meta-updater with AGL, 'agl-sota' to the list of features as in:
6
7 source meta-agl/scripts/aglsetup.sh -m raspberrypi3 agl-demo agl-netboot agl-appfw-smack agl-sota
8
9For more information see [AGL documentation](https://wiki.automotivelinux.org/subsystem/agl-sota/ostree)
10
diff --git a/templates/feature/agl-sota/50_bblayers.conf.inc b/templates/feature/agl-sota/50_bblayers.conf.inc
deleted file mode 100644
index 0a5440b..0000000
--- a/templates/feature/agl-sota/50_bblayers.conf.inc
+++ /dev/null
@@ -1,7 +0,0 @@
1BBLAYERS =+ " \
2 ${METADIR}/meta-agl-extra/meta-sota \
3 ${METADIR}/meta-openembedded/meta-filesystems \
4 ${METADIR}/meta-openembedded/meta-ruby \
5 ${METADIR}/meta-rust \
6 "
7
diff --git a/templates/feature/agl-sota/50_local.conf.inc b/templates/feature/agl-sota/50_local.conf.inc
deleted file mode 100644
index 8d21c17..0000000
--- a/templates/feature/agl-sota/50_local.conf.inc
+++ /dev/null
@@ -1,15 +0,0 @@
1DISTRO_FEATURES_append = " agl-ota"
2OVERRIDES .= ":sota"
3
4IMAGE_INSTALL_append = " ostree"
5
6# live image for OSTree-enabled systems
7IMAGE_CLASSES += "image_types_ostree image_types_ota"
8IMAGE_FSTYPES += "ostreepush otaimg"
9
10# Please redefine OSTREE_REPO in order to have a persistent OSTree repo
11OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo"
12OSTREE_BRANCHNAME ?= "ota-${MACHINE}"
13OSTREE_OSNAME ?= "ota"
14OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image"
15