[PATCH 5/5] commands: dmsetup: Basic command set for dm device management
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Sep 8 11:59:08 PDT 2025
On 08.09.25 11:27, Tobias Waldekranz wrote:
> On fre, sep 05, 2025 at 18:54, Ahmad Fatoum <a.fatoum at pengutronix.de> wrote:
>>> +static struct dm_device *dmsetup_find(const char *name)
>>> +{
>>> + struct dm_device *dm;
>>> +
>>> + dm = dm_find_by_name(name);
>>> + if (IS_ERR_OR_NULL(dm)) {
>>> + pr_err("Found no device named \"%s\"\n", name);
>>
>> pr_/dev_ is logged, so will also be shared with Linux if pstore/ramoops
>> is enabled. For commands, just use printf.
>
> Wow, nice! I will have to look into this more.
The really useful part is saving crash logs from the kernel on next bootup,
but it is highly hardware dependent how survivable a restart is for the RAM's
contents, even with ECC.
Sharing barebox and kernel log in the same boot is no problem however, just add
to the barebox DT:
/ {
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
/* Address will be determined by the bootloader */
ramoops {
compatible = "ramoops";
};
};
};
and enable the relevant options in Kconfig.
>> Nice. FYI, if selftest is too cumbersome once you start adding more
>> targets, you can also add tests that exercise commands via pytest. See
>> test/py/.
>
> Right, yes I will read up on this in the future.
>
> Thanks for reviewing!
Cheers,
Ahmad
>
>> Cheers,
>> Ahmad
>>
>>> +
>>> +BAREBOX_CMD_START(dmsetup)
>>> + .cmd = do_dmsetup,
>>> + BAREBOX_CMD_DESC("low level interface to the device mapper")
>>> + BAREBOX_CMD_OPTS("<command> [args...]")
>>> + BAREBOX_CMD_GROUP(CMD_GRP_PART)
>>> + BAREBOX_CMD_HELP(cmd_dmsetup_help)
>>> +BAREBOX_CMD_END
>>
>> --
>> 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 |
>
--
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