All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frampton <mikeframpo@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 3/3] package/abootimg: add host build for abootimg Build abootimg on the host, and use it to build a kernel image for the DB410c.
Date: Tue, 27 Oct 2020 20:50:56 +1300	[thread overview]
Message-ID: <20201027075056.10753-3-mikeframpo@gmail.com> (raw)
In-Reply-To: <20201027075056.10753-1-mikeframpo@gmail.com>

Signed-off-by: Mike Frampton <mikeframpo@gmail.com>
---
 board/qcom/db410c/post-image.sh | 21 +++++++++++++++++++++
 configs/qcom_db410c_defconfig   |  4 ++++
 package/Config.in.host          |  1 +
 package/abootimg/Config.in.host |  8 ++++++++
 package/abootimg/abootimg.mk    | 12 ++++++++++++
 5 files changed, 46 insertions(+)
 create mode 100755 board/qcom/db410c/post-image.sh
 create mode 100644 package/abootimg/Config.in.host

diff --git a/board/qcom/db410c/post-image.sh b/board/qcom/db410c/post-image.sh
new file mode 100755
index 0000000000..5182b655d2
--- /dev/null
+++ b/board/qcom/db410c/post-image.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+set -e
+
+OUTIMG=$BINARIES_DIR/boot-db410c.img
+KERNEL_BUILD=$BUILD_DIR/linux-release_qcomlt-5.4
+
+cp $KERNEL_BUILD/arch/arm64/boot/dts/qcom/apq8016-sbc.dtb $BINARIES_DIR
+cp $KERNEL_BUILD/arch/arm64/boot/Image.gz $BINARIES_DIR
+
+# now assemble the bootimg
+#cd $BINARIES_DIR
+cat $BINARIES_DIR/Image.gz $BINARIES_DIR/apq8016-sbc.dtb > $BINARIES_DIR/Image.gz+dtb
+echo "not a ramdisk" > $BINARIES_DIR/ramdisk.img
+
+abootimg --create $OUTIMG -k $BINARIES_DIR/Image.gz+dtb -r $BINARIES_DIR/ramdisk.img \
+	-c pagesize=2048 -c kerneladdr=0x80008000 -c ramdiskaddr=0x81000000 \
+	-c cmdline="root=/dev/mmcblk1p13 rw rootwait console=tty0 console=ttyMSM0,115200n8"
+
+echo "boot img written to $OUTIMG"
+
diff --git a/configs/qcom_db410c_defconfig b/configs/qcom_db410c_defconfig
index 470d55efde..4053f914cf 100644
--- a/configs/qcom_db410c_defconfig
+++ b/configs/qcom_db410c_defconfig
@@ -10,6 +10,10 @@ BR2_PACKAGE_LINUX_FIRMWARE_QCOM_VENUS=y
 BR2_PACKAGE_LINUX_FIRMWARE_QCOM_ADRENO=y
 BR2_PACKAGE_QCOM_DB410C_FIRMWARE=y
 
+# Bootloader/boot image
+BR2_PACKAGE_HOST_ABOOTIMG=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qcom/db410c/post-image.sh"
+
 # Kernel
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
diff --git a/package/Config.in.host b/package/Config.in.host
index fb29622ccb..39a6f89f8c 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -1,5 +1,6 @@
 menu "Host utilities"
 
+	source "package/abootimg/Config.in.host"
 	source "package/aespipe/Config.in.host"
 	source "package/android-tools/Config.in.host"
 	source "package/btrfs-progs/Config.in.host"
diff --git a/package/abootimg/Config.in.host b/package/abootimg/Config.in.host
new file mode 100644
index 0000000000..1e178bc8bf
--- /dev/null
+++ b/package/abootimg/Config.in.host
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_HOST_ABOOTIMG
+	bool "host abootimg"
+	select BR2_PACKAGE_HOST_UTIL_LINUX
+	help
+	  Tool to manipulate Android Boot Images, either on files
+	  or directly on /dev block devices.
+	  
+	  https://github.com/ggrandou/abootimg
diff --git a/package/abootimg/abootimg.mk b/package/abootimg/abootimg.mk
index e906546948..6a4cd01586 100644
--- a/package/abootimg/abootimg.mk
+++ b/package/abootimg/abootimg.mk
@@ -11,6 +11,7 @@ ABOOTIMG_LICENSE_FILES = LICENSE
 
 # depends on libblkid from util-linux
 ABOOTIMG_DEPENDENCIES = util-linux
+ABOOTIMG_HOST_DEPENDENCIES = host-util-linux
 
 define ABOOTIMG_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
@@ -20,4 +21,15 @@ define ABOOTIMG_INSTALL_TARGET_CMDS
 	$(INSTALL) -m 0755 $(@D)/abootimg $(TARGET_DIR)/usr/bin/abootimg
 endef
 
+# host build
+
+define HOST_ABOOTIMG_BUILD_CMDS
+	$(MAKE) $(HOST_CONFIGURE_OPTS) -C $(@D)
+endef
+
+define HOST_ABOOTIMG_INSTALL_CMDS
+	$(INSTALL) -m 0755 $(@D)/abootimg $(HOST_DIR)/usr/bin/abootimg
+endef
+
 $(eval $(generic-package))
+$(eval $(host-generic-package))
-- 
2.25.1

  parent reply	other threads:[~2020-10-27  7:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27  7:50 [Buildroot] [PATCH 1/3] configs/qcom_db410c: Add support for Dragonboard410c SBC Adds basic support for the DB410c SBC. Builds the qualcomm kernel version 5.4 arm64. Adds the device's graphics firmware Mike Frampton
2020-10-27  7:50 ` [Buildroot] [PATCH 2/3] package/qcom-db410c-firmware: add support for DB410c Wifi Added new package. Installs required Wifi firmware blobs on the target Mike Frampton
2020-10-27  9:46   ` Thomas Petazzoni
2020-10-27  7:50 ` Mike Frampton [this message]
2020-10-27  9:49   ` [Buildroot] [PATCH 3/3] package/abootimg: add host build for abootimg Build abootimg on the host, and use it to build a kernel image for the DB410c Thomas Petazzoni
2020-10-27  9:51 ` [Buildroot] [PATCH 1/3] configs/qcom_db410c: Add support for Dragonboard410c SBC Adds basic support for the DB410c SBC. Builds the qualcomm kernel version 5.4 arm64. Adds the device's graphics firmware Thomas Petazzoni
2020-10-27 19:47   ` Mike Frampton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201027075056.10753-3-mikeframpo@gmail.com \
    --to=mikeframpo@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.