From patchwork Mon Apr 1 13:15:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1072764 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::33b; helo=mail-wm1-x33b.google.com; envelope-from=swupdate+bncbcxploxj6ikrb2e5rdsqkgqey43m7pi@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="djwbVpDy"; dkim-atps=neutral Received: from mail-wm1-x33b.google.com (mail-wm1-x33b.google.com [IPv6:2a00:1450:4864:20::33b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44XtB71zQbz9sP8 for ; Tue, 2 Apr 2019 00:15:24 +1100 (AEDT) Received: by mail-wm1-x33b.google.com with SMTP id f12sf7800311wmj.0 for ; Mon, 01 Apr 2019 06:15:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1554124521; cv=pass; d=google.com; s=arc-20160816; b=vgfMLqWARMWo8jalj/lY2Owam4r4F0AtG8gTDM8/WPonpcGoh2b3a1fGma16yFEBKB zVtG4VtGvRsTA5XRNBf8tGpg2bh2o2bSVzCB9t3Farw49FfAd7+tUL0QE9R1dNuLGNx4 FdshIv7RHxsns8G83+BCGGBj8Q4i6hId3FecaasMi567evs//jO0hHAZBHKw2X6pfOp3 eljtvRsAfi9AULcBQCV8D1/FhKuZQECPFz9Ko4ZfngDc8IvoEX0p8zFU5sLfXfBoW7Cn 4gWgsECmlXtkbuCZL1a+zE4v4RXIT8Tfy+RAnI42yK6NMO74E2hLXq03Hm9qLzg3ezFL looQ== 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=JsU/i2EMBI9Qrpk6sDoc14fJsXROwv7ItkBjfdcs1IA=; b=lvLXP0PvtHSh1/YKxIPnIzyF43aiZ0ANN9DEv6SDUruRu6gHZvj5W/QCuva1LezM9M PQndziGdfFvpurMeiDHf5NjI1gaTPOKsKF5RjbA2nl29e1RSFb4WcjXpN6QT3UiYI74L ueH8cVdqrC5i+lS2StPdelf/t63VtB43u4YRHZRB+Fh43qa/91Q/KYF0Nl1+GZ4x5KMl 7n56M2ZNbKIf6tMRCzj7o0pxH1fTXeg8kIjkGDxZahnlJBZ9LozP4IUqWnP/hof+IfjX pXqHE1ZkNTOD/iPqH2mGDKWX6FnBZDAmSJpAIs1rts7blb0mgRaWfovNPR8DT62i/bhu wz9Q== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de 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=JsU/i2EMBI9Qrpk6sDoc14fJsXROwv7ItkBjfdcs1IA=; b=djwbVpDylCYND0jkgLqBUT4yqrglP65CvZFJSh1kgyBpUaAWSAYuIBMSWQFQTvTpbr bMiEagjhCbrPNd5rBP/1ASGvM0al8G6XAaUIHshBSi6jlGXhO9IgOYf4JQD73IoKXbxb TMWsUl7+HIFnQP7OulYksEb9VMBkaJPrsDa4xQ8hlDKSaFgQDc3Z6oL/KNGtvNNwyu+g LaRb8iTV/cvb6AOsVIqpX46Teh5Qvzey4JXaeRSqsuNi4whh4GbZiwqtQHiekkJqNdRs qpczA2+mMC/w0O3djs5Y/cYyKpyqwjhDpbXuVxyb0fIW2URug6BXAw0qjQULKThYyMzh 5NhA== 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=JsU/i2EMBI9Qrpk6sDoc14fJsXROwv7ItkBjfdcs1IA=; b=g9vwvtsCz08Zaqq5kVsneXF+wjIWDyR0FmNgxHDQtjoWjUogcY8RUTixFimVBkK/+b bfjXkO+8AODeaCRmgylZK+eCdtn+uVu9gMsxhEpL+SAPZOHrJTFelTn4E7m+1DObZ50z hrbJopD0cnEEo2+otVfZ99Yj/mjIWYO48F3YT1qZxOkO91WTNLyExe9cFnxnxvJXF4d0 nY8WZojk+9147bQz7j35U0h0HkKBac2G+ikCYpibhXjxAUBYgdwbQ05ziQsB9ibLRBU6 EviKqcrH//GuT4kQ30N/KTdvC18HPM7KKZ0F4PXzhxN8pcd/x2pcErcsjL/qyCcs/zmL 1cZw== Sender: swupdate@googlegroups.com X-Gm-Message-State: APjAAAXJZowmpNTqMeb0IHpWtrNdsnzlDs9cpS9vxjPIFDfnjEYOMmgH bS5R/3qDVO2+CXoPmb0OsCs= X-Google-Smtp-Source: APXvYqyKUlztEnHN4kSu4BuZfkgWJWf3gzhZAG7fnacF+q3aNFmhb87a+adibnZW491jBHzb7BOPRw== X-Received: by 2002:adf:cd83:: with SMTP id q3mr38639843wrj.228.1554124521122; Mon, 01 Apr 2019 06:15:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:600c:9:: with SMTP id g9ls1285369wmc.7.gmail; Mon, 01 Apr 2019 06:15:20 -0700 (PDT) X-Received: by 2002:a7b:cd86:: with SMTP id y6mr1272575wmj.24.1554124520311; Mon, 01 Apr 2019 06:15:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554124520; cv=none; d=google.com; s=arc-20160816; b=hNoUnLEC/UX5MkGFDEhttJ1BLifywDWXVSxUKPOSlRxzFOK25Kfo91XtTDkRY54ijD SMkxABx42p1ZY6qPnLtgOeqxoaWyoYkx2K6FJsKyWvNbfvndrjOMAd+9mm8I6gZW1X8Z 1NkmBhIKSt9MjkVAIS7aXNcO3bRLtgwBL/8uUxWh5rJA9sytCi0lG7G6Iy53Fxh3ztk3 LRojUcoScxXgw0pxXxHd2G3DMQk2QihR4wquX0CU4Yir5K8O3KVXcpuJxFaBmysh0fRZ Yfo5l4q5UCPvm9AGOOfi2ZuEh4yN9lQF+cpLD43rZPo0tEGIgR/ud/lDOC31aXj1Ug7s 7iMg== 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=diXg6JxMnLlMgQsDydTP3+ILhNItrPaZrfm15YpET7I=; b=cs8d9nJrZ/Wa0gjeF4JHmU3GcKIi1bI8SatksurCQdoE+ZCEj25H0xm/1lrImjsV50 OP+KwNS08l+j5QJnMxi2sFC3T/V51IptK+4mYggaDIP7btdY9ZIQOpev5dkgOrdcXlmC mAni7bkCq9wgQpfKYZop1eYcBXIhT9UAsh94FGGYI2nIXKoeYn7ABSzqFviCipgcAzKK SAmAis2mBoeZNs/xcRlVkgrDxAZQYEBcpisa1nchyunEhlL15iplhiudyLtC4e8DeS06 tOZqMVRSFzRPFoc6fcF46cfrZdrlmhGEaByUAbwpzrdhK7lCFL83Khy5TmmDUbYS1Oc0 aiFA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.10]) by gmr-mx.google.com with ESMTPS id u6si480597wrw.2.2019.04.01.06.15.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 06:15:20 -0700 (PDT) Received-SPF: neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.10; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 44XtB00vBFz1rTnh; Mon, 1 Apr 2019 15:15:20 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 44XtB00cg4z1qr5R; Mon, 1 Apr 2019 15:15:20 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id j45cw0_YlPBz; Mon, 1 Apr 2019 15:15:17 +0200 (CEST) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Mon, 1 Apr 2019 15:15:17 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id F0C99454040B; Mon, 1 Apr 2019 15:15:16 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([IPv6:::1]) by localhost (mail.babic.homelinux.org [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id cBmx_B64rsrY; Mon, 1 Apr 2019 15:15:14 +0200 (CEST) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id E825C454037E; Mon, 1 Apr 2019 15:15:13 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH] doc: move yocto build and add doc for libubootenv Date: Mon, 1 Apr 2019 15:15:11 +0200 Message-Id: <20190401131511.10135-1-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de 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: , Move how to build in OE to the corresponding chapter. Add documentation regarding libubootenv. Signed-off-by: Stefano Babic --- doc/source/building-with-yocto.rst | 58 +++++++++++++++++++++++++++++- doc/source/swupdate.rst | 47 +----------------------- 2 files changed, 58 insertions(+), 47 deletions(-) diff --git a/doc/source/building-with-yocto.rst b/doc/source/building-with-yocto.rst index b20698b..b7a9f82 100644 --- a/doc/source/building-with-yocto.rst +++ b/doc/source/building-with-yocto.rst @@ -14,9 +14,63 @@ software for embedded systems. Add-on features can be added using *layers*. meta-swupdate_ is the layer to cross-compile the SWUpdate application and to generate the compound SWU images -containing the release of the product. As described in Yocto's documentation +containing the release of the product. It contains the required changes +for mtd-utils and for generating Lua. Using meta-SWUpdate is a +straightforward process. As described in Yocto's documentation about layers, you should include it in your *bblayers.conf* file to use it. +Add meta-SWUpdate as usual to your bblayers.conf. You have also +to add meta-oe to the list. + +In meta-SWUpdate there is a recipe to generate an initrd with a +rescue system with SWUpdate. Use: + +:: + + MACHINE= bitbake swupdate-image + +You will find the result in your tmp/deploy/ directory. +How to install and start an initrd is very target specific - please +check in the documentation of your bootloader. + +What about libubootenv ? +======================== + +This is a common issue when SWUpdate is built. SWUpdate depends on this library, +that is generated from the U-Boot's sources. This library allows to safe modify +the U-Boot environment. It is not required if U-Boot is not used as bootloader. +If SWUpdate cannot be linked, you are using an old version of U-Boot (you need +at least 2016.05). If this is the case, you can add your own recipe for +the package u-boot-fw-utils, adding the code for the library. + +It is important that the package u-boot-fw-utils is built with the same +sources of the bootloader and for the same machine. In fact, the target +can have a default environment linked together with U-Boot's code, +and it is not (yet) stored into a storage. SWUpdate should be aware of +it, because it cannot read it: the default environment must be linked +as well to SWUpdate's code. This is done inside the libubootenv. + +If you build for a different machine, SWUpdate will destroy the +environment when it tries to change it the first time. In fact, +a wrong default environment is taken, and your board won't boot again. + +To avoid possible mismatch, a new library was developped to be hardware independent. +A strict match with the bootloader is not required anymore. The meta-swupdate layer +contains recipes to build the new library (`libubootenv`) and adjust SWUpdate to be linked +against it. To use it as replacement for u-boot-fw-utils: + + - set PREFERRED_PROVIDER_u-boot-fw-utils = "libuboot" + - add to SWUpdate config: + +:: + + CONFIG_UBOOT=y + CONFIG_UBOOT_NEWAPI=y + +With this library, you can simply pass the default environment as file (u-boot-initial-env). +It is recommended for new project to switch to the new library to become independent from +the bootloader. + The swupdate class ================== @@ -131,3 +185,5 @@ Template for recipe using the class SWUPDATE_IMAGES_FSTYPES[uImage] = ".bin" inherit swupdate + + diff --git a/doc/source/swupdate.rst b/doc/source/swupdate.rst index 8d664b7..1ff08ef 100644 --- a/doc/source/swupdate.rst +++ b/doc/source/swupdate.rst @@ -227,52 +227,7 @@ and drop what you do not need. Building with Yocto ------------------- -A meta-swupdate_ layer is provided. It contains the required changes -for mtd-utils and for generating Lua. Using meta-SWUpdate is a -straightforward process. - -Firstly, clone meta-SWUpdate. - -:: - - git clone https://github.com/sbabic/meta-swupdate.git - -.. _meta-SWUpdate: https://github.com/sbabic/meta-swupdate.git - -Add meta-SWUpdate as usual to your bblayers.conf. You have also -to add meta-oe to the list. - -In meta-SWUpdate there is a recipe to generate an initrd with a -rescue system with SWUpdate. Use: - -:: - - MACHINE= bitbake swupdate-image - -You will find the result in your tmp/deploy/ directory. -How to install and start an initrd is very target specific - please -check in the documentation of your bootloader. - -What about libubootenv ? ------------------------- - -This is a common issue when SWUpdate is built. SWUpdate depends on this library, -that is generated from the U-Boot's sources. This library allows to safe modify -the U-Boot environment. It is not required if U-Boot is not used as bootloader. -If SWUpdate cannot be linked, you are using an old version of U-Boot (you need -at least 2016.05). If this is the case, you can add your own recipe for -the package u-boot-fw-utils, adding the code for the library. - -It is important that the package u-boot-fw-utils is built with the same -sources of the bootloader and for the same machine. In fact, the target -can have a default environment linked together with U-Boot's code, -and it is not (yet) stored into a storage. SWUpdate should be aware of -it, because it cannot read it: the default environment must be linked -as well to SWUpdate's code. This is done inside the libubootenv. - -If you build for a different machine, SWUpdate will destroy the -environment when it tries to change it the first time. In fact, -a wrong default environment is taken, and your board won't boot again. +See corresponding chapter how to build in Yocto. Configuring SWUpdate --------------------