DistroKit Mailinglist
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: distrokit@pengutronix.de
Subject: [DistroKit] [PATCH] v7a: Add support for Raspberry Pi CM3
Date: Wed, 10 Mar 2021 21:34:49 +0100	[thread overview]
Message-ID: <20210310203449.254481-1-u.kleine-koenig@pengutronix.de> (raw)

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 configs/platform-v7a/barebox-rpi2.config      |  2 +-
 configs/platform-v7a/barebox-rpi2.config.diff |  1 +
 .../platform-v7a/config/images/rpicm3.config  | 30 ++++++++++++
 configs/platform-v7a/platformconfig           |  4 +-
 .../platform-v7a/platforms/blspec-rpicm3.in   |  5 ++
 .../platform-v7a/platforms/image-rpicm3.in    | 12 +++++
 .../projectroot/loader/entries/rpicm3.conf    |  6 +++
 configs/platform-v7a/rules/barebox-rpi2.make  |  2 +-
 configs/platform-v7a/rules/blspec-rpicm3.make | 36 +++++++++++++++
 configs/platform-v7a/rules/image-rpicm3.make  | 46 +++++++++++++++++++
 10 files changed, 141 insertions(+), 3 deletions(-)
 create mode 100644 configs/platform-v7a/config/images/rpicm3.config
 create mode 100644 configs/platform-v7a/platforms/blspec-rpicm3.in
 create mode 100644 configs/platform-v7a/platforms/image-rpicm3.in
 create mode 100644 configs/platform-v7a/projectroot/loader/entries/rpicm3.conf
 create mode 100644 configs/platform-v7a/rules/blspec-rpicm3.make
 create mode 100644 configs/platform-v7a/rules/image-rpicm3.make

diff --git a/configs/platform-v7a/barebox-rpi2.config b/configs/platform-v7a/barebox-rpi2.config
index 9e73e9ee877a..f079e019d1cf 100644
--- a/configs/platform-v7a/barebox-rpi2.config
+++ b/configs/platform-v7a/barebox-rpi2.config
@@ -57,7 +57,7 @@ CONFIG_MACH_RPI_COMMON=y
 # CONFIG_MACH_RPI is not set
 CONFIG_MACH_RPI2=y
 CONFIG_MACH_RPI3=y
-# CONFIG_MACH_RPI_CM3 is not set
+CONFIG_MACH_RPI_CM3=y
 # end of select Broadcom BCM283X boards to be built
 
 CONFIG_BAREBOX_MAX_IMAGE_SIZE=0xffffffff
diff --git a/configs/platform-v7a/barebox-rpi2.config.diff b/configs/platform-v7a/barebox-rpi2.config.diff
index 4ca4bd22ca09..27cb1d26e65f 100644
--- a/configs/platform-v7a/barebox-rpi2.config.diff
+++ b/configs/platform-v7a/barebox-rpi2.config.diff
@@ -22,6 +22,7 @@ CONFIG_GPIO_RASPBERRYPI_EXP=y
 # CONFIG_KEYBOARD_QT1070 is undefined
 # CONFIG_LED_PCA955X is undefined
 CONFIG_MACH_RPI2=y
+CONFIG_MACH_RPI_CM3=y
 CONFIG_MCI_BCM283X=y
 CONFIG_MCI_BCM283X_SDHOST=y
 # CONFIG_MCI_MMCI is not set
diff --git a/configs/platform-v7a/config/images/rpicm3.config b/configs/platform-v7a/config/images/rpicm3.config
new file mode 100644
index 000000000000..298307bf5762
--- /dev/null
+++ b/configs/platform-v7a/config/images/rpicm3.config
@@ -0,0 +1,30 @@
+image rpi3-boot.vfat {
+	vfat {
+		files = { @FIRMWARE_RPI3@ }
+		file barebox.img { image = barebox-raspberry-pi-cm3.img }
+	}
+	size = 32M
+}
+
+image @IMAGE@ {
+	hdimage {
+		align = 1M
+		disk-signature = 0xbedf7893
+	}
+	partition boot {
+		image = rpi3-boot.vfat
+		size = 32M
+		partition-type = 0xc
+		bootable = true
+	}
+	partition root-A {
+		image = root.ext2
+		partition-type = 0x83
+		size = 512M
+	}
+	partition data {
+		partition-type = 0x83
+		size = 512M
+	}
+}
+/* vim: set tabstop=8 noexpandtab : */
diff --git a/configs/platform-v7a/platformconfig b/configs/platform-v7a/platformconfig
index 3c9312c072e1..b82f3883556e 100644
--- a/configs/platform-v7a/platformconfig
+++ b/configs/platform-v7a/platformconfig
@@ -151,7 +151,7 @@ PTXCONF_KERNEL_EXTRA_MAKEVARS=""
 PTXCONF_DTC=y
 PTXCONF_DTC_INSTALL_OFTREE=y
 PTXCONF_DTC_OFTREE_DTS_PATH="${PTXDIST_PLATFORMCONFIG_SUBDIR}/dts:${KERNEL_DIR}/arch/${GENERIC_KERNEL_ARCH}/boot/dts"
-PTXCONF_DTC_OFTREE_DTS="am335x-bone.dts am335x-boneblack.dts vexpress-v2p-ca9.dts bcm2836-rpi-2-b.dts imx6q-sabrelite.dts imx6sx-udoo-neo-full.dts imx6dl-riotboard.dts imx6q-nitrogen6x.dts imx6qp-nitrogen6_max.dts bcm2837-rpi-3-b.dts stm32mp157c-dk2.dts stm32mp157c-lxa-mc1.dts at91-sama5d27_som1_ek.dts at91-sama5d27_giantboard.dts"
+PTXCONF_DTC_OFTREE_DTS="am335x-bone.dts am335x-boneblack.dts vexpress-v2p-ca9.dts bcm2836-rpi-2-b.dts imx6q-sabrelite.dts imx6sx-udoo-neo-full.dts imx6dl-riotboard.dts imx6q-nitrogen6x.dts imx6qp-nitrogen6_max.dts bcm2837-rpi-3-b.dts bcm2837-rpi-cm3-io3.dts stm32mp157c-dk2.dts stm32mp157c-lxa-mc1.dts at91-sama5d27_som1_ek.dts at91-sama5d27_giantboard.dts"
 PTXCONF_DTC_EXTRA_ARGS=""
 PTXCONF_HOST_DTC=y
 PTXCONF_HOST_DTC_VERSION="1.6.0"
@@ -225,6 +225,7 @@ PTXCONF_BLSPEC_NITROGEN6X=y
 PTXCONF_BLSPEC_RIOTBOARD=y
 PTXCONF_BLSPEC_RPI2=y
 PTXCONF_BLSPEC_RPI3=y
+PTXCONF_BLSPEC_RPICM3=y
 PTXCONF_BLSPEC_SABRELITE=y
 PTXCONF_BLSPEC_SAMA5D27_GIANTBOARD=y
 PTXCONF_BLSPEC_SAMA5D27_SOM1_EK=y
@@ -277,6 +278,7 @@ PTXCONF_IMAGE_ROOT_TGZ_LABEL=""
 # PTXCONF_IMAGE_ROOT_UBIFS is not set
 PTXCONF_IMAGE_RPI2=y
 PTXCONF_IMAGE_RPI3=y
+PTXCONF_IMAGE_RPICM3=y
 PTXCONF_IMAGE_SABRELITE=y
 PTXCONF_IMAGE_SAMA5D27_GIANTBOARD=y
 PTXCONF_IMAGE_SAMA5D27_SOM1_EK=y
diff --git a/configs/platform-v7a/platforms/blspec-rpicm3.in b/configs/platform-v7a/platforms/blspec-rpicm3.in
new file mode 100644
index 000000000000..430346cca103
--- /dev/null
+++ b/configs/platform-v7a/platforms/blspec-rpicm3.in
@@ -0,0 +1,5 @@
+## SECTION=blspec
+
+config BLSPEC_RPICM3
+	tristate
+	prompt "/loader/entries/rpicm3.conf bootloader spec entry"
diff --git a/configs/platform-v7a/platforms/image-rpicm3.in b/configs/platform-v7a/platforms/image-rpicm3.in
new file mode 100644
index 000000000000..5cecf9ac00b3
--- /dev/null
+++ b/configs/platform-v7a/platforms/image-rpicm3.in
@@ -0,0 +1,12 @@
+## SECTION=image
+
+config IMAGE_RPICM3
+	tristate
+	select HOST_GENIMAGE
+	select HOST_DOSFSTOOLS
+	select HOST_MTOOLS
+	select IMAGE_ROOT_EXT
+	select BAREBOX_RPI2
+	prompt "Generate images/rpiCM3.hdimg"
+	help
+	  SD card image for the Raspberry Pi Compute Module 3
diff --git a/configs/platform-v7a/projectroot/loader/entries/rpicm3.conf b/configs/platform-v7a/projectroot/loader/entries/rpicm3.conf
new file mode 100644
index 000000000000..ada8d993b39a
--- /dev/null
+++ b/configs/platform-v7a/projectroot/loader/entries/rpicm3.conf
@@ -0,0 +1,6 @@
+title		Raspberry Pi CM3 - Pengutronix-DistroKit
+version		4.6
+options		rootwait rw
+linux		/boot/zImage
+devicetree	/boot/bcm2837-rpi-cm3-io3.dtb
+linux-appendroot true
diff --git a/configs/platform-v7a/rules/barebox-rpi2.make b/configs/platform-v7a/rules/barebox-rpi2.make
index 5f16584238d7..636ffebf4206 100644
--- a/configs/platform-v7a/rules/barebox-rpi2.make
+++ b/configs/platform-v7a/rules/barebox-rpi2.make
@@ -45,7 +45,7 @@ BAREBOX_RPI2_CONF_OPT := \
 
 BAREBOX_RPI2_MAKE_OPT := $(BAREBOX_RPI2_CONF_OPT)
 
-BAREBOX_RPI2_IMAGES := images/barebox-raspberry-pi-2.img images/barebox-raspberry-pi-3.img
+BAREBOX_RPI2_IMAGES := images/barebox-raspberry-pi-2.img images/barebox-raspberry-pi-3.img images/barebox-raspberry-pi-cm3.img
 BAREBOX_RPI2_IMAGES := $(addprefix $(BAREBOX_RPI2_BUILD_DIR)/,$(BAREBOX_RPI2_IMAGES))
 
 ifdef PTXCONF_BAREBOX_RPI2
diff --git a/configs/platform-v7a/rules/blspec-rpicm3.make b/configs/platform-v7a/rules/blspec-rpicm3.make
new file mode 100644
index 000000000000..4908a8bcb8c5
--- /dev/null
+++ b/configs/platform-v7a/rules/blspec-rpicm3.make
@@ -0,0 +1,36 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2021 by Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_BLSPEC_RPICM3) += blspec-rpicm3
+
+BLSPEC_RPICM3_VERSION	:= 4.6
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/blspec-rpicm3.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, blspec-rpicm3)
+	@$(call install_fixup,blspec-rpicm3,PRIORITY,optional)
+	@$(call install_fixup,blspec-rpicm3,SECTION,base)
+	@$(call install_fixup,blspec-rpicm3,AUTHOR,"Uwe Kleine-König <u.kleine-koenig@pengutronix.de>")
+	@$(call install_fixup,blspec-rpicm3,DESCRIPTION,missing)
+
+	@$(call install_alternative, blspec-rpicm3, 0, 0, 0644, \
+		/loader/entries/rpicm3.conf)
+
+	@$(call install_finish,blspec-rpicm3)
+
+	@$(call touch)
+
+# vim: syntax=make
diff --git a/configs/platform-v7a/rules/image-rpicm3.make b/configs/platform-v7a/rules/image-rpicm3.make
new file mode 100644
index 000000000000..54cd78cedf77
--- /dev/null
+++ b/configs/platform-v7a/rules/image-rpicm3.make
@@ -0,0 +1,46 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2017 by Sascha Hauer <s.hauer@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+IMAGE_PACKAGES-$(PTXCONF_IMAGE_RPICM3) += image-rpicm3
+
+#
+# Paths and names
+#
+IMAGE_RPICM3		:= image-rpicm3
+IMAGE_RPICM3_DIR	:= $(BUILDDIR)/$(IMAGE_RPI3)
+IMAGE_RPICM3_IMAGE	:= $(IMAGEDIR)/rpicm3.hdimg
+IMAGE_RPICM3_FILES	:= $(IMAGEDIR)/root.tgz
+IMAGE_RPICM3_CONFIG	:= rpicm3.config
+IMAGE_RPICM3_DATA_DIR	:= $(call ptx/in-platformconfigdir, rpi-firmware)
+IMAGE_RPICM3_DATA		:= \
+	$(wildcard $(IMAGE_RPI3_DATA_DIR)/*.bin) \
+	$(wildcard $(IMAGE_RPI3_DATA_DIR)/*.elf) \
+	$(wildcard $(IMAGE_RPI3_DATA_DIR)/*.dat) \
+	$(wildcard $(IMAGE_RPI3_DATA_DIR)/*.dtb) \
+	$(wildcard $(IMAGE_RPI3_DATA_DIR)/config.txt)
+
+# ----------------------------------------------------------------------------
+# Image
+# ----------------------------------------------------------------------------
+
+define squote_and_comma
+$(subst $(ptx/def/space),$(comma) ,$(addsuffix $(ptx/def/squote),$(addprefix $(ptx/def/squote),$(1))))
+endef
+
+IMAGE_RPICM3_ENV := \
+        FIRMWARE_RPI3="$(call squote_and_comma,$(IMAGE_RPICM3_DATA))"
+
+$(IMAGE_RPICM3_IMAGE):
+	@$(call targetinfo)
+	@$(call image/genimage, IMAGE_RPICM3)
+	@$(call finish)
+
+# vim: syntax=make
-- 
2.30.1


_______________________________________________
DistroKit mailing list
DistroKit@pengutronix.de

             reply	other threads:[~2021-03-10 20:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 20:34 Uwe Kleine-König [this message]
2021-03-11 12:08 ` Roland Hieber

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=20210310203449.254481-1-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=distrokit@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox