[RFC,2/2] image_types.bbclass: add support for fastboot image type

Message ID 1440604110-4306-3-git-send-email-nicolas.dechesne@linaro.org
State New
Headers show

Commit Message

Nicolas Dechesne Aug. 26, 2015, 3:48 p.m.
Fastboot images are images that can be flashed using the fastboot protocol
implemented in many popular bootloader for SBCs or even real world products
(such as Android phones and tablets).

This image type was implemented in meta-smartphone, and is being moved in
oe-core.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
---
 meta/classes/image_types.bbclass | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Nicolas Dechesne Aug. 27, 2015, 7:56 a.m. | #1
On Wed, Aug 26, 2015 at 10:31 PM, Andre McCurdy <armccurdy@gmail.com> wrote:
>
> > +IMAGE_CMD_ext4.fastboot () {
> > +       if [ ${ROOTFS_SIZE} -lt ${FASTBOOT_PARTITION_SIZE} ]; then
> > +               make_ext4fs -l `expr ${FASTBOOT_PARTITION_SIZE} \* 1024` \
> > +                       ${EXTRA_IMAGECMD} \
> > +                       ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext4.fastboot \
> > +                       ${IMAGE_ROOTFS}
> > +       else
> > +               bbfatal "Rootfs is too small for partition (Rootfs Actual Size: ${ROOTFS_SIZE}, Partition size: ${FASTBOOT_PARTITION_SIZE})"
>
> Should the error be "Rootfs is too LARGE for partition" ?

you're right.. wrong copy/paste, will fix.

Patch hide | download patch | download mbox

diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 8547574..4c53dc9 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -156,6 +156,19 @@  IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_
 
 EXTRA_IMAGECMD = ""
 
+FASTBOOT_PARTITION_SIZE ?= "16384"
+
+IMAGE_CMD_ext4.fastboot () {
+	if [ ${ROOTFS_SIZE} -lt ${FASTBOOT_PARTITION_SIZE} ]; then
+		make_ext4fs -l `expr ${FASTBOOT_PARTITION_SIZE} \* 1024` \
+			${EXTRA_IMAGECMD} \
+			${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext4.fastboot \
+			${IMAGE_ROOTFS}
+	else
+		bbfatal "Rootfs is too small for partition (Rootfs Actual Size: ${ROOTFS_SIZE}, Partition size: ${FASTBOOT_PARTITION_SIZE})"
+	fi
+}
+
 inherit siteinfo
 JFFS2_ENDIANNESS ?= "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '-l', '-b', d)}"
 JFFS2_ERASEBLOCK ?= "0x40000"
@@ -167,6 +180,7 @@  EXTRA_IMAGECMD_ext3 ?= "-i 4096"
 EXTRA_IMAGECMD_ext4 ?= "-i 4096"
 EXTRA_IMAGECMD_btrfs ?= ""
 EXTRA_IMAGECMD_elf ?= ""
+EXTRA_IMAGECMD_ext4.fastboot ?= "-s -b 4096"
 
 IMAGE_DEPENDS = ""
 IMAGE_DEPENDS_jffs2 = "mtd-utils-native"
@@ -182,6 +196,7 @@  IMAGE_DEPENDS_elf = "virtual/kernel mkelfimage-native"
 IMAGE_DEPENDS_ubi = "mtd-utils-native"
 IMAGE_DEPENDS_ubifs = "mtd-utils-native"
 IMAGE_DEPENDS_multiubi = "mtd-utils-native"
+IMAGE_DEPENDS_ext4.fastboot = "android-tools-native"
 
 # This variable is available to request which values are suitable for IMAGE_FSTYPES
 IMAGE_TYPES = " \
@@ -201,6 +216,7 @@  IMAGE_TYPES = " \
     vdi \
     qcow2 \
     elf \
+    ext4.fastboot \
 "
 
 COMPRESSIONTYPES = "gz bz2 lzma xz lz4 sum"