[PATCH 4/5] commands: create createnv command

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Jun 10 04:56:53 PDT 2025



On 6/2/25 16:50, Sascha Hauer wrote:
> On Mon, Jun 02, 2025 at 03:48:26PM +0200, Ahmad Fatoum wrote:
>> Hi,
>>
>> On 02.06.25 15:28, Sascha Hauer wrote:
>>> We want to move away from describing the barebox environment explicitly
>>> in the device tree and instead motivate usage of GPT partitions for the
>>> envrionment. This patch creates a createnv command to facilitate this.
>>> It creates an environment partition on the specified device and if
>>> necessary also a GPT partition table. In the simplest case a "createnv"
>>> without arguments will create a partition on the device barebox itself
>>> booted from. Both the device and the size of the partition can be
>>> specified on the command line.
>>>
>>> We can't create environment partitions on a device containing a MBR
>>> partition table, so a MBR partitioned device won't be touched.
>>>
>>> As an additional safety net the command will ask the user if altering
>>> the partition table is really desired. This behaviour can be overwritten
>>> by specifying -f on the command line.
>>
>> Could we have saveenv/loadenv nudge the user towards createnv if CMD_CREATENV
>> is enabled?
>>
>> Something along the lines of:
>>
>>   saveenv: no environment was registered
>>   saveenv: run createnv to create an ad-hoc environment
> 
> I was more thinking towards issuing a message like that during startup,
> because by then we know already that we don't have an environment
> partition. The corresponding patch is not yet ready though, so I sent
> without it.
> 
> Do you see any advantages putting the message into the saveenv command?

Both sound good to me.

Thanks,
Ahmad

> 
> Sascha
> 
> 

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list