From patchwork Fri May 29 19:32:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=C3=B6rg_Krause?= X-Patchwork-Id: 478032 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id D96E2140F96 for ; Sat, 30 May 2015 05:33:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 36AC990F47; Fri, 29 May 2015 19:33:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3YUb7osGsD0H; Fri, 29 May 2015 19:33:03 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id C052490F4A; Fri, 29 May 2015 19:33:03 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 96B0F1BFD7E for ; Fri, 29 May 2015 19:33:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 9346B90F3F for ; Fri, 29 May 2015 19:33:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bjTVqcYApma6 for ; Fri, 29 May 2015 19:33:01 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx02.posteo.de (mx02.posteo.de [89.146.194.165]) by whitealder.osuosl.org (Postfix) with ESMTPS id 150F490F42 for ; Fri, 29 May 2015 19:33:01 +0000 (UTC) Received: from dovecot03.posteo.de (unknown [185.67.36.28]) by mx02.posteo.de (Postfix) with ESMTPS id 89CAC1F5E88F for ; Fri, 29 May 2015 21:32:58 +0200 (CEST) Received: from mail.posteo.de (localhost [127.0.0.1]) by dovecot03.posteo.de (Postfix) with ESMTPSA id 3lywzG06npz5vN0 for ; Fri, 29 May 2015 21:32:57 +0200 (CEST) Received: from nzxt.fritz.box (nzxt.localdomain [192.168.178.46]) (Authenticated sender: joerg.krause@embedded.rocks) by embedded.rocks (Postfix) with ESMTPSA id DF96F98020B; Fri, 29 May 2015 21:32:56 +0200 (CEST) From: =?UTF-8?q?J=C3=B6rg=20Krause?= To: buildroot@buildroot.org Date: Fri, 29 May 2015 21:32:52 +0200 Message-Id: <1432927972-6571-1-git-send-email-joerg.krause@embedded.rocks> X-Mailer: git-send-email 2.4.2 MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 1/1] linux: Add support for FIT image X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The FIT (Flattened Image Tree) image format is a much more advanced and flexible format compared to regular uImage, let alone zImage. The FIT image format allows for storing multiple kernel images, multiple device tree blobs and even multiple configurations for their combinations in a single image. Furthermore, it enhances integrity protection of images with sha1, sha256 and md5 checksums as well as signature verification against a public key. Signed-off-by: Jörg Krause --- Changes in v2: - build the device tree blob prior to the FIT image - add error message if file path is missing --- linux/Config.in | 13 +++++++++++++ linux/linux.mk | 21 ++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/linux/Config.in b/linux/Config.in index 457ada6..03ce8cf 100644 --- a/linux/Config.in +++ b/linux/Config.in @@ -174,6 +174,13 @@ config BR2_LINUX_KERNEL_UBOOT_IMAGE choice prompt "Kernel binary format" +config BR2_LINUX_KERNEL_FITIMAGE + bool "fitImage" + depends on BR2_arc || BR2_arm || BR2_armeb || BR2_bfin || \ + BR2_powerpc || BR2_avr32 || BR2_sh || BR2_sh64 || \ + BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el + select BR2_LINUX_KERNEL_UBOOT_IMAGE + config BR2_LINUX_KERNEL_UIMAGE bool "uImage" depends on BR2_arc || BR2_arm || BR2_armeb || BR2_bfin || \ @@ -248,6 +255,12 @@ config BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM endchoice +config BR2_LINUX_KERNEL_FITIMAGE_ITS_FILE + string "FIT image device tree descriptor file path" + depends on BR2_LINUX_KERNEL_FITIMAGE + help + Path to the FIT image device tree descriptor. + config BR2_LINUX_KERNEL_IMAGE_TARGET_NAME string "Kernel image target name" depends on BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM diff --git a/linux/linux.mk b/linux/linux.mk index c765954..a4fbe47 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -108,6 +108,9 @@ LINUX_TARGET_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME)) ifeq ($(LINUX_IMAGE_NAME),) LINUX_IMAGE_NAME = $(LINUX_TARGET_NAME) endif +else ifeq ($(BR2_LINUX_KERNEL_FITIMAGE),y) +LINUX_IMAGE_NAME = fitImage +LINUX_TARGET_NAME = zImage else ifeq ($(BR2_LINUX_KERNEL_UIMAGE),y) LINUX_IMAGE_NAME = uImage @@ -155,7 +158,9 @@ else KERNEL_ARCH_PATH = $(LINUX_DIR)/arch/$(KERNEL_ARCH) endif -ifeq ($(BR2_LINUX_KERNEL_VMLINUX),y) +ifeq ($(BR2_LINUX_KERNEL_FITIMAGE),y) +LINUX_IMAGE_PATH = $(LINUX_DIR)/$(LINUX_IMAGE_NAME) +else ifeq ($(BR2_LINUX_KERNEL_VMLINUX),y) LINUX_IMAGE_PATH = $(LINUX_DIR)/$(LINUX_IMAGE_NAME) else ifeq ($(BR2_LINUX_KERNEL_VMLINUZ),y) LINUX_IMAGE_PATH = $(LINUX_DIR)/$(LINUX_IMAGE_NAME) @@ -277,6 +282,13 @@ LINUX_APPEND_DTB += $(sep) MKIMAGE_ARGS=`$(MKIMAGE) -l $(LINUX_IMAGE_PATH) |\ endif endif +define LINUX_BUILD_FITIMAGE + $(LINUX_INSTALL_HOST_TOOLS) + cp $(call qstrip,$(BR2_LINUX_KERNEL_FITIMAGE_ITS_FILE)) $(@D)/fit-image.its + $(TARGET_MAKE_ENV) $(MKIMAGE) -f $(@D)/fit-image.its $(@D)/$(LINUX_IMAGE_NAME) + rm $(@D)/fit-image.its +endef + # Compilation. We make sure the kernel gets rebuilt when the # configuration has changed. define LINUX_BUILD_CMDS @@ -288,6 +300,7 @@ define LINUX_BUILD_CMDS fi $(LINUX_BUILD_DTB) $(LINUX_APPEND_DTB) + $(if $(BR2_LINUX_KERNEL_FITIMAGE), $(LINUX_BUILD_FITIMAGE)) endef @@ -374,4 +387,10 @@ $(error No kernel configuration file specified, check your BR2_LINUX_KERNEL_CUST endif endif +ifeq ($(BR2_LINUX_KERNEL_FITIMAGE),y) +ifeq ($(call qstrip,$(BR2_LINUX_KERNEL_FITIMAGE_ITS_FILE)),) +$(error No FIT image device tree descriptor file specified, check your BR2_LINUX_KERNEL_FITIMAGE_ITS_FILE setting) +endif +endif + endif