All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Burton <paul.burton@imgtec.com>
To: <linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>,
	Markos Chandras <markos.chandras@imgtec.com>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH v2 13/15] MIPS: Support for generating FIT (.itb) images
Date: Wed, 3 Feb 2016 11:30:43 +0000	[thread overview]
Message-ID: <1454499045-5020-14-git-send-email-paul.burton@imgtec.com> (raw)
In-Reply-To: <1454499045-5020-1-git-send-email-paul.burton@imgtec.com>

Introduce support for generating Flattened Image Tree images containing
the kernel & platform-specific configuration such as a device tree
binary. The FIT format is supported by U-Boot and has a number of
advantages over the older legacy uImage format:

  - It includes device tree binaries inside the image without embedding
    them directly into the kernel ELF, allowing the bootloader to easily
    find & manipulate the DTB whilst still only requiring a single file
    to be loaded during boot or distributed to users.

  - It allows for an arbitrary number of images & configurations to be
    included in a single file. Once the code for various systems built
    around the MIPS Coherent Processing System architecture (ie.
    Imagination Technologies MIPS cores with optional CM, GIC & CPC) is
    consolidated sufficiently this will allow for a single binary to
    include multiple device trees & boot on multiple boards.

  - It allows for a choice of hash algorithms to verify the contents of
    the image.

  - It allows for cryptographically signed images should that ever be
    desired.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

Changes in v2: None

 arch/mips/Makefile          |  6 ++++-
 arch/mips/boot/Makefile     | 61 +++++++++++++++++++++++++++++++++++++++++++++
 arch/mips/boot/skeleton.its | 24 ++++++++++++++++++
 3 files changed, 90 insertions(+), 1 deletion(-)
 create mode 100644 arch/mips/boot/skeleton.its

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index e78d60d..0164428 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -257,7 +257,8 @@ KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y)
 KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)
 
 bootvars-y	= VMLINUX_LOAD_ADDRESS=$(load-y) \
-		  VMLINUX_ENTRY_ADDRESS=$(entry-y)
+		  VMLINUX_ENTRY_ADDRESS=$(entry-y) \
+		  PLATFORM_ITS=$(its-y)
 
 LDFLAGS			+= -m $(ld-emul)
 
@@ -297,6 +298,9 @@ boot-y			+= uImage.gz
 boot-y			+= uImage.lzma
 boot-y			+= uImage.lzo
 endif
+boot-y			+= vmlinux.itb
+boot-y			+= vmlinux.bz2.itb
+boot-y			+= vmlinux.gz.itb
 
 # compressed boot image targets (arch/mips/boot/compressed/)
 bootz-y			:= vmlinuz
diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
index acb1988..82de53d 100644
--- a/arch/mips/boot/Makefile
+++ b/arch/mips/boot/Makefile
@@ -100,3 +100,64 @@ $(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo FORCE
 $(obj)/uImage: $(obj)/uImage.$(suffix-y)
 	@ln -sf $(notdir $<) $@
 	@echo '  Image $@ is ready'
+
+#
+# Flattened Image Tree (.itb) images
+#
+
+targets += vmlinux.itb
+targets += vmlinux.gz.itb
+
+# Split a 64bit address into 2x32bit hex integers
+its_addr = $(shell echo $(1) | sed 's/0x\(........\)\(........\)/0x\1 0x\2/')
+
+its_load_addr := $(call its_addr,$(VMLINUX_LOAD_ADDRESS))
+its_entry_addr := $(call its_addr,$(VMLINUX_ENTRY_ADDRESS))
+
+its_files := $(patsubst %,$(srctree)/arch/mips/%,$(PLATFORM_ITS))
+its_inc := $(patsubst %,/include/ \"%\"\n,$(PLATFORM_ITS))
+
+quiet_cmd_gen-its = ITS     $@
+      cmd_gen-its = sed "s|__VMLINUX__|$(2)|g" $< | \
+		sed "s|__VMLINUX_COMPRESSION__|$(3)|g" | \
+		sed "s|__PLATFORM_INCLUDES__|$(its_inc)|g" | \
+		sed "s|__LOAD_ADDR__|$(its_load_addr)|g" | \
+		sed "s|__ENTRY_ADDR__|$(its_entry_addr)|g" \
+		>$@
+
+quiet_cmd_itb-image = ITB     $@
+      cmd_itb-image = \
+		env PATH="$(objtree)/scripts/dtc:$(PATH)" \
+		$(CONFIG_SHELL) $(MKIMAGE) \
+		-D "-I dts -O dtb -p 500 --include $(srctree)/arch/mips --include $(objtree)/arch/mips" \
+		-f $(3) $@
+
+$(obj)/vmlinux.its: $(srctree)/arch/mips/boot/skeleton.its $(its_files) FORCE
+	$(call if_changed,gen-its,boot/vmlinux.bin,none)
+
+$(obj)/vmlinux.itb: $(obj)/vmlinux.bin $(obj)/vmlinux.its FORCE
+	$(call if_changed,itb-image,none,$(obj)/vmlinux.its)
+
+$(obj)/vmlinux.bz2.its: $(srctree)/arch/mips/boot/skeleton.its $(its_files) FORCE
+	$(call if_changed,gen-its,boot/vmlinux.bin.bz2,bzip2)
+
+$(obj)/vmlinux.bz2.itb: $(obj)/vmlinux.bin.bz2 $(obj)/vmlinux.bz2.its FORCE
+	$(call if_changed,itb-image,bzip2,$(obj)/vmlinux.bz2.its)
+
+$(obj)/vmlinux.gz.its: $(srctree)/arch/mips/boot/skeleton.its $(its_files) FORCE
+	$(call if_changed,gen-its,boot/vmlinux.bin.gz,gzip)
+
+$(obj)/vmlinux.gz.itb: $(obj)/vmlinux.bin.gz $(obj)/vmlinux.gz.its FORCE
+	$(call if_changed,itb-image,gzip,$(obj)/vmlinux.gz.its)
+
+$(obj)/vmlinux.lzma.its: $(srctree)/arch/mips/boot/skeleton.its $(its_files) FORCE
+	$(call if_changed,gen-its,boot/vmlinux.bin.lzma,lzmaip)
+
+$(obj)/vmlinux.lzma.itb: $(obj)/vmlinux.bin.lzma $(obj)/vmlinux.lzma.its FORCE
+	$(call if_changed,itb-image,lzma,$(obj)/vmlinux.lzma.its)
+
+$(obj)/vmlinux.lzo.its: $(srctree)/arch/mips/boot/skeleton.its $(its_files) FORCE
+	$(call if_changed,gen-its,boot/vmlinux.bin.lzo,lzoip)
+
+$(obj)/vmlinux.lzo.itb: $(obj)/vmlinux.bin.lzo $(obj)/vmlinux.lzo.its FORCE
+	$(call if_changed,itb-image,lzo,$(obj)/vmlinux.lzo.its)
diff --git a/arch/mips/boot/skeleton.its b/arch/mips/boot/skeleton.its
new file mode 100644
index 0000000..a49c3d2
--- /dev/null
+++ b/arch/mips/boot/skeleton.its
@@ -0,0 +1,24 @@
+/dts-v1/;
+
+/ {
+	description = "MIPS Linux";
+	#address-cells = <1>;
+
+	images {
+		kernel@0 {
+			description = "Linux";
+			data = /incbin/("__VMLINUX__");
+			type = "kernel";
+			arch = "mips";
+			os = "linux";
+			compression = "__VMLINUX_COMPRESSION__";
+			load = <__LOAD_ADDR__>;
+			entry = <__ENTRY_ADDR__>;
+			hash@1 {
+				algo = "sha1";
+			};
+		};
+	};
+};
+
+__PLATFORM_INCLUDES__
-- 
2.7.0

WARNING: multiple messages have this Message-ID (diff)
From: Paul Burton <paul.burton@imgtec.com>
To: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>,
	Markos Chandras <markos.chandras@imgtec.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 13/15] MIPS: Support for generating FIT (.itb) images
Date: Wed, 3 Feb 2016 11:30:43 +0000	[thread overview]
Message-ID: <1454499045-5020-14-git-send-email-paul.burton@imgtec.com> (raw)
Message-ID: <20160203113043.VfhP-uLVrr-Oo6W3lWetnLZ32SDtxy9BJxbzjTdovKo@z> (raw)
In-Reply-To: <1454499045-5020-1-git-send-email-paul.burton@imgtec.com>

Introduce support for generating Flattened Image Tree images containing
the kernel & platform-specific configuration such as a device tree
binary. The FIT format is supported by U-Boot and has a number of
advantages over the older legacy uImage format:

  - It includes device tree binaries inside the image without embedding
    them directly into the kernel ELF, allowing the bootloader to easily
    find & manipulate the DTB whilst still only requiring a single file
    to be loaded during boot or distributed to users.

  - It allows for an arbitrary number of images & configurations to be
    included in a single file. Once the code for various systems built
    around the MIPS Coherent Processing System architecture (ie.
    Imagination Technologies MIPS cores with optional CM, GIC & CPC) is
    consolidated sufficiently this will allow for a single binary to
    include multiple device trees & boot on multiple boards.

  - It allows for a choice of hash algorithms to verify the contents of
    the image.

  - It allows for cryptographically signed images should that ever be
    desired.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

Changes in v2: None

 arch/mips/Makefile          |  6 ++++-
 arch/mips/boot/Makefile     | 61 +++++++++++++++++++++++++++++++++++++++++++++
 arch/mips/boot/skeleton.its | 24 ++++++++++++++++++
 3 files changed, 90 insertions(+), 1 deletion(-)
 create mode 100644 arch/mips/boot/skeleton.its

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index e78d60d..0164428 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -257,7 +257,8 @@ KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y)
 KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)
 
 bootvars-y	= VMLINUX_LOAD_ADDRESS=$(load-y) \
-		  VMLINUX_ENTRY_ADDRESS=$(entry-y)
+		  VMLINUX_ENTRY_ADDRESS=$(entry-y) \
+		  PLATFORM_ITS=$(its-y)
 
 LDFLAGS			+= -m $(ld-emul)
 
@@ -297,6 +298,9 @@ boot-y			+= uImage.gz
 boot-y			+= uImage.lzma
 boot-y			+= uImage.lzo
 endif
+boot-y			+= vmlinux.itb
+boot-y			+= vmlinux.bz2.itb
+boot-y			+= vmlinux.gz.itb
 
 # compressed boot image targets (arch/mips/boot/compressed/)
 bootz-y			:= vmlinuz
diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
index acb1988..82de53d 100644
--- a/arch/mips/boot/Makefile
+++ b/arch/mips/boot/Makefile
@@ -100,3 +100,64 @@ $(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo FORCE
 $(obj)/uImage: $(obj)/uImage.$(suffix-y)
 	@ln -sf $(notdir $<) $@
 	@echo '  Image $@ is ready'
+
+#
+# Flattened Image Tree (.itb) images
+#
+
+targets += vmlinux.itb
+targets += vmlinux.gz.itb
+
+# Split a 64bit address into 2x32bit hex integers
+its_addr = $(shell echo $(1) | sed 's/0x\(........\)\(........\)/0x\1 0x\2/')
+
+its_load_addr := $(call its_addr,$(VMLINUX_LOAD_ADDRESS))
+its_entry_addr := $(call its_addr,$(VMLINUX_ENTRY_ADDRESS))
+
+its_files := $(patsubst %,$(srctree)/arch/mips/%,$(PLATFORM_ITS))
+its_inc := $(patsubst %,/include/ \"%\"\n,$(PLATFORM_ITS))
+
+quiet_cmd_gen-its = ITS     $@
+      cmd_gen-its = sed "s|__VMLINUX__|$(2)|g" $< | \
+		sed "s|__VMLINUX_COMPRESSION__|$(3)|g" | \
+		sed "s|__PLATFORM_INCLUDES__|$(its_inc)|g" | \
+		sed "s|__LOAD_ADDR__|$(its_load_addr)|g" | \
+		sed "s|__ENTRY_ADDR__|$(its_entry_addr)|g" \
+		>$@
+
+quiet_cmd_itb-image = ITB     $@
+      cmd_itb-image = \
+		env PATH="$(objtree)/scripts/dtc:$(PATH)" \
+		$(CONFIG_SHELL) $(MKIMAGE) \
+		-D "-I dts -O dtb -p 500 --include $(srctree)/arch/mips --include $(objtree)/arch/mips" \
+		-f $(3) $@
+
+$(obj)/vmlinux.its: $(srctree)/arch/mips/boot/skeleton.its $(its_files) FORCE
+	$(call if_changed,gen-its,boot/vmlinux.bin,none)
+
+$(obj)/vmlinux.itb: $(obj)/vmlinux.bin $(obj)/vmlinux.its FORCE
+	$(call if_changed,itb-image,none,$(obj)/vmlinux.its)
+
+$(obj)/vmlinux.bz2.its: $(srctree)/arch/mips/boot/skeleton.its $(its_files) FORCE
+	$(call if_changed,gen-its,boot/vmlinux.bin.bz2,bzip2)
+
+$(obj)/vmlinux.bz2.itb: $(obj)/vmlinux.bin.bz2 $(obj)/vmlinux.bz2.its FORCE
+	$(call if_changed,itb-image,bzip2,$(obj)/vmlinux.bz2.its)
+
+$(obj)/vmlinux.gz.its: $(srctree)/arch/mips/boot/skeleton.its $(its_files) FORCE
+	$(call if_changed,gen-its,boot/vmlinux.bin.gz,gzip)
+
+$(obj)/vmlinux.gz.itb: $(obj)/vmlinux.bin.gz $(obj)/vmlinux.gz.its FORCE
+	$(call if_changed,itb-image,gzip,$(obj)/vmlinux.gz.its)
+
+$(obj)/vmlinux.lzma.its: $(srctree)/arch/mips/boot/skeleton.its $(its_files) FORCE
+	$(call if_changed,gen-its,boot/vmlinux.bin.lzma,lzmaip)
+
+$(obj)/vmlinux.lzma.itb: $(obj)/vmlinux.bin.lzma $(obj)/vmlinux.lzma.its FORCE
+	$(call if_changed,itb-image,lzma,$(obj)/vmlinux.lzma.its)
+
+$(obj)/vmlinux.lzo.its: $(srctree)/arch/mips/boot/skeleton.its $(its_files) FORCE
+	$(call if_changed,gen-its,boot/vmlinux.bin.lzo,lzoip)
+
+$(obj)/vmlinux.lzo.itb: $(obj)/vmlinux.bin.lzo $(obj)/vmlinux.lzo.its FORCE
+	$(call if_changed,itb-image,lzo,$(obj)/vmlinux.lzo.its)
diff --git a/arch/mips/boot/skeleton.its b/arch/mips/boot/skeleton.its
new file mode 100644
index 0000000..a49c3d2
--- /dev/null
+++ b/arch/mips/boot/skeleton.its
@@ -0,0 +1,24 @@
+/dts-v1/;
+
+/ {
+	description = "MIPS Linux";
+	#address-cells = <1>;
+
+	images {
+		kernel@0 {
+			description = "Linux";
+			data = /incbin/("__VMLINUX__");
+			type = "kernel";
+			arch = "mips";
+			os = "linux";
+			compression = "__VMLINUX_COMPRESSION__";
+			load = <__LOAD_ADDR__>;
+			entry = <__ENTRY_ADDR__>;
+			hash@1 {
+				algo = "sha1";
+			};
+		};
+	};
+};
+
+__PLATFORM_INCLUDES__
-- 
2.7.0

  parent reply	other threads:[~2016-02-03 11:34 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 11:30 [PATCH v2 00/15] MIPS Boston board support Paul Burton
2016-02-03 11:30 ` Paul Burton
2016-02-03 11:30 ` Paul Burton
2016-02-03 11:30 ` Paul Burton
2016-02-03 11:30 ` [PATCH v2 01/15] dt-bindings: ascii-lcd: Document a binding for simple ASCII LCDs Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-08 17:29   ` Rob Herring
2016-02-03 11:30 ` [PATCH v2 02/15] auxdisplay: driver for simple memory mapped ASCII LCD displays Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 12:44   ` kbuild test robot
2016-02-03 12:44     ` kbuild test robot
2016-02-03 14:12   ` James Hogan
2016-02-03 14:12     ` James Hogan
2016-02-03 11:30 ` [PATCH v2 03/15] MIPS: PCI: Compatibility with ARM-like PCI host drivers Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-03-08 18:37   ` Florian Fainelli
2016-03-29 23:19   ` Florian Fainelli
2016-04-04 10:09     ` Paul Burton
2016-04-04 10:09       ` Paul Burton
2016-05-05  1:36       ` Florian Fainelli
2016-05-05 11:02         ` Paul Burton
2016-05-05 11:02           ` Paul Burton
2016-05-05 17:13           ` Florian Fainelli
2016-02-03 11:30 ` [PATCH v2 04/15] PCI: xilinx: Keep references to both IRQ domains Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 11:30 ` [PATCH v2 05/15] PCI: xilinx: Unify INTx & MSI interrupt FIFO decode Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 11:30 ` [PATCH v2 06/15] PCI: xilinx: Always clear interrupt decode register Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 11:30 ` [PATCH v2 07/15] PCI: xilinx: Clear interrupt FIFO during probe Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 11:30 ` [PATCH v2 08/15] PCI: xilinx: Fix INTX irq dispatch Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 11:30 ` [PATCH v2 09/15] PCI: xilinx: Allow build on MIPS platforms Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 11:30 ` [PATCH v2 10/15] misc: pch_phub: " Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 11:30 ` [PATCH v2 11/15] dmaengine: pch_dma: " Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 11:30 ` [PATCH v2 12/15] ptp: pch: " Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 11:30 ` Paul Burton [this message]
2016-02-03 11:30   ` [PATCH v2 13/15] MIPS: Support for generating FIT (.itb) images Paul Burton
2016-02-03 11:30 ` [PATCH v2 14/15] dt-bindings: mips: img,boston: Document img,boston binding Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-08 17:30   ` Rob Herring
2016-02-08 17:30     ` Rob Herring
2016-02-03 11:30 ` [PATCH v2 15/15] MIPS: Boston board support Paul Burton
2016-02-03 11:30   ` Paul Burton
2016-02-03 12:35 ` [PATCH v2 00/15] MIPS " Michal Simek
2016-02-03 12:35   ` Michal Simek
2016-02-03 12:35   ` Michal Simek
2016-02-03 12:35   ` Michal Simek
2016-02-03 16:03   ` Paul Burton
2016-02-03 16:03     ` Paul Burton
2016-02-04  5:53     ` Michal Simek
2016-02-04  5:53       ` Michal Simek

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=1454499045-5020-14-git-send-email-paul.burton@imgtec.com \
    --to=paul.burton@imgtec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=markos.chandras@imgtec.com \
    --cc=ralf@linux-mips.org \
    /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.