Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A31F9C433F5 for ; Mon, 10 Oct 2022 08:38:23 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A338484E28; Mon, 10 Oct 2022 10:38:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=eurek.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id C935E84E2A; Mon, 10 Oct 2022 10:38:17 +0200 (CEST) Received: from submit-2.e-mind.com (submit-2.e-mind.com [188.94.192.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 084E584E26 for ; Mon, 10 Oct 2022 10:38:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=eurek.it Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=gianlucarenzi@eurek.it Received: from localhost (unknown [127.0.0.1]) by submit-2.e-mind.com (Postfix) with ESMTP id 8C8168453A2 for ; Mon, 10 Oct 2022 08:38:15 +0000 (UTC) Received: from submit-2.e-mind.com ([127.0.0.1]) by localhost (submit-2.e-mind.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S_9L3gx-WXfh for ; Mon, 10 Oct 2022 10:38:15 +0200 (CEST) Received: from qmail.e-mind.com (qmail34.e-mind.com [188.94.192.34]) by submit-2.e-mind.com (Postfix) with SMTP id 7403D845040 for ; Mon, 10 Oct 2022 10:38:15 +0200 (CEST) Received: (qmail 22148 invoked by uid 0); 10 Oct 2022 08:38:15 -0000 Received: from unknown (HELO mailproxy-2.e-mind.com) (192.168.102.11) by 0 with SMTP; 10 Oct 2022 08:38:15 -0000 Message-ID: Date: Mon, 10 Oct 2022 10:38:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: Multiple kernels and boot partitions selection Content-Language: en-US To: Quentin Schulz , u-boot@lists.denx.de References: <7ccb6800-6d7b-cab8-ed75-ce0f5ef79a63@eurek.it> <31f35f18-40fd-bfcd-7e1e-7a7ce62731ee@theobroma-systems.com> From: gianluca In-Reply-To: <31f35f18-40fd-bfcd-7e1e-7a7ce62731ee@theobroma-systems.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On 10/10/22 10:06, Quentin Schulz wrote: > Hi Gianluca, > > On 10/10/22 09:06, gianluca wrote: >> Hello, >> I was wondering if there is/are some standard way(s) to achieve a >> multiple boot selection on u-boot startup. >> >> Let's say I have a bunch of partitions: >> >> 1- /dev/mmcblk0p7 with Debian 11 Bullseye >> >> 2- /dev/mmcblk0p5 with Debian 10 Buster >> >> All of these partitions have the /boot/uImage kernel images, the >> /lib/modules/$(uname -r) drivers folders and /boot/dtb device-trees >> into their partition section. >> >> u-boot has NOT the specific environment partition, i.e. it is located >> in the end of bootloader itself up to the maximum size of the >> bootloader partition. So, to be clear the /dev/mmcblk0p1 contains >> u-boot code & envar space. >> >> If needed I can have a MB85RC64 a 24LC64 FRAM/EEPROM compatible memory >> chip to store information on boot. >> > > You can modify the U-Boot environment from userspace with fw_setenv from > libubootenv (formerly u-boot(-fw)-tools). You can store from there which > partition to use for the next boot in an environment variable. > As far as I know, I suppose I need an extra (let's say FAT) partition with the uboot.env transcoded file. Then, with the u-boot(-fw)-tools I can access them from userspace to change some envar like: from: loadimage=mmc 0:5 ${loadaddr} ${bootfile} to: loadimage=mmc 0:7 ${loadaddr} ${bootfile} > fw_setenv loadimage 'mmc 0:7 ${loadaddr} ${bootfile}' Is it right? Regards -- Eurek s.r.l. | Electronic Engineering | http://www.eurek.it via Celletta 8/B, 40026 Imola, Italy | Phone: +39-(0)542-609120 p.iva 00690621206 - c.f. 04020030377 | Fax: +39-(0)542-609212