Skip to contentSkip to conversation

Add CONFIG_API to config_distribution

U-Boot New Jeroen Hofstee 2 participants 6 messages Aug 9, 2014 – Sep 20, 2014

lore
Share & tools
lore
#0 lore raw

Since the goal of the common include is to boot many distros, also include the api to boot distro's relying on the api, like GRUB / ubldr / vxWorks.

Jeroen Hofstee (2):
api: fix build without CMD_NET support
config_distro_defaults.h: add CONFIG_API

 api/api_net.c                    | 30 ++++++++++++++++++++++++++++++
 include/config_distro_defaults.h |  4 ++++
 2 files changed, 34 insertions(+)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 api: fix build without CMD_NET support

Provide stubs in case that no NET interface is supported.

---
 api/api_net.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
api/api_net.c +30 -0
index 3f52d71..7b3805e 100644
@@ -25,6 +25,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #define errf(fmt, args...) do { printf("ERROR @ %s(): ", __func__); printf(fmt, ##args); } while (0)
 
+#ifdef CONFIG_CMD_NET
 
 static int dev_valid_net(void *cookie)
 {
@@ -85,3 +86,32 @@ int dev_read_net(void *cookie, void *buf, int len)
 
 	return eth_receive(buf, len);
 }
+
+#else
+
+int dev_open_net(void *cookie)
+{
+	return API_ENODEV;
+}
+
+int dev_close_net(void *cookie)
+{
+	return API_ENODEV;
+}
+
+int dev_enum_net(struct device_info *di)
+{
+	return 0;
+}
+
+int dev_write_net(void *cookie, void *buf, int len)
+{
+	return API_ENODEV;
+}
+
+int dev_read_net(void *cookie, void *buf, int len)
+{
+	return API_ENODEV;
+}
+
+#endif
Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/2 api: fix build without CMD_NET support

Quoted 3 lines · Jeroen Hofstee

Provide stubs in case that no NET interface is supported.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140823/ead38a70/attachment.pgp>
#3 lore raw

PATCH 2/2 config_distro_defaults.h: add CONFIG_API

In reply to Jeroen Hofstee

Grub, FreeBSD ubldr, vxworks etc depend on the API

---
 include/config_distro_defaults.h | 4 ++++
 1 file changed, 4 insertions(+)
include/config_distro_defaults.h +4 -0
index 5d18a4b..b4f6f3c 100644
@@ -53,4 +53,8 @@
 #define CONFIG_SUPPORT_RAW_INITRD
 #define CONFIG_SYS_HUSH_PARSER
 
+/* Grub, FreeBSD ubldr, vxworks etc depend on the API */
+#define CONFIG_API
+#define CONFIG_SYS_MMC_MAX_DEVICE	4
+
 #endif	/* _CONFIG_CMD_DISTRO_DEFAULTS_H */
Signature · 1 line
1.9.1
#4 lore raw

PATCH 2/2 config_distro_defaults.h: add CONFIG_API

Quoted 3 lines · Jeroen Hofstee

Grub, FreeBSD ubldr, vxworks etc depend on the API

So I'm not 100% sold on this. A while back (it's in the archives) we had said no to CONFIG_API. Grub wasn't a good use-case (esp since we're handling extlinux.conf files), VxWorks is bootm/bootelf.

I am open to hearing how/why we need this for ubldr.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140823/6188a4f8/attachment.pgp>
#5 lore raw

PATCH 2/2 config_distro_defaults.h: add CONFIG_API

Hello Tom,

Quoted 5 lines · Tom Rini
Quoted 3 lines · Jeroen Hofstee

Grub, FreeBSD ubldr, vxworks etc depend on the API

ok, lets start with I hope what I hope config_distro_defaults is. At the moment, if you buy a demo board and try to run a custom image on it, chances are big it won't boot. Either because it searches for a wrong file, commands are not supported, they have different syntax, different image formats etc. It is not uncommon that I need to update u-boot before I can run a simple custom image. It would of course be a lot better if you can stick an image in a demo board, which actually boots and even better optionally ask you what to boot. And I am in the impression / hope config_distro_defaults is for that purpose. Not the smallest / fastest u-boot, but one which can actually boot different distro's, images, demos etc. (or at least an attempt to do so). For completeness, this already holds for linux distro's / images / buildtools.

The typical bootpath for FreeBSD images is:

[something] -> loader[1] -> FreeBSD

In case of u-boot "something" is u-boot and loader is ubldr (which is loader to talk with u-boot by its API). It would be nice if this just worked without modifying u-boot, as the image might be in nand etc.

Quoted 2 lines

So I'm not 100% sold on this. A while back (it's in the archives) we had said no to CONFIG_API. Grub wasn't a good use-case

I couldn't find a good reason why grub is not an use-case. (besides some complaining and no-funding)

Quoted 1 line

(esp since we're handling extlinux.conf files),

I am still in the dark with respect to extlinux.conf. There is no documentation nor users for it in u-boot it seems. But even if an FreeBSD boot would use a FreeBSD.conf or similiar it would still need CONFIG_API to work correctly.

Quoted 1 line

VxWorks is bootm/bootelf.

grep said:

/* Boot FreeBSD/vxWorks from an ELF image */
#if defined(CONFIG_ZYNQ_BOOT_FREEBSD)

# define CONFIG_API
# define CONFIG_CMD_ELF
# define CONFIG_SYS_MMC_MAX_DEVICE      1
#endif

hence I assumed it needs the api as well.

Quoted 3 lines

I am open to hearing how/why we need this for ubldr.

ublr depends on a u-boot with CONFIG_API enabled. It won't work otherwise.

[2] contains some background about the boot process from u-boot.

Regards,
Jeroen

[1] https://www.freebsd.org/cgi/man.cgi?loader(8)
[2]
http://www.bsdcan.org/2008/schedule/attachments/49_2008_uboot_freebsd.pdf