Skip to contentSkip to conversation

Add x-loader bootloader

PATCH New Philippe Reynes 2 participants 2 messages Apr 13, 2011 – Apr 19, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add x-loader bootloader

---
 boot/Config.in            |    1 +
 boot/x-loader/Config.in   |   13 +++++++++++++
 boot/x-loader/x-loader.mk |   37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+), 0 deletions(-)
 create mode 100644 boot/x-loader/Config.in
 create mode 100644 boot/x-loader/x-loader.mk
boot/Config.in +1 -0
index 6bcc98a..a7052b4 100644
@@ -7,6 +7,7 @@ source "boot/syslinux/Config.in"
 source "boot/u-boot/Config.in"
 source "boot/at91bootstrap/Config.in"
 source "boot/at91dataflashboot/Config.in"
+source "boot/x-loader/Config.in"
 
 endmenu
 
boot/x-loader/Config.in new file +13 -0
new file mode 100644
index 0000000..4c71d03
@@ -0,0 +1,13 @@
+menuconfig BR2_TARGET_XLOADER
+	bool "X-loader"
+	help
+	  The x-loader bootloader.
+
+if BR2_TARGET_XLOADER
+config BR2_TARGET_XLOADER_BOARDNAME
+	string "x-loader board name"
+	help
+	  One of x-loader supported boards to be built.
+	  This will be suffixed with _config to meet x-loader 
+	  standard naming.  
+endif
boot/x-loader/x-loader.mk new file +37 -0
new file mode 100644
index 0000000..37aaf1d
@@ -0,0 +1,37 @@
+#############################################################
+#
+# x-loader
+#
+#############################################################
+XLOADER_VERSION:=6f3a26101303051e0f91b6213735b68ce804e94e
+XLOADER_SITE:=git://gitorious.org/x-loader/x-loader.git
+XLOADER_BOARD_NAME:=$(call qstrip,$(BR2_TARGET_XLOADER_BOARDNAME))
+
+define XLOADER_BUILD_CMDS
+	$(MAKE) CROSS_COMPILE="$(TARGET_CROSS)" -C $(@D) $(XLOADER_BOARD_NAME)_config
+	$(MAKE) CROSS_COMPILE="$(TARGET_CROSS)" -C $(@D) all
+	$(MAKE) CROSS_COMPILE="$(TARGET_CROSS)" -C $(@D) ift
+endef
+
+define XLOADER_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/MLO $(BINARIES_DIR)/
+endef
+
+$(eval $(call GENTARGETS,boot,xloader))
+
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+ifeq ($(BR2_TARGET_XLOADER),y)
+TARGETS+=xloader
+
+# we NEED a board name unless we're at make source
+ifeq ($(filter source,$(MAKECMDGOALS)),)
+ifeq ($(XLOADER_BOARD_NAME),)
+$(error NO x-loader board name set. Check your BR2_TARGET_XLOADER_BOARDNAME setting)
+endif
+endif
+
+endif
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 Add x-loader bootloader

Hi Philippe,

Great to see such a patch. I really like the fact that you leveraged the package infrastructure to add support for x-loader. Actually, I think we should use the package infrastructure for all bootloaders and for the kernel as well, so that we can easily benefits from improvements made at the package infrastructure level.

boot/x-loader/x-loader.mk line 18

Quoted 3 lines · On Wed, 13 Apr 2011 23:30:08 +0200 Philippe Reynes <[email protected]> wrote:
boot/x-loader/x-loader.mk new file +3 -0
+define XLOADER_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/MLO $(BINARIES_DIR)/
+endef

In order to properly support the kernel and bootloaders as packages, we probably need to implement a <pkg>_INSTALL_IMAGES_CMDS thing, which gets enabled on a per-package basis via a <pkg>_IMAGES_INSTALL = YES value.

The kernel could for examples do :

LINUX_IMAGES_INSTALL = YES

in order to tell that it wants to install the kernel image in $(BINARIES_DIR), and it could also do :

LINUX_TARGET_INSTALL = YES

in order to tell that it wants to install its kernel modules to the target root filesystem. Same thing for U-Boot, which can build the bootloader image, but also some target utilities like fw_printenv/fw_setenv.

boot/x-loader/x-loader.mk line 28

Quoted 2 lines
boot/x-loader/x-loader.mk new file +2 -0
+ifeq ($(BR2_TARGET_XLOADER),y)
+TARGETS+=xloader

That should typically be done by the package infrastructure, but at the moment, the package infrastructure assumes that the option is named BR2_PACKAGE_<something>. We need to figure out to make this a little bit more generic maybe.

Regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com