All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 0/3] add support for Dragonboard410c
@ 2020-11-19  9:08 Mike Frampton
  2020-11-19  9:08 ` [Buildroot] [PATCH v2 1/3] package/qcom-db410c-firmware: new package Mike Frampton
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Mike Frampton @ 2020-11-19  9:08 UTC (permalink / raw
  To: buildroot

Hi Buildroot devs,

This is my second attempt at submitting a config for the Qualcomm
Dragonboard 410c. Thomas Petazzoni gave me some feedback on the last
series which I have tried to address in this patch.

I have built an image using the defconfig below and tested that it boots
on the DB410c. I also tested that the Wifi works.

Thomas suggested that I change the post-image.sh script so that it
doesn't reference the kernel build path. I was not able to achieve this
because my dtb and Image.gz were not copied to output/images. I
found that only the uncompressed kernel image was copied by the kernel
package, and I think my dts wasn't copied because I had
BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT=y. Is this expected behaviour?

Mike Frampton (3):
  package/qcom-db410c-firmware: new package
  package/abootimg: add host build
  configs/qcom_db410c: new defconfig

 DEVELOPERS                                    |  5 +
 board/qcom/db410c/post-image.sh               | 20 ++++
 board/qcom/db410c/readme.txt                  | 93 +++++++++++++++++++
 configs/qcom_db410c_defconfig                 | 28 ++++++
 package/Config.in                             |  1 +
 package/Config.in.host                        |  1 +
 package/abootimg/Config.in.host               |  8 ++
 package/abootimg/abootimg.mk                  | 10 ++
 package/qcom-db410c-firmware/Config.in        |  6 ++
 .../qcom-db410c-firmware.hash                 |  3 +
 .../qcom-db410c-firmware.mk                   | 41 ++++++++
 11 files changed, 216 insertions(+)
 create mode 100755 board/qcom/db410c/post-image.sh
 create mode 100644 board/qcom/db410c/readme.txt
 create mode 100644 configs/qcom_db410c_defconfig
 create mode 100644 package/abootimg/Config.in.host
 create mode 100644 package/qcom-db410c-firmware/Config.in
 create mode 100644 package/qcom-db410c-firmware/qcom-db410c-firmware.hash
 create mode 100644 package/qcom-db410c-firmware/qcom-db410c-firmware.mk

-- 
2.25.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v2 1/3] package/qcom-db410c-firmware: new package
  2020-11-19  9:08 [Buildroot] [PATCH v2 0/3] add support for Dragonboard410c Mike Frampton
@ 2020-11-19  9:08 ` Mike Frampton
  2020-11-19 13:27   ` Thomas Petazzoni
  2020-11-19 22:11   ` Thomas Petazzoni
  2020-11-19  9:08 ` [Buildroot] [PATCH v2 2/3] package/abootimg: add host build Mike Frampton
  2020-11-19  9:08 ` [Buildroot] [PATCH v2 3/3] configs/qcom_db410c: new defconfig Mike Frampton
  2 siblings, 2 replies; 11+ messages in thread
From: Mike Frampton @ 2020-11-19  9:08 UTC (permalink / raw
  To: buildroot

Installs the required Wifi/BT firmware blobs for the Qualcomm
Dragonboard 410c SBC.

Signed-off-by: Mike Frampton <mikeframpo@gmail.com>
---
 DEVELOPERS                                    |  3 ++
 package/Config.in                             |  1 +
 package/qcom-db410c-firmware/Config.in        |  6 +++
 .../qcom-db410c-firmware.hash                 |  3 ++
 .../qcom-db410c-firmware.mk                   | 41 +++++++++++++++++++
 5 files changed, 54 insertions(+)
 create mode 100644 package/qcom-db410c-firmware/Config.in
 create mode 100644 package/qcom-db410c-firmware/qcom-db410c-firmware.hash
 create mode 100644 package/qcom-db410c-firmware/qcom-db410c-firmware.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 9ab1e125f4..57a84a3604 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1863,6 +1863,9 @@ N:	Michel Stempin <michel.stempin@wanadoo.fr>
 F:	board/licheepi/
 F:	configs/licheepi_zero_defconfig
 
+N:	Mike Frampton <mikeframpo@gmail.com>
+F:	package/qcom-db410c-firmware/
+
 N:	Mike Harmony <mike.harmony@snapav.com>
 F:	board/sinovoip/m2-plus/
 F:	configs/bananapi_m2_plus_defconfig
diff --git a/package/Config.in b/package/Config.in
index 016a99ed1a..7b49db0683 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -402,6 +402,7 @@ menu "Firmware"
 	source "package/linux-firmware/Config.in"
 	source "package/murata-cyw-fw/Config.in"
 	source "package/odroidc2-firmware/Config.in"
+	source "package/qcom-db410c-firmware/Config.in"
 	source "package/rpi-bt-firmware/Config.in"
 	source "package/rpi-firmware/Config.in"
 	source "package/rpi-wifi-firmware/Config.in"
diff --git a/package/qcom-db410c-firmware/Config.in b/package/qcom-db410c-firmware/Config.in
new file mode 100644
index 0000000000..7b615a67bf
--- /dev/null
+++ b/package/qcom-db410c-firmware/Config.in
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_QCOM_DB410C_FIRMWARE
+	bool "qcom-db410c-firmware"
+	select BR2_PACKAGE_HOST_MTOOLS
+	help
+	  Wifi/BT firmware for Qualcomm Dragonboard 410c SBC.
+
diff --git a/package/qcom-db410c-firmware/qcom-db410c-firmware.hash b/package/qcom-db410c-firmware/qcom-db410c-firmware.hash
new file mode 100644
index 0000000000..e8ac31eb39
--- /dev/null
+++ b/package/qcom-db410c-firmware/qcom-db410c-firmware.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  46953b974c5c58c7ca66db414437c0268b033ac9d28127e98d9c4e1a49359da5  linux-board-support-package-r1034.2.1.zip
+sha256  11e60ad6f83c2a86e40dca374c24230b53650dd3e0adf2e72c15f8cafedc2e5a  LICENSE
diff --git a/package/qcom-db410c-firmware/qcom-db410c-firmware.mk b/package/qcom-db410c-firmware/qcom-db410c-firmware.mk
new file mode 100644
index 0000000000..15c97e9dc2
--- /dev/null
+++ b/package/qcom-db410c-firmware/qcom-db410c-firmware.mk
@@ -0,0 +1,41 @@
+################################################################################
+#
+# qcom-db410c-firmware
+#
+################################################################################
+
+QCOM_DB410C_FIRMWARE_VERSION = 1034.2.1
+QCOM_DB410C_FIRMWARE_BASE = linux-board-support-package-r$(QCOM_DB410C_FIRMWARE_VERSION)
+QCOM_DB410C_FIRMWARE_SOURCE = $(QCOM_DB410C_FIRMWARE_BASE).zip
+QCOM_DB410C_FIRMWARE_SITE = https://releases.linaro.org/96boards/dragonboard410c/qualcomm/firmware
+
+QCOM_DB410C_FIRMWARE_LICENCE = Qualcomm firmware license
+QCOM_DB410C_FIRMWARE_LICENSE_FILES = LICENSE
+
+define QCOM_DB410C_FIRMWARE_EXTRACT_CMDS
+        $(UNZIP) -d $(@D) \
+		$(QCOM_DB410C_FIRMWARE_DL_DIR)/$(QCOM_DB410C_FIRMWARE_SOURCE)
+	mv $(@D)/$(QCOM_DB410C_FIRMWARE_BASE)/* $(@D)
+	rmdir $(@D)/$(QCOM_DB410C_FIRMWARE_BASE)
+endef
+
+# Install the Wifi/Bt firmware blobs to target. These commands are based on 
+# firmware-qcom-dragonboard410c_*.bb in the OpenEmbedded meta-qcom layer, see
+# https://github.com/ndechesne/meta-qcom
+define QCOM_DB410C_FIRMWARE_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0644 \
+		$(@D)/efs-seed/fs_image_linux.tar.gz.mbn.img \
+		$(TARGET_DIR)/boot/modem_fsg
+
+	$(INSTALL) -d $(TARGET_DIR)/lib/firmware
+	cp -r $(@D)/proprietary-linux/wlan \
+		$(TARGET_DIR)/lib/firmware/
+	
+	$(INSTALL) -d $(TARGET_DIR)/lib/firmware/qcom/msm8916
+	MTOOLS_SKIP_CHECK=1 $(HOST_DIR)/bin/mcopy -n -i \
+		$(@D)/bootloaders-linux/NON-HLOS.bin \
+		::image/modem.* ::image/mba.mbn ::image/wcnss.* \
+		$(TARGET_DIR)/lib/firmware/qcom/msm8916
+endef
+
+$(eval $(generic-package))
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v2 2/3] package/abootimg: add host build
  2020-11-19  9:08 [Buildroot] [PATCH v2 0/3] add support for Dragonboard410c Mike Frampton
  2020-11-19  9:08 ` [Buildroot] [PATCH v2 1/3] package/qcom-db410c-firmware: new package Mike Frampton
@ 2020-11-19  9:08 ` Mike Frampton
  2020-11-19 22:12   ` Thomas Petazzoni
  2020-11-19  9:08 ` [Buildroot] [PATCH v2 3/3] configs/qcom_db410c: new defconfig Mike Frampton
  2 siblings, 1 reply; 11+ messages in thread
From: Mike Frampton @ 2020-11-19  9:08 UTC (permalink / raw
  To: buildroot

Enabling package host build for abootimg so that boot images can be
created for boards which boot from this format.

Signed-off-by: Mike Frampton <mikeframpo@gmail.com>
---
 package/Config.in.host          |  1 +
 package/abootimg/Config.in.host |  8 ++++++++
 package/abootimg/abootimg.mk    | 10 ++++++++++
 3 files changed, 19 insertions(+)
 create mode 100644 package/abootimg/Config.in.host

diff --git a/package/Config.in.host b/package/Config.in.host
index c69c756f3a..4f69785810 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/asn1c/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..64cee13c32 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,13 @@ define ABOOTIMG_INSTALL_TARGET_CMDS
 	$(INSTALL) -m 0755 $(@D)/abootimg $(TARGET_DIR)/usr/bin/abootimg
 endef
 
+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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v2 3/3] configs/qcom_db410c: new defconfig
  2020-11-19  9:08 [Buildroot] [PATCH v2 0/3] add support for Dragonboard410c Mike Frampton
  2020-11-19  9:08 ` [Buildroot] [PATCH v2 1/3] package/qcom-db410c-firmware: new package Mike Frampton
  2020-11-19  9:08 ` [Buildroot] [PATCH v2 2/3] package/abootimg: add host build Mike Frampton
@ 2020-11-19  9:08 ` Mike Frampton
  2020-11-19 13:30   ` Thomas Petazzoni
  2 siblings, 1 reply; 11+ messages in thread
From: Mike Frampton @ 2020-11-19  9:08 UTC (permalink / raw
  To: buildroot

Adds a defconfig for the Qualcomm Dragonboard 410c SBC. This config
builds the qcom kernel 5.4 arm64 and assembles it into an abootimg which
can be booted on the device. Further instructions are provided in the
included readme.txt

Signed-off-by: Mike Frampton <mikeframpo@gmail.com>
---
 DEVELOPERS                      |  2 +
 board/qcom/db410c/post-image.sh | 20 +++++++
 board/qcom/db410c/readme.txt    | 93 +++++++++++++++++++++++++++++++++
 configs/qcom_db410c_defconfig   | 28 ++++++++++
 4 files changed, 143 insertions(+)
 create mode 100755 board/qcom/db410c/post-image.sh
 create mode 100644 board/qcom/db410c/readme.txt
 create mode 100644 configs/qcom_db410c_defconfig

diff --git a/DEVELOPERS b/DEVELOPERS
index 57a84a3604..caec89a1df 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1864,6 +1864,8 @@ F:	board/licheepi/
 F:	configs/licheepi_zero_defconfig
 
 N:	Mike Frampton <mikeframpo@gmail.com>
+F:	board/qcom/db410c/
+F:	configs/qcom_db410c_defconfig
 F:	package/qcom-db410c-firmware/
 
 N:	Mike Harmony <mike.harmony@snapav.com>
diff --git a/board/qcom/db410c/post-image.sh b/board/qcom/db410c/post-image.sh
new file mode 100755
index 0000000000..b33a219104
--- /dev/null
+++ b/board/qcom/db410c/post-image.sh
@@ -0,0 +1,20 @@
+#!/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
+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/board/qcom/db410c/readme.txt b/board/qcom/db410c/readme.txt
new file mode 100644
index 0000000000..259dc7fd7c
--- /dev/null
+++ b/board/qcom/db410c/readme.txt
@@ -0,0 +1,93 @@
+Intro
+=====
+
+These instructions show you how to build a basic kernel and rootfs for the
+Dragonboard-410c. Terminal access is provided via the serial console.
+The provided defconfig builds an android bootimg, which is configured to be
+booted from an SD card.
+
+DB410c page at Qualcomm developer network:
+https://developer.qualcomm.com/hardware/dragonboard-410c
+
+DB410c documentation at 96boards:
+https://www.96boards.org/documentation/consumer/dragonboard/dragonboard410c/
+
+
+How to build
+============
+
+Create a .config by running:
+
+  $ make qcom_db410c_defconfig
+
+This will configure buildroot to build the kernel image, device tree binary,
+rootfs, and an android bootimg. The bootimg, containing kernelimg + devicetree,
+is bootable on the DB410c via the SD card.
+
+Once you have a .config, simply run:
+
+  $ make
+
+Result of the build
+-------------------
+
+After building, you should obtain this tree:
+
+    output/images/
+    +-- Image.gz
+    +-- apq8016-sbc.dtb
+    +-- rootfs.ext2
+    +-- boot-db410c.img
+
+
+How to set up the SD card
+=========================
+
+The bootloader on the DB410c expects the SD card to be formatted in a 
+particular way. The simplest way to set up the SD card correctly is to flash
+a prebuilt Debian image on to the card to set up the required partitions.
+
+The Debian image can be downloaded from:
+http://releases.linaro.org/96boards/dragonboard410c/linaro/debian/latest/dragonboard-410c-sdcard-developer-*.zip
+
+The instructions at this page explain how to copy it to the SD card (requires
+card 8GB or larger):
+https://www.96boards.org/documentation/consumer/dragonboard/dragonboard410c/installation/linux-sd.md.html
+
+Also note the instructions for setting the device's switches for SD card boot.
+
+After this process, the SD card should have partition lay as follows:
+
+  $ lsblk /dev/sdX
+    NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
+    sdX       8:16   1  7.4G  0 disk 
+    ??sdX1    8:17   1  512K  0 part 
+    ??sdX2    8:18   1  512K  0 part 
+    ??sdX3    8:19   1    1M  0 part 
+    ??sdX4    8:20   1  512K  0 part 
+    ??sdX5    8:21   1   16K  0 part 
+    ??sdX6    8:22   1    2M  0 part 
+    ??sdX7    8:23   1    2M  0 part 
+    ??sdX8    8:24   1    1K  0 part 
+    ??sdX9    8:25   1    2M  0 part 
+    ??sdX10   8:26   1    1M  0 part 
+    ??sdX11   8:27   1   64M  0 part 
+    ??sdX12   8:28   1    1M  0 part 
+    ??sdX13   8:29   1  3.8G  0 part 
+
+The bootimg should be placed in partition 11 and the rootfs in partition 13.
+
+How to write the SD card
+========================
+
+Copy the build bootimg "boot-db410c.img" onto the SD card with the command:
+
+  $ sudo dd if=output/images/boot-db410c.img of=/dev/sdX11
+
+Then copy the rootfs with:
+
+  $ sudo dd if=output/images/rootfs.ext2 of=/dev/sdX13
+
+Insert the SD card into the device and power it up. The system should start a
+console on UART 0.
+
diff --git a/configs/qcom_db410c_defconfig b/configs/qcom_db410c_defconfig
new file mode 100644
index 0000000000..732751c787
--- /dev/null
+++ b/configs/qcom_db410c_defconfig
@@ -0,0 +1,28 @@
+# Architecture
+BR2_aarch64=y
+BR2_cortex_a53=y
+
+# Toolchain options
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4=y
+
+# Firmware
+BR2_PACKAGE_LINUX_FIRMWARE=y
+BR2_PACKAGE_LINUX_FIRMWARE_QCOM_VENUS=y
+BR2_PACKAGE_LINUX_FIRMWARE_QCOM_ADRENO=y
+BR2_PACKAGE_QCOM_DB410C_FIRMWARE=y
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://git.linaro.org/landing-teams/working/qualcomm/kernel.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="release/qcomlt-5.4"
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="apq8016-sbc"
+
+# Filesystem/Image
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_PACKAGE_HOST_ABOOTIMG=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qcom/db410c/post-image.sh"
+
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v2 1/3] package/qcom-db410c-firmware: new package
  2020-11-19  9:08 ` [Buildroot] [PATCH v2 1/3] package/qcom-db410c-firmware: new package Mike Frampton
@ 2020-11-19 13:27   ` Thomas Petazzoni
  2020-11-19 22:11   ` Thomas Petazzoni
  1 sibling, 0 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2020-11-19 13:27 UTC (permalink / raw
  To: buildroot

Hello Mike,

Thanks for this new iteration!

On Thu, 19 Nov 2020 22:08:52 +1300
Mike Frampton <mikeframpo@gmail.com> wrote:

> diff --git a/package/qcom-db410c-firmware/qcom-db410c-firmware.hash b/package/qcom-db410c-firmware/qcom-db410c-firmware.hash
> new file mode 100644
> index 0000000000..e8ac31eb39
> --- /dev/null
> +++ b/package/qcom-db410c-firmware/qcom-db410c-firmware.hash
> @@ -0,0 +1,3 @@
> +# Locally calculated
> +sha256  46953b974c5c58c7ca66db414437c0268b033ac9d28127e98d9c4e1a49359da5  linux-board-support-package-r1034.2.1.zip
> +sha256  11e60ad6f83c2a86e40dca374c24230b53650dd3e0adf2e72c15f8cafedc2e5a  LICENSE
> diff --git a/package/qcom-db410c-firmware/qcom-db410c-firmware.mk b/package/qcom-db410c-firmware/qcom-db410c-firmware.mk
> new file mode 100644
> index 0000000000..15c97e9dc2
> --- /dev/null
> +++ b/package/qcom-db410c-firmware/qcom-db410c-firmware.mk
> @@ -0,0 +1,41 @@
> +################################################################################
> +#
> +# qcom-db410c-firmware
> +#
> +################################################################################
> +
> +QCOM_DB410C_FIRMWARE_VERSION = 1034.2.1
> +QCOM_DB410C_FIRMWARE_BASE = linux-board-support-package-r$(QCOM_DB410C_FIRMWARE_VERSION)
> +QCOM_DB410C_FIRMWARE_SOURCE = $(QCOM_DB410C_FIRMWARE_BASE).zip
> +QCOM_DB410C_FIRMWARE_SITE = https://releases.linaro.org/96boards/dragonboard410c/qualcomm/firmware

I think you're missing

QCOM_DB410C_FIRMWARE_DEPENDENCIES = host-mtools

here, as your INSTALL_TARGET_CMDS is using $(HOST_DIR)/bin/mcopy.

Otherwise, it looks good to me!

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v2 3/3] configs/qcom_db410c: new defconfig
  2020-11-19  9:08 ` [Buildroot] [PATCH v2 3/3] configs/qcom_db410c: new defconfig Mike Frampton
@ 2020-11-19 13:30   ` Thomas Petazzoni
  2020-11-20  8:03     ` Mike Frampton
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Petazzoni @ 2020-11-19 13:30 UTC (permalink / raw
  To: buildroot

Hello Mike,

Thanks as well for this new iteration!

On Thu, 19 Nov 2020 22:08:54 +1300
Mike Frampton <mikeframpo@gmail.com> wrote:

> +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

Why is this needed ? Buildroot should have already copied the DT and
kernel image to BINARIES_DIR.

> +# now assemble the bootimg
> +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"

The echo here is probably not needed ?

> +How to set up the SD card
> +=========================
> +
> +The bootloader on the DB410c expects the SD card to be formatted in a 
> +particular way. The simplest way to set up the SD card correctly is to flash
> +a prebuilt Debian image on to the card to set up the required partitions.

This is a bit annoying, having to depend on flashing the SD card with
another system first. What is so special that we can't do in Buildroot ?


> diff --git a/configs/qcom_db410c_defconfig b/configs/qcom_db410c_defconfig
> new file mode 100644
> index 0000000000..732751c787
> --- /dev/null
> +++ b/configs/qcom_db410c_defconfig
> @@ -0,0 +1,28 @@
> +# Architecture
> +BR2_aarch64=y
> +BR2_cortex_a53=y
> +
> +# Toolchain options
> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4=y
> +
> +# Firmware
> +BR2_PACKAGE_LINUX_FIRMWARE=y
> +BR2_PACKAGE_LINUX_FIRMWARE_QCOM_VENUS=y
> +BR2_PACKAGE_LINUX_FIRMWARE_QCOM_ADRENO=y
> +BR2_PACKAGE_QCOM_DB410C_FIRMWARE=y
> +
> +# Kernel
> +BR2_LINUX_KERNEL=y
> +BR2_LINUX_KERNEL_CUSTOM_GIT=y
> +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://git.linaro.org/landing-teams/working/qualcomm/kernel.git"
> +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="release/qcomlt-5.4"

This is a branch, which is a moving target, and we prefer to point to a
specific tag or commit to make sure this defconfig always builds the
same kernel version. Could you adjust this ?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v2 1/3] package/qcom-db410c-firmware: new package
  2020-11-19  9:08 ` [Buildroot] [PATCH v2 1/3] package/qcom-db410c-firmware: new package Mike Frampton
  2020-11-19 13:27   ` Thomas Petazzoni
@ 2020-11-19 22:11   ` Thomas Petazzoni
  1 sibling, 0 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2020-11-19 22:11 UTC (permalink / raw
  To: buildroot

On Thu, 19 Nov 2020 22:08:52 +1300
Mike Frampton <mikeframpo@gmail.com> wrote:

> Installs the required Wifi/BT firmware blobs for the Qualcomm
> Dragonboard 410c SBC.
> 
> Signed-off-by: Mike Frampton <mikeframpo@gmail.com>
> ---
>  DEVELOPERS                                    |  3 ++
>  package/Config.in                             |  1 +
>  package/qcom-db410c-firmware/Config.in        |  6 +++
>  .../qcom-db410c-firmware.hash                 |  3 ++
>  .../qcom-db410c-firmware.mk                   | 41 +++++++++++++++++++
>  5 files changed, 54 insertions(+)
>  create mode 100644 package/qcom-db410c-firmware/Config.in
>  create mode 100644 package/qcom-db410c-firmware/qcom-db410c-firmware.hash
>  create mode 100644 package/qcom-db410c-firmware/qcom-db410c-firmware.mk

In fact, I fixed up the minor issues that remained, and applied your
patch to next. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v2 2/3] package/abootimg: add host build
  2020-11-19  9:08 ` [Buildroot] [PATCH v2 2/3] package/abootimg: add host build Mike Frampton
@ 2020-11-19 22:12   ` Thomas Petazzoni
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2020-11-19 22:12 UTC (permalink / raw
  To: buildroot

On Thu, 19 Nov 2020 22:08:53 +1300
Mike Frampton <mikeframpo@gmail.com> wrote:

> Enabling package host build for abootimg so that boot images can be
> created for boards which boot from this format.
> 
> Signed-off-by: Mike Frampton <mikeframpo@gmail.com>
> ---
>  package/Config.in.host          |  1 +
>  package/abootimg/Config.in.host |  8 ++++++++
>  package/abootimg/abootimg.mk    | 10 ++++++++++
>  3 files changed, 19 insertions(+)
>  create mode 100644 package/abootimg/Config.in.host

Applied to next, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v2 3/3] configs/qcom_db410c: new defconfig
  2020-11-19 13:30   ` Thomas Petazzoni
@ 2020-11-20  8:03     ` Mike Frampton
  2020-11-21  8:16       ` Mike Frampton
  0 siblings, 1 reply; 11+ messages in thread
From: Mike Frampton @ 2020-11-20  8:03 UTC (permalink / raw
  To: buildroot

Hi Thomas,

Thanks very much for the feedback.

On Fri, Nov 20, 2020 at 2:30 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello Mike,
>
> Thanks as well for this new iteration!
>
> On Thu, 19 Nov 2020 22:08:54 +1300
> Mike Frampton <mikeframpo@gmail.com> wrote:
>
> > +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
>
> Why is this needed ? Buildroot should have already copied the DT and
> kernel image to BINARIES_DIR.

For some reason it doesn't in my configuration. When I look in
linux/linux.mk, I found that
LINUX_INSTALL_DTB is only defined if BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT
is not set. I'm not sure why?

> > +How to set up the SD card
> > +=========================
> > +
> > +The bootloader on the DB410c expects the SD card to be formatted in a
> > +particular way. The simplest way to set up the SD card correctly is to flash
> > +a prebuilt Debian image on to the card to set up the required partitions.
>
> This is a bit annoying, having to depend on flashing the SD card with
> another system first. What is so special that we can't do in Buildroot ?

I agree. I know that linaro have some tools for setting up the SD
card, I just haven't had much
success with them in the past :-/. I'll have another look and see if I
can get them working.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v2 3/3] configs/qcom_db410c: new defconfig
  2020-11-20  8:03     ` Mike Frampton
@ 2020-11-21  8:16       ` Mike Frampton
  2021-01-22  9:51         ` Peter Korsgaard
  0 siblings, 1 reply; 11+ messages in thread
From: Mike Frampton @ 2020-11-21  8:16 UTC (permalink / raw
  To: buildroot

Hi Thomas,

> > > +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
> >
> > Why is this needed ? Buildroot should have already copied the DT and
> > kernel image to BINARIES_DIR.
>
> For some reason it doesn't in my configuration. When I look in
> linux/linux.mk, I found that
> LINUX_INSTALL_DTB is only defined if BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT
> is not set. I'm not sure why?

I've done a bit more investigation into this. I was able to get the
dtb to copy to the output/images
folder by unsetting the BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT. I thought
that setting was
needed.

The Image.gz file was not being copied to the images/ folder. I was
able to get this to copy by
adding the following code. I think gmail has messed up the whitespace,
but I'm sure you get the
idea. If you think this is a useful thing to add, then I can expand it
to work for all the supported
output image formats and submit a patch.

diff --git a/linux/linux.mk b/linux/linux.mk
index e07e014d1e..71e6805ab7 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -245,6 +245,12 @@ else
 LINUX_IMAGE_PATH = $(LINUX_ARCH_PATH)/boot/$(LINUX_IMAGE_NAME)
 endif # BR2_LINUX_KERNEL_VMLINUX

+LINUX_OUTPUT_IMAGES=$(LINUX_IMAGE_PATH)
+
+ifeq ($(BR2_LINUX_KERNEL_GZIP),y)
+    LINUX_OUTPUT_IMAGES += $(LINUX_IMAGE_PATH).gz
+endif
+
 define LINUX_APPLY_LOCAL_PATCHES
     for p in $(filter-out ftp://% http://% https://%,$(LINUX_PATCHES)) ; do \
         if test -d $$p ; then \
@@ -451,7 +457,9 @@ else
 # Otherwise, just install the unique image generated by the kernel
 # build process.
 define LINUX_INSTALL_IMAGE
-    $(INSTALL) -m 0644 -D $(LINUX_IMAGE_PATH) $(1)/$(notdir
$(LINUX_IMAGE_NAME))
+    $(foreach img,$(LINUX_OUTPUT_IMAGES), \
+        $(INSTALL) -m 0644 -D $(img) $(1)
+    )
 endef
 endif

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v2 3/3] configs/qcom_db410c: new defconfig
  2020-11-21  8:16       ` Mike Frampton
@ 2021-01-22  9:51         ` Peter Korsgaard
  0 siblings, 0 replies; 11+ messages in thread
From: Peter Korsgaard @ 2021-01-22  9:51 UTC (permalink / raw
  To: buildroot

>>>>> "Mike" == Mike Frampton <mikeframpo@gmail.com> writes:

 > Hi Thomas,
 >> > > +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
 >> >
 >> > Why is this needed ? Buildroot should have already copied the DT and
 >> > kernel image to BINARIES_DIR.
 >> 
 >> For some reason it doesn't in my configuration. When I look in
 >> linux/linux.mk, I found that
 >> LINUX_INSTALL_DTB is only defined if BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT
 >> is not set. I'm not sure why?

 > I've done a bit more investigation into this. I was able to get the
 > dtb to copy to the output/images
 > folder by unsetting the BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT. I thought
 > that setting was
 > needed.

No, that is for a special case where the DTB is embedded inside the
kernel image. E.G. as we tried to explain in the help text:

	  Normally, the device tree(s) to be built have to be passed
	  explicitly to the kernel build system. For some binary
	  formats, however, the kernel build system links in the
	  device tree directly in the kernel binary. Select this option
	  if you have such a kernel binary format.


 > The Image.gz file was not being copied to the images/ folder. I was
 > able to get this to copy by
 > adding the following code. I think gmail has messed up the whitespace,
 > but I'm sure you get the
 > idea. If you think this is a useful thing to add, then I can expand it
 > to work for all the supported
 > output image formats and submit a patch.

 > diff --git a/linux/linux.mk b/linux/linux.mk
 > index e07e014d1e..71e6805ab7 100644
 > --- a/linux/linux.mk
 > +++ b/linux/linux.mk
 > @@ -245,6 +245,12 @@ else
 >  LINUX_IMAGE_PATH = $(LINUX_ARCH_PATH)/boot/$(LINUX_IMAGE_NAME)
 >  endif # BR2_LINUX_KERNEL_VMLINUX

 > +LINUX_OUTPUT_IMAGES=$(LINUX_IMAGE_PATH)
 > +
 > +ifeq ($(BR2_LINUX_KERNEL_GZIP),y)
 > +    LINUX_OUTPUT_IMAGES += $(LINUX_IMAGE_PATH).gz
 > +endif

This may work but isn't really right. The compression options don't
apply to the 'Image' kernel format used on arm64 (as it is a "raw"
kernel without a bootloader in front), so keying off
BR2_LINUX_KERNEL_GZIP isn't good. Ideally we should hide those options
when the Image format is used.

The issue is actually that aarch64 (and riscv, where the logic is
copied) builds Image + Image.gz by default. From arch/arm64/Makefile:


all:	Image.gz

Image: vmlinux
	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

Image.%: Image
	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@


So we could either extend the Image handling to copy both Image and
Image.gz, or add an Image.gz format option to get the Image.gz file
copied. For flexibility, the separate Image.gz format is probably the
nicest option. I'll send a patch for that.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-01-22  9:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-19  9:08 [Buildroot] [PATCH v2 0/3] add support for Dragonboard410c Mike Frampton
2020-11-19  9:08 ` [Buildroot] [PATCH v2 1/3] package/qcom-db410c-firmware: new package Mike Frampton
2020-11-19 13:27   ` Thomas Petazzoni
2020-11-19 22:11   ` Thomas Petazzoni
2020-11-19  9:08 ` [Buildroot] [PATCH v2 2/3] package/abootimg: add host build Mike Frampton
2020-11-19 22:12   ` Thomas Petazzoni
2020-11-19  9:08 ` [Buildroot] [PATCH v2 3/3] configs/qcom_db410c: new defconfig Mike Frampton
2020-11-19 13:30   ` Thomas Petazzoni
2020-11-20  8:03     ` Mike Frampton
2020-11-21  8:16       ` Mike Frampton
2021-01-22  9:51         ` Peter Korsgaard

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.