aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-sota/classes/image_types_ota.bbclass71
-rw-r--r--meta-sota/conf/layer.conf11
-rw-r--r--meta-sota/conf/machine/qemux86-ota.conf37
-rw-r--r--meta-sota/recipes-bsp/u-boot/u-boot-buildrom/0001-Set-up-environment-for-OSTree-integration.patch36
-rw-r--r--meta-sota/recipes-bsp/u-boot/u-boot-buildrom_2016.07.bb19
5 files changed, 174 insertions, 0 deletions
diff --git a/meta-sota/classes/image_types_ota.bbclass b/meta-sota/classes/image_types_ota.bbclass
new file mode 100644
index 00000000000..069d04a917a
--- /dev/null
+++ b/meta-sota/classes/image_types_ota.bbclass
@@ -0,0 +1,71 @@
+inherit image_types
+
+# Boot filesystem size in MiB
+# OSTree updates may require some space on boot file system for
+# boot scripts, kernel and initramfs images
+#
+BOOTFS_EXTRA_SIZE ?= "512"
+export BOOTFS_EXTRA_SIZE
+
+IMAGE_TYPES += " otaimg"
+IMAGE_DEPENDS_ota = "e2fsprogs-native \
+ virtual/bootloader \
+ virtual/kernel \
+ parted-native \
+ ${INITRD_IMAGE}"
+
+build_bootfs () {
+ KERNEL_FILE=${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}
+ KERNEL_SIZE=`du -Lbs ${KERNEL_FILE} | cut -f 1`
+
+ RAMDISK_FILE=${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}-${MACHINE}.cpio.gz
+ RAMDISK_SIZE=`du -Lbs ${RAMDISK_FILE} | cut -f 1`
+
+ EXTRA_BYTES=$(expr $BOOTFS_EXTRA_SIZE \* 1024 \* 1024)
+
+ TOTAL_SIZE=$(expr ${KERNEL_SIZE} \+ ${RAMDISK_SIZE} \+ ${EXTRA_BYTES})
+ TOTAL_BLOCKS=$(expr 1 \+ $TOTAL_SIZE / 1024)
+
+ dd if=/dev/zero of=$1 bs=1024 count=${TOTAL_BLOCKS}
+ BOOTTMP=$(mktemp -d mkotaboot-XXX)
+ cp ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ${BOOTTMP}
+ cp ${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}-${MACHINE}.cpio.gz ${BOOTTMP}
+ mkfs.ext4 $1 -d ${BOOTTMP}
+ rm -rf $BOOTTMP
+}
+
+IMAGE_CMD_otaimg () {
+ BOOTIMG=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaboot.ext4
+ rm -f $BOOTIMG
+ build_bootfs $BOOTIMG
+
+ # ext4 image should be already here because of IMAGE_TYPEDEP_otaimg
+ ROOTIMG=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext4
+
+ BOOTFSBLOCKS=`du -bks ${BOOTIMG} | cut -f 1`
+
+ ROOTFSBLOCKS=`du -bks ${ROOTIMG} | cut -f 1`
+ TOTALSIZE=`expr $BOOTFSBLOCKS \+ $ROOTFSBLOCKS`
+ END1=`expr $BOOTFSBLOCKS \* 1024`
+ END2=`expr $END1 + 512`
+ END3=`expr \( $ROOTFSBLOCKS \* 1024 \) + $END1`
+
+ FULLIMG=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg
+ rm -rf ${FULLIMG}
+
+ dd if=/dev/zero of=${FULLIMG} bs=1024 seek=${TOTALSIZE} count=1
+ parted ${FULLIMG} mklabel msdos
+ parted ${FULLIMG} mkpart primary ext4 0 ${END1}B
+ parted ${FULLIMG} unit B mkpart primary ext4 ${END2}B ${END3}B
+
+ OFFSET=`expr $END2 / 512`
+
+ dd if=${BOOTIMG} of=${FULLIMG} conv=notrunc seek=1 bs=512
+ dd if=${ROOTIMG} of=${FULLIMG} conv=notrunc seek=$OFFSET bs=512
+
+ cd ${DEPLOY_DIR_IMAGE}
+ rm -f ${IMAGE_LINK_NAME}.otaimg
+ ln -s ${IMAGE_NAME}.otaimg ${IMAGE_LINK_NAME}.otaimg
+}
+
+IMAGE_TYPEDEP_otaimg = "ext4"
diff --git a/meta-sota/conf/layer.conf b/meta-sota/conf/layer.conf
new file mode 100644
index 00000000000..a0ce5fa78cd
--- /dev/null
+++ b/meta-sota/conf/layer.conf
@@ -0,0 +1,11 @@
+# We have a conf and classes directory, add to BBPATH
+BBPATH .= ":${LAYERDIR}"
+
+# We have recipes-* directories, add to BBFILES
+BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
+ ${LAYERDIR}/recipes-*/*/*.bbappend"
+
+BBFILE_COLLECTIONS += "sota"
+BBFILE_PATTERN_sota = "^${LAYERDIR}/"
+BBFILE_PRIORITY_sota = "7"
+
diff --git a/meta-sota/conf/machine/qemux86-ota.conf b/meta-sota/conf/machine/qemux86-ota.conf
new file mode 100644
index 00000000000..3c58870149a
--- /dev/null
+++ b/meta-sota/conf/machine/qemux86-ota.conf
@@ -0,0 +1,37 @@
+#@TYPE: Machine
+#@NAME: common_pc
+#@DESCRIPTION: Machine configuration for running a common x86
+
+PREFERRED_PROVIDER_virtual/xserver ?= "xserver-xorg"
+PREFERRED_PROVIDER_virtual/libgl ?= "mesa"
+PREFERRED_PROVIDER_virtual/libgles1 ?= "mesa"
+PREFERRED_PROVIDER_virtual/libgles2 ?= "mesa"
+
+require conf/machine/include/qemu.inc
+require conf/machine/include/tune-i586.inc
+
+KERNEL_IMAGETYPE = "bzImage"
+
+PREFERRED_PROVIDER_virtual/bootloader = "u-boot-buildrom"
+UBOOT_MACHINE = "qemu-x86_defconfig"
+
+IMAGE_CLASSES += "image_types_ota"
+IMAGE_FSTYPES += "otaimg"
+
+SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS1"
+
+XSERVER = "xserver-xorg \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'mesa-driver-swrast xserver-xorg-extension-glx', '', d)} \
+ xf86-input-vmmouse \
+ xf86-input-keyboard \
+ xf86-input-evdev \
+ xf86-video-cirrus \
+ xf86-video-fbdev \
+ xf86-video-vmware"
+
+MACHINE_FEATURES += "x86"
+
+MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "v86d"
+
+MACHINEOVERRIDES .= ":qemux86"
+KMACHINE = "qemux86"
diff --git a/meta-sota/recipes-bsp/u-boot/u-boot-buildrom/0001-Set-up-environment-for-OSTree-integration.patch b/meta-sota/recipes-bsp/u-boot/u-boot-buildrom/0001-Set-up-environment-for-OSTree-integration.patch
new file mode 100644
index 00000000000..c33d40c8866
--- /dev/null
+++ b/meta-sota/recipes-bsp/u-boot/u-boot-buildrom/0001-Set-up-environment-for-OSTree-integration.patch
@@ -0,0 +1,36 @@
+From 2b4d519bef51d9bfb646588aa5198f71022a867b Mon Sep 17 00:00:00 2001
+From: Anton Gerasimov <anton@advancedtelematic.com>
+Date: Mon, 15 Aug 2016 15:54:20 +0200
+Subject: [PATCH] Set up environment for OSTree integration
+
+---
+ include/configs/qemu-x86.h | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h
+index 476d37d..f49e2a5 100644
+--- a/include/configs/qemu-x86.h
++++ b/include/configs/qemu-x86.h
+@@ -56,4 +56,19 @@
+ #undef CONFIG_ENV_IS_IN_SPI_FLASH
+ #define CONFIG_ENV_IS_NOWHERE
+
++#undef CONFIG_BOOTARGS
++#define CONFIG_BOOTARGS "root=/dev/hda2 console=ttyS0"
++
++#undef CONFIG_BOOTCOMMAND
++#define CONFIG_BOOTCOMMAND "run loadenv;" \
++ "ext2load ide 0:1 $loadaddr $kernel_image;" \
++ "ext2load ide 0:1 $ramdiskaddr $ramdisk_image;" \
++ "zboot $loadaddr - $ramdiskaddr $filesize"
++
++#undef CONFIG_EXTRA_ENV_SETTINGS
++#define CONFIG_EXTRA_ENV_SETTINGS "kernel_image=/bzImage\0" \
++ "ramdisk_image=/initrd\0" \
++ "ramdiskaddr=0x4000000\0" \
++ "loadenv=if ext2ls ide 0:1 /loader.0/uEnv.txt; then ext2load ide 0:1 $loadaddr uEnv.txt; env import -t $loadaddr $filesize; fi;"
++
+ #endif /* __CONFIG_H */
+--
+2.8.3
+
diff --git a/meta-sota/recipes-bsp/u-boot/u-boot-buildrom_2016.07.bb b/meta-sota/recipes-bsp/u-boot/u-boot-buildrom_2016.07.bb
new file mode 100644
index 00000000000..7e3c67f4078
--- /dev/null
+++ b/meta-sota/recipes-bsp/u-boot/u-boot-buildrom_2016.07.bb
@@ -0,0 +1,19 @@
+include recipes-bsp/u-boot/u-boot.inc
+DEPENDS += "dtc-native"
+
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6"
+
+# This revision corresponds to the tag "v2016.07"
+# We use the revision in order to avoid having to fetch it from the
+# repo during parse
+SRCREV = "25922d42f8e9e7ae503ae55a972ba1404e5b6a8c"
+
+SRC_URI += "file://0001-Set-up-environment-for-OSTree-integration.patch"
+
+PV = "v2016.07+git${SRCPV}"
+
+EXTRA_OEMAKE_append = " KCFLAGS=-fgnu89-inline BUILD_ROM=y"
+
+UBOOT_SUFFIX = "rom"
+