From 70a4982d4fd83d18cd1951b2be9f3e7538b8c499 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Jul 2024 09:30:56 +0100 Subject: doc: Add a description for bootmeth_qfw Add documentation for the qfw bootmeth. Fix up the compatible string to drop the 'extlinux' part, which is not relevant to this bootmeth. Signed-off-by: Simon Glass Reviewed-by: Quentin Schulz Reviewed-by: Mattijs Korpershoek --- boot/bootmeth_qfw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot') diff --git a/boot/bootmeth_qfw.c b/boot/bootmeth_qfw.c index dfaa944594e..2f8e00cf350 100644 --- a/boot/bootmeth_qfw.c +++ b/boot/bootmeth_qfw.c @@ -88,7 +88,7 @@ static struct bootmeth_ops qfw_bootmeth_ops = { }; static const struct udevice_id qfw_bootmeth_ids[] = { - { .compatible = "u-boot,qfw-extlinux" }, + { .compatible = "u-boot,qfw-bootmeth" }, { } }; -- cgit v1.3.1 From 95403023cfa890b4e5e7ce7040227e518b2da288 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Jul 2024 09:30:58 +0100 Subject: doc: Add a description for bootmeth_sandbox Add documentation for the sandbox bootmeth. Fix up the compatible string to drop the 'extlinux' part, which is not relevant to this bootmeth. Signed-off-by: Simon Glass Reviewed-by: Quentin Schulz Reviewed-by: Mattijs Korpershoek --- boot/bootmeth_sandbox.c | 2 +- doc/develop/bootstd/index.rst | 1 + doc/develop/bootstd/overview.rst | 1 + doc/develop/bootstd/sandbox.rst | 17 +++++++++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 doc/develop/bootstd/sandbox.rst (limited to 'boot') diff --git a/boot/bootmeth_sandbox.c b/boot/bootmeth_sandbox.c index 0bc8f688e30..26c713bb5f3 100644 --- a/boot/bootmeth_sandbox.c +++ b/boot/bootmeth_sandbox.c @@ -55,7 +55,7 @@ static struct bootmeth_ops sandbox_bootmeth_ops = { }; static const struct udevice_id sandbox_bootmeth_ids[] = { - { .compatible = "u-boot,sandbox-extlinux" }, + { .compatible = "u-boot,sandbox-bootmeth" }, { } }; diff --git a/doc/develop/bootstd/index.rst b/doc/develop/bootstd/index.rst index 69fd3c2d2eb..2c5d2d3fade 100644 --- a/doc/develop/bootstd/index.rst +++ b/doc/develop/bootstd/index.rst @@ -11,3 +11,4 @@ Standard Boot pxelinux qfw cros + sandbox diff --git a/doc/develop/bootstd/overview.rst b/doc/develop/bootstd/overview.rst index de15fa41a1d..20c5d56aad2 100644 --- a/doc/develop/bootstd/overview.rst +++ b/doc/develop/bootstd/overview.rst @@ -425,6 +425,7 @@ Bootmeth drivers are provided for booting from various media: - EFI boot using boot manager - Android bootflow (boot image v4) - :doc:`QFW `: QEMU firmware interface + - :doc:`sandbox ` used only for testing Each driver is controlled by a Kconfig option. If no bootmeth driver is selected by a compatible string in the devicetree, all available bootmeth diff --git a/doc/develop/bootstd/sandbox.rst b/doc/develop/bootstd/sandbox.rst new file mode 100644 index 00000000000..d501518c39a --- /dev/null +++ b/doc/develop/bootstd/sandbox.rst @@ -0,0 +1,17 @@ +.. SPDX-License-Identifier: GPL-2.0+: + +Sandbox Bootmeth +================ + +The sandbox bootmeth is only used for testing. It does not provide any facility +for booting an OS. While sandbox can do all the processing before the actual +boot, it is not connected in this bootmeth. + +When invoked on a bootdev, this bootmeth pretends to find a bootflow and creates +the associated structure. + +When the bootflow is booted, the bootmeth returns `-ENOTSUPP` indicating that it +is not supported. + +The compatible string "u-boot,sandbox-bootmeth" is used for the driver. It is present +if `CONFIG_BOOTMETH_SANDBOX` is enabled. -- cgit v1.3.1 From cfed2219e36946902e3bd57d5c647ab8f10f6397 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Jul 2024 09:30:59 +0100 Subject: bootstd: Tidy up comments on the boothmeth drivers Fix a typo in the comment and add one to the EFI driver too. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt Reviewed-by: Quentin Schulz Reviewed-by: Mattijs Korpershoek --- boot/bootmeth_efi.c | 1 + boot/bootmeth_extlinux.c | 2 +- boot/bootmeth_script.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'boot') diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c index 5a4c125835a..56a6e47f5b2 100644 --- a/boot/bootmeth_efi.c +++ b/boot/bootmeth_efi.c @@ -394,6 +394,7 @@ static const struct udevice_id distro_efi_bootmeth_ids[] = { { } }; +/* Put a number before 'efi' to provide a default ordering */ U_BOOT_DRIVER(bootmeth_4efi) = { .name = "bootmeth_efi", .id = UCLASS_BOOTMETH, diff --git a/boot/bootmeth_extlinux.c b/boot/bootmeth_extlinux.c index 9b55686948f..fbb05ef928e 100644 --- a/boot/bootmeth_extlinux.c +++ b/boot/bootmeth_extlinux.c @@ -183,7 +183,7 @@ static const struct udevice_id extlinux_bootmeth_ids[] = { { } }; -/* Put an number before 'extlinux' to provide a default ordering */ +/* Put a number before 'extlinux' to provide a default ordering */ U_BOOT_DRIVER(bootmeth_1extlinux) = { .name = "bootmeth_extlinux", .id = UCLASS_BOOTMETH, diff --git a/boot/bootmeth_script.c b/boot/bootmeth_script.c index 0e05d28d4d9..24da47c7259 100644 --- a/boot/bootmeth_script.c +++ b/boot/bootmeth_script.c @@ -250,7 +250,7 @@ static const struct udevice_id script_bootmeth_ids[] = { { } }; -/* Put an number before 'script' to provide a default ordering */ +/* Put a number before 'script' to provide a default ordering */ U_BOOT_DRIVER(bootmeth_2script) = { .name = "bootmeth_script", .id = UCLASS_BOOTMETH, -- cgit v1.3.1 From 60b180fdba1bf7bbd6181c1eef804a20fa485427 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Jul 2024 09:31:00 +0100 Subject: bootstd: Correct handling of script from network When reading a script from a network, no block device is available. Update the implementation to support this correctly, avoiding setting environment variables which relate only to block devices. Signed-off-by: Simon Glass Reviewed-by: Mattijs Korpershoek --- boot/bootmeth_script.c | 51 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 20 deletions(-) (limited to 'boot') diff --git a/boot/bootmeth_script.c b/boot/bootmeth_script.c index 24da47c7259..c5cbf18c2e6 100644 --- a/boot/bootmeth_script.c +++ b/boot/bootmeth_script.c @@ -185,31 +185,42 @@ static int script_set_bootflow(struct udevice *dev, struct bootflow *bflow, static int script_boot(struct udevice *dev, struct bootflow *bflow) { - struct blk_desc *desc = dev_get_uclass_plat(bflow->blk); + struct blk_desc *desc; ulong addr; int ret = 0; - if (desc->uclass_id == UCLASS_USB) { - ret = env_set("devtype", "usb"); + if (bflow->blk) { + desc = dev_get_uclass_plat(bflow->blk); + if (desc->uclass_id == UCLASS_USB) { + ret = env_set("devtype", "usb"); + } else { + /* + * If the uclass is AHCI, but the driver is ATA + * (not scsi), set devtype to sata + */ + if (IS_ENABLED(CONFIG_SATA) && + desc->uclass_id == UCLASS_AHCI) + ret = env_set("devtype", "sata"); + else + ret = env_set("devtype", blk_get_devtype(bflow->blk)); + } + if (!ret) + ret = env_set_hex("devnum", desc->devnum); + if (!ret) + ret = env_set_hex("distro_bootpart", bflow->part); + if (!ret) + ret = env_set("prefix", bflow->subdir); + if (!ret && IS_ENABLED(CONFIG_ARCH_SUNXI) && + !strcmp("mmc", blk_get_devtype(bflow->blk))) + ret = env_set_hex("mmc_bootdev", desc->devnum); } else { - /* If the uclass is AHCI, but the driver is ATA - * (not scsi), set devtype to sata - */ - if (IS_ENABLED(CONFIG_SATA) && - desc->uclass_id == UCLASS_AHCI) - ret = env_set("devtype", "sata"); - else - ret = env_set("devtype", blk_get_devtype(bflow->blk)); + const struct udevice *media = dev_get_parent(bflow->dev); + + ret = env_set("devtype", + uclass_get_name(device_get_uclass_id(media))); + if (!ret) + ret = env_set_hex("devnum", dev_seq(media)); } - if (!ret) - ret = env_set_hex("devnum", desc->devnum); - if (!ret) - ret = env_set_hex("distro_bootpart", bflow->part); - if (!ret) - ret = env_set("prefix", bflow->subdir); - if (!ret && IS_ENABLED(CONFIG_ARCH_SUNXI) && - !strcmp("mmc", blk_get_devtype(bflow->blk))) - ret = env_set_hex("mmc_bootdev", desc->devnum); if (ret) return log_msg_ret("env", ret); -- cgit v1.3.1 From 6b387c9396f8df431e58d7e75bbd7ea9fd0043ca Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Jul 2024 09:31:03 +0100 Subject: boot: Correct indentation in efi bootmeth Fix a minor indentation / whitespace problem in a comment. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt Reviewed-by: Quentin Schulz Reviewed-by: Mattijs Korpershoek --- boot/bootmeth_efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot') diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c index 56a6e47f5b2..39232eb2e25 100644 --- a/boot/bootmeth_efi.c +++ b/boot/bootmeth_efi.c @@ -265,7 +265,7 @@ static int distro_efi_read_bootflow_net(struct bootflow *bflow) return log_msg_ret("sz", -EINVAL); bflow->size = size; - /* bootfile should be setup by dhcp*/ + /* bootfile should be setup by dhcp */ bootfile_name = env_get("bootfile"); if (!bootfile_name) return log_msg_ret("bootfile_name", ret); -- cgit v1.3.1