From patchwork Thu May 17 20:11:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 160009 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 0806EB6FAA for ; Fri, 18 May 2012 06:11:48 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id E7D2BA0388; Thu, 17 May 2012 20:11:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OnXm-yKfVDMq; Thu, 17 May 2012 20:11:45 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id E640AA0034; Thu, 17 May 2012 20:11:44 +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 75CEF8F753 for ; Thu, 17 May 2012 20:11:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 3F1E18CA76 for ; Thu, 17 May 2012 20:11:43 +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 95ZlWuyRJdVK for ; Thu, 17 May 2012 20:11:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from smtpi4.ngi.it (smtpi4.ngi.it [88.149.128.104]) by whitealder.osuosl.org (Postfix) with ESMTP id 9DB6A8C86D for ; Thu, 17 May 2012 20:11:39 +0000 (UTC) Received: from localhost.localdomain (88-149-225-112.dynamic.ngi.it [88.149.225.112]) by smtpi4.ngi.it (Postfix) with ESMTP id 5B743421D9; Thu, 17 May 2012 22:11:38 +0200 (CEST) From: Luca Ceresoli To: buildroot@busybox.net Date: Thu, 17 May 2012 22:11:31 +0200 Message-Id: <1337285491-3563-3-git-send-email-luca@lucaceresoli.net> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1337285491-3563-1-git-send-email-luca@lucaceresoli.net> References: <1337285491-3563-1-git-send-email-luca@lucaceresoli.net> Cc: Luca Ceresoli Subject: [Buildroot] [PATCH v6 2/2] u-boot: build signed image for OMAP processors X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Signed-off-by: Luca Ceresoli --- boot/uboot/Config.in | 32 ++++++++++++++++++++++++++++++++ boot/uboot/uboot.mk | 25 +++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in index f83cf4b..afc2f91 100644 --- a/boot/uboot/Config.in +++ b/boot/uboot/Config.in @@ -99,6 +99,38 @@ config BR2_TARGET_UBOOT_FORMAT_LDR endchoice +config BR2_TARGET_UBOOT_OMAP_IFT + depends on BR2_TARGET_UBOOT_FORMAT_BIN + depends on BR2_arm || BR2_armeb + select BR2_PACKAGE_HOST_OMAP_U_BOOT_UTILS + bool "produce a .ift signed image (OMAP)" + help + Use gpsign to produce an image of u-boot.bin signed with + a Configuration Header for booting on OMAP processors. + This allows U-Boot to boot without the need for an + intermediate bootloader (e.g. x-loader) if it is written + on the first sector of the boot medium. + This only works for some media, such as NAND. Check your + chip documentation for details. You might also want to + read the documentation of gpsign, the tool that generates + the .ift image, at: + https://github.com/nmenon/omap-u-boot-utils/blob/master/README + +if BR2_TARGET_UBOOT_OMAP_IFT + +config BR2_TARGET_UBOOT_OMAP_IFT_CONFIG + string "gpsign Configuration Header config file" + help + The Configuration Header (CH) config file defines the + desired content of the CH for the signed image. + It usually contains external RAM settings and + possibly other external devices initialization. + The omap-u-boot-utils software contains example + configuration files for some boards: + https://github.com/nmenon/omap-u-boot-utils/tree/master/configs + +endif + menuconfig BR2_TARGET_UBOOT_NETWORK bool "Custom Network Settings" help diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk index 3119092..486773a 100644 --- a/boot/uboot/uboot.mk +++ b/boot/uboot/uboot.mk @@ -33,6 +33,7 @@ else ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMG),y) UBOOT_BIN = u-boot.img else UBOOT_BIN = u-boot.bin +UBOOT_BIN_IFT = $(UBOOT_BIN).ift endif UBOOT_ARCH=$(KERNEL_ARCH) @@ -88,12 +89,36 @@ define UBOOT_BUILD_CMDS $(UBOOT_MAKE_TARGET) endef +define UBOOT_BUILD_OMAP_IFT + $(HOST_DIR)/usr/bin/gpsign -f $(@D)/u-boot.bin \ + -c $(call qstrip,$(BR2_TARGET_UBOOT_OMAP_IFT_CONFIG)) +endef + define UBOOT_INSTALL_IMAGES_CMDS cp -dpf $(@D)/$(UBOOT_BIN) $(BINARIES_DIR)/ $(if $(BR2_TARGET_UBOOT_SPL), cp -dpf $(@D)/$(BR2_TARGET_UBOOT_SPL_NAME) $(BINARIES_DIR)/) endef +define UBOOT_INSTALL_OMAP_IFT_IMAGE + cp -dpf $(@D)/$(UBOOT_BIN_IFT) $(BINARIES_DIR)/ +endef + +ifeq ($(BR2_TARGET_UBOOT_OMAP_IFT),y) +# we NEED a config file unless we're at make source +ifeq ($(filter source,$(MAKECMDGOALS)),) +ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_OMAP_IFT_CONFIG)),) +$(error No gpsign config file. Check your BR2_TARGET_UBOOT_OMAP_IFT_CONFIG setting) +endif +ifeq ($(wildcard $(call qstrip,$(BR2_TARGET_UBOOT_OMAP_IFT_CONFIG))),) +$(error gpsign config file $(BR2_TARGET_UBOOT_OMAP_IFT_CONFIG) not found. Check your BR2_TARGET_UBOOT_OMAP_IFT_CONFIG setting) +endif +endif +UBOOT_DEPENDENCIES += host-omap-u-boot-utils +UBOOT_POST_BUILD_HOOKS += UBOOT_BUILD_OMAP_IFT +UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_INSTALL_OMAP_IFT_IMAGE +endif + $(eval $(call GENTARGETS)) ifeq ($(BR2_TARGET_UBOOT),y)