From patchwork Mon Mar 4 15:32:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kas User X-Patchwork-Id: 1051159 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::539; helo=mail-ed1-x539.google.com; envelope-from=swupdate+bncbclij4msq4lrbcuk6xrqkgqeqcxtmfq@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=example.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="KjRtFvLH"; dkim-atps=neutral Received: from mail-ed1-x539.google.com (mail-ed1-x539.google.com [IPv6:2a00:1450:4864:20::539]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44CkYB20WDz9ryj for ; Tue, 5 Mar 2019 02:32:30 +1100 (AEDT) Received: by mail-ed1-x539.google.com with SMTP id e46sf2893425ede.9 for ; Mon, 04 Mar 2019 07:32:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1551713546; cv=pass; d=google.com; s=arc-20160816; b=v4+TvY7sqgSEy9fQp3semcXtkBXJHuDPRI1sqP9Up2aael+kk0vI8BSZ6nfi4ikx2f m1ASdS0I+uIbUAO2O/EB0hzbBO0cybrftGcjSmQM/VYT3vP808t47WCWmEXmUkClMOlB AD5tcKYyHdV+NOEKoSntNo9tXuadRjysnFclrjZNdlCewMxpNlEyt6MRXm1c7Yx33Oc2 21qzz6PxjqVzxgQiDCaDE0Lv99/lb57/MpNgCMoxA/lUokhBv0D7UJ5MEsayrSRQ71TN 6Q8dztVbpcJqgS9a9VulGSCMLPqCj/XMirq8vBPdbPp4TqBy0K+B4yYgFL3C/uq6KDgk E62g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:message-id:date:subject:cc:to:from :mime-version:sender:dkim-signature; bh=0gbsc9OeG/iWr4NPBBTZ8oW+b3KMlTFPFe1bLwNnDto=; b=fZg37hTe0lmyxwYg9T/qYkrLtUOp6a1qau0hHH9PPbBt7Dhrubdkmby7pZkW3a8o3q IJSAYBs3EaEw7TB8LEzcMBz/Ca7tgJ9l3PXxPXOtIpHRrNk18CZjTatjQ6gxpwoN8Qfu 3ZIZxRqXksw8PldXer9pTfGvZO1y7KkchKFEz3ZahJPKg/0RwDz61jGivxVb2ajI9m5j fAVvaa4iX4NaYu16Q4WjcOphLkQslFG6EuE+Jzt8CH89FJUAr47eg2OfOPuRl5aMQ4a+ S6y1L234k3JE6HtG3fVaBHixLkVdsIOaZqYiGNkjX8Z4XanctOk073va+mcWYImS8QMt QRBg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 88.217.136.221 is neither permitted nor denied by best guess record for domain of stefano@papero.fritz.box) smtp.mailfrom=stefano@papero.fritz.box DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=0gbsc9OeG/iWr4NPBBTZ8oW+b3KMlTFPFe1bLwNnDto=; b=KjRtFvLHqmsx7/uLOo4N5IHr2I8VA2aHoeI8VB1dyrB2tvEUVfGZktv727TbffPPv0 cD3b7dDfCh2qJ8bgifucfdlFekJzkXLRs3Q+bSr9XiLGtfmMzZ+ybUlKYI5UOoKNIVk/ IupQf9Wf+b8gig1sA+XdX9X92HYaYjHkBVDO26oTTM5Llz2AlmiiXAp3VkqUYmxmzy3u TM7ebPxcZAiZf8Xa+gIVcqUepBNqtIQ0lFAfqfWPU4RdQwabuC5rpRnLryijSAAf3CDh 9lo6EXYJpWRbeqbM6EL7M2L2PaKpKb59ah95HUrpPQ9Xl1+LZFVVKR0gQXVYYS1qOstA JFQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=0gbsc9OeG/iWr4NPBBTZ8oW+b3KMlTFPFe1bLwNnDto=; b=irhGXSnBSj1W+V+koBrDO1k+Kfr6KixYmc/3ai6KtSwpged9j0lTvEk9TdVS/6bxeG oPoxqqXPnSs6ng6Ed8BPCVH15KHkFxursE/kYgw0j2bl3TBjxkgqP3IpIgfebGBAIKXV 8VEPFD5mqGJLTEXZLLg5hoTDgqr63U4riPhkqD/JsXRr0p3Q4TiT3QBS+SWHJ3XR8mQy raWwOxWjEDqAB4giL2v6X1kBiRHtn1uqunBJj6gW640rV01AW7IX3pbEsaYp7eWLoHqT E9CLFfTuxPYfJY+5b73b81P5zJ82/IJE+BAQpDBuLJpY64/a3r9ucFrWQaDvIxgRdR5Q /uDQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: APjAAAUiDtJ/5JL8FWcXO+nIrufyBLyjmRuGZqkzNiwWazUZ7HvGHc1P tBCW5A/mz9UmrFITo+WFZ7Q= X-Google-Smtp-Source: APXvYqwCoCdLDisStLSYI/pc+82eKF4QopQoIaxAuA8Cc/q/JQWtp8t/5f3VKZx+IWWYjV2Pkmj8Og== X-Received: by 2002:a50:980c:: with SMTP id g12mr15832489edb.255.1551713546583; Mon, 04 Mar 2019 07:32:26 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a17:906:348d:: with SMTP id g13ls3546405ejb.3.gmail; Mon, 04 Mar 2019 07:32:26 -0800 (PST) X-Received: by 2002:a17:906:14c2:: with SMTP id y2mr1735450ejc.11.1551713546112; Mon, 04 Mar 2019 07:32:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551713546; cv=none; d=google.com; s=arc-20160816; b=sN24/W3Gbv6C5g3tByGhfcDOAWrj0ToSS4teZAFQpaqq76ZXNTMULsViSrNSfqJ1i1 EOLMmDAOX6gd4fgHcJ4gw+ASY12060fGcnORR7bRRV+yzyUuBRlosefZWUtwq9Xxvjsr Yig+t0OEBAMT7Qm2TBRx9Mhts+848rTqCWhyun6FF+ur2TluyUMfgVDFbZ9kr/ZozdRH zr1zoIzSaGDNCT0cbu9onc677LUppYTbg700lUiwnYQ+wx5r8O+h3Z83npvWzv+rH5PZ URRuoQdpBYI80OTITqeHQjHVTcLag0coyQjMo/rUTnLnL2FmEZk5ROVhjkkBSzbj35SH 6a7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=yLFdMNFH3XwPz7JguQwb6a/ZG9r3PrSGsHkI4TzLREE=; b=UVXe4Ma9qmb69VDb7ZSyBDUlTo8HRyOxs7pdPTn8WGqXJ8eQ+xBiGeiJ8dd/WORG1s pqrHByNYqi/hSkXt+3saxq7Yx0KSfSSQ1UvVtx6eO358JUGz9zJEJF1PkISZ1D//yHGf zvHLMLhbzJFZjolmaIG0LZBKzBXHeN2RZA8CSoqF2/aaQvuZWIewrX8p2XoyQpBgtLcO 4H/oG4x7CaWO6cDZtMm4q3wCCpqB289BW2c1yy6hLowc7Qy1SFKicjbN3UaOUvc2krse /i1xQpbp831RlT3MkAwVSUk0r66sbrfoWmoRqln7fzul1t23W1FRVIlSXYlOqm9lVMRj sqWw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 88.217.136.221 is neither permitted nor denied by best guess record for domain of stefano@papero.fritz.box) smtp.mailfrom=stefano@papero.fritz.box Received: from papero.fritz.box (host-88-217-136-221.customer.m-online.net. [88.217.136.221]) by gmr-mx.google.com with ESMTP id r37si403002edd.2.2019.03.04.07.32.26 for ; Mon, 04 Mar 2019 07:32:26 -0800 (PST) Received-SPF: neutral (google.com: 88.217.136.221 is neither permitted nor denied by best guess record for domain of stefano@papero.fritz.box) client-ip=88.217.136.221; Received: by papero.fritz.box (Postfix, from userid 1000) id A07E31C71E4; Mon, 4 Mar 2019 16:32:25 +0100 (CET) From: Kas User To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [meta-swupdate][RFC][PATCH] bsp: extract initial environment from U-Boot binary Date: Mon, 4 Mar 2019 16:32:24 +0100 Message-Id: <20190304153224.27788-1-kas@example.com> X-Mailer: git-send-email 2.17.1 X-Original-Sender: kas@example.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 88.217.136.221 is neither permitted nor denied by best guess record for domain of stefano@papero.fritz.box) smtp.mailfrom=stefano@papero.fritz.box Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , From: Stefano Babic Signed-off-by: Stefano Babic --- ...1-Add-target-for-initial-environment.patch | 28 +++++++++++ recipes-bsp/u-boot/u-boot%.bbappend | 50 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 recipes-bsp/u-boot/files/0001-Add-target-for-initial-environment.patch create mode 100644 recipes-bsp/u-boot/u-boot%.bbappend This is currently to show how to extract the environment from the bootloader binary. The patch should first be posted to U-Boot ML. diff --git a/recipes-bsp/u-boot/files/0001-Add-target-for-initial-environment.patch b/recipes-bsp/u-boot/files/0001-Add-target-for-initial-environment.patch new file mode 100644 index 0000000..8116eda --- /dev/null +++ b/recipes-bsp/u-boot/files/0001-Add-target-for-initial-environment.patch @@ -0,0 +1,28 @@ +From 24611410d020c77547575ff9daaec601fdc25620 Mon Sep 17 00:00:00 2001 +From: Kas User +Date: Tue, 19 Feb 2019 16:21:25 +0000 +Subject: [PATCH] Add target for initial environment + +Signed-off-by: Kas User +--- + Makefile | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/Makefile b/Makefile +index 65cc49fa1f..6888deeab0 100644 +--- a/Makefile ++++ b/Makefile +@@ -1718,6 +1718,10 @@ endif + $(build)=$(build-dir) $(@:.ko=.o) + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost + ++u-boot-initial-env: u-boot.bin ++ $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o ++ sed --in-place -e 's/\x00/\x0A/g' $@ ++ + # Consistency checks + # --------------------------------------------------------------------------- + +-- +2.17.1 + diff --git a/recipes-bsp/u-boot/u-boot%.bbappend b/recipes-bsp/u-boot/u-boot%.bbappend new file mode 100644 index 0000000..ca8cbea --- /dev/null +++ b/recipes-bsp/u-boot/u-boot%.bbappend @@ -0,0 +1,50 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" +SRC_URI_append = " file://0001-Add-target-for-initial-environment.patch" + +UBOOT_MAKE_TARGET_append = " u-boot-initial-env" +PACKAGES += "${PN}-initial-env" +FILES_${PN}-initial-env = "${sysconfdir}/u-boot-initial-env" + +do_install_append () { + if [ -n "${UBOOT_CONFIG}" ] + then + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + install -d ${D}/${sysconfdir} + install -m 644 ${B}/${config}/u-boot-initial-env ${D}/${sysconfdir}/u-boot-initial-env + fi + done + unset j + done + unset i + else + install -d ${D}/${sysconfdir} + install -m 644 ${B}/u-boot-initial-env ${D}/${sysconfdir}/u-boot-initial-env + fi +} + +do_deploy_append () { + if [ -n "${UBOOT_CONFIG}" ] + then + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + install -d ${DEPLOYDIR} + install -m 644 ${B}/${config}/u-boot-initial-env ${DEPLOYDIR}/u-boot-initial-env-${type} + fi + done + unset j + done + unset i + else + install -d ${DEPLOYDIR} + install -m 644 ${B}/${config}/u-boot-initial-env ${DEPLOYDIR}/u-boot-initial-env + fi +}