The default net boot target is suboptimal in that it usually fails for a new board. A better default would be to try booting from the same boot medium, barebox itself was booted from, which so far was only possible via scripts.
This series adds a new way to achieve this through a bootsource alias. `boot bootsource` will then be resolved to e.g. `boot mmc0`, which will walk all partitions in search of bootloader spec entries. In that system, `boot bootsource.1` would be resolved to `boot mmc0.1`. A key aspect of the cdev resolution is that it happens at use time. This makes it easier for dynamic aliases and even allows for having aliases that resolve to multiple cdevs. In the future with EFI support, this same mechanism can be used to identify the correct ESP by its partition type and boot the EFI payload contained within. To make that future easier, the blspec code is reworked for better reuse in future before adding support to boot a specific cdev by name without expecting that device name and cdev name are identical. In addition, I have patches that would follow to make cdev aliases usable from the device tree as well: A barebox,bootsource node for example would resolve to the correct cdev and can thus be used together with barebox state to allow for images that behave identically on SD and eMMC without having to resort to scripting or board code. Ahmad Fatoum (16): boot: change bootentry_register_provider to take struct argument boot: move nfs:// parsing out of bootloader spec code blspec: remove unused blspec_scan_devices blspec: don't export blspec functions blspec: factor out generic parts into bootscan helper common: bootscan: add scan_disk callback blspec: support boot /dev/virtioblkX bootm: associate bootm overrides with struct bootentry boot: split off bootarg API into new bootargs.h header block: add get_rootarg block op into block_device_ops block: fixup rootwait argument when needed by default of: implement stub for of_cdev_find bootsource: implement bootsource_of_cdev_find common: bootdef: add new boot entry provider kconfig: implement IF_ENABLED helper boot: make bootsource the default boot target if enabled arch/arm/boards/protonic-imx6/board.c | 10 +- commands/boot.c | 11 +- common/Kconfig | 25 ++ common/Makefile | 4 +- common/block.c | 27 ++ common/blspec.c | 403 ++++++-------------------- common/boot.c | 144 ++++++++- common/bootargs.c | 12 + common/bootchooser.c | 6 +- common/bootdef.c | 40 +++ common/bootm.c | 9 +- common/bootscan.c | 187 ++++++++++++ common/bootsource.c | 17 ++ common/cdev-alias.c | 79 +++++ drivers/block/efi-block-io.c | 10 +- drivers/mci/mci-core.c | 46 ++- drivers/usb/storage/usb.c | 1 + fs/fs.c | 56 ---- fs/nfs.c | 4 + include/block.h | 7 + include/blspec.h | 29 -- include/boot.h | 26 +- include/bootargs.h | 29 ++ include/bootm-overrides.h | 30 ++ include/bootm.h | 18 -- include/bootscan.h | 34 +++ include/bootsource.h | 1 + include/driver.h | 19 +- include/fs.h | 1 - include/linux/kconfig.h | 6 + include/of.h | 5 + 31 files changed, 814 insertions(+), 482 deletions(-) create mode 100644 common/bootdef.c create mode 100644 common/bootscan.c create mode 100644 common/cdev-alias.c delete mode 100644 include/blspec.h create mode 100644 include/bootargs.h create mode 100644 include/bootm-overrides.h create mode 100644 include/bootscan.h -- 2.39.5