mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [RFC] Build MLO from barebox sources
Date: Thu, 23 Feb 2012 10:54:48 +0100	[thread overview]
Message-ID: <20120223095448.GB28597@pengutronix.de> (raw)
In-Reply-To: <1329982272-6194-1-git-send-email-j.weitzel@phytec.de>

On Thu, Feb 23, 2012 at 08:31:12AM +0100, Jan Weitzel wrote:
> Build MLO in $(BUILDDIR)/barebox_mlo-* with config PTXCONF_BAREBOX_MLO_CONFIG
> Default config is barebox_mlo.config.
> 
> Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
> ---
>  platforms/barebox_mlo.in |   19 +++++++
>  rules/barebox_mlo.make   |  124 ++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 143 insertions(+), 0 deletions(-)
>  create mode 100644 platforms/barebox_mlo.in
>  create mode 100644 rules/barebox_mlo.make
> 
> diff --git a/platforms/barebox_mlo.in b/platforms/barebox_mlo.in
> new file mode 100644
> index 0000000..f1e9c78
> --- /dev/null
> +++ b/platforms/barebox_mlo.in
> @@ -0,0 +1,19 @@
> +## SECTION=bootloader
> +
> +menuconfig BAREBOX_MLO
> +	prompt "barebox mlo                   "
> +	bool
> +	depends on BAREBOX
> +	help
> +	  Build mlo from barebox sources.
> +
> +if BAREBOX_MLO
> +
> +config BAREBOX_MLO_CONFIG
> +	prompt "mlo config file"
> +	string
> +	default "barebox_mlo.config"
> +	help
> +	  This entry specifies the .config file used to compile mlo.
> +
> +endif
> diff --git a/rules/barebox_mlo.make b/rules/barebox_mlo.make
> new file mode 100644
> index 0000000..12e8743
> --- /dev/null
> +++ b/rules/barebox_mlo.make
> @@ -0,0 +1,124 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2012 Jan Weitzel <j.weitzel@phytec.de>
> +#       based on barebox.make
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_BAREBOX_MLO) += barebox_mlo
> +
> +#
> +# Paths and names
> +#
> +BAREBOX_MLO_VERSION	= $(BAREBOX_VERSION)
> +BAREBOX_MLO		= barebox_mlo-$(BAREBOX_MLO_VERSION)
> +BAREBOX_MLO_DIR		= $(BUILDDIR)/$(BAREBOX_MLO)
> +BAREBOX_MLO_SOURCE	= $(BAREBOX_SOURCE)
> +BAREBOX_MLO_LICENSE	:= GPLv2
> +
> +BAREBOX_MLO_CONFIG	:= $(call remove_quotes, $(PTXDIST_PLATFORMCONFIGDIR)/$(PTXCONF_BAREBOX_MLO_CONFIG))
> +
> +# ----------------------------------------------------------------------------
> +# Get
> +# ----------------------------------------------------------------------------
> +$(STATEDIR)/barebox_mlo.get: $(STATEDIR)/barebox.get
> +	@$(call targetinfo)
> +	@$(call touch)

No need for a get stage. The implicit rules and dependencies can handle
multiple packages with the same source.

> +
> +# ----------------------------------------------------------------------------
> +# Extract
> +# ----------------------------------------------------------------------------
> +$(STATEDIR)/barebox_mlo.extract:
> +	@$(call targetinfo)
> +	@$(call clean, $(BAREBOX_MLO_DIR))
> +	@mkdir -p $(BAREBOX_MLO_DIR)
> +	@$(call extract, BAREBOX_MLO)
> +	@$(call patchin, BAREBOX, $(BAREBOX_MLO_DIR))
> +	@$(call touch)

see my other mail.

> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +BAREBOX_MLO_PATH	:= PATH=$(CROSS_PATH)

not needed.

> +BAREBOX_MLO_ENV 	:= KCONFIG_NOTIMESTAMP=1

BAREBOX_MLO_CONF_ENV

> +BAREBOX_MLO_MAKEVARS := \
> +	HOSTCC=$(HOSTCC) \
> +	ARCH=$(PTXCONF_BAREBOX_ARCH_STRING) \
> +	CROSS_COMPILE=$(BOOTLOADER_CROSS_COMPILE)

use BAREBOX_MLO_CONF_OPT here.

> +$(STATEDIR)/barebox_mlo.prepare: $(BAREBOX_MLO_CONFIG)
> +	@$(call targetinfo)
> +
> +	@echo "Using barebox_mlo config file: $(BAREBOX_MLO_CONFIG)"
> +	@install -m 644 $(BAREBOX_MLO_CONFIG) $(BAREBOX_MLO_DIR)/.config
> +
> +	@$(call ptx/oldconfig, BAREBOX_MLO)
> +
> +	@$(call touch)

Please try removing the prepare stage. There is a default oldconfig prepare
stage that is used if <PKG>_CONF_TOOL=kconfig or <PKG>_CONFIG is set.

> +
> +# ----------------------------------------------------------------------------
> +# Compile
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/barebox_mlo.compile:
> +	@$(call targetinfo)
> +	cd $(BAREBOX_MLO_DIR) && $(BAREBOX_MLO_PATH) $(MAKE) $(BAREBOX_MLO_MAKEVARS)
> +	@$(call touch)

The default stage should do the right thing here too. Maybe with

BAREBOX_MLO_MAKE_OPT := $(BAREBOX_MLO_CONF_OPT)

> +
> +# ----------------------------------------------------------------------------
> +# Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/barebox_mlo.install:
> +	@$(call targetinfo)
> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/barebox_mlo.targetinstall:
> +	@$(call targetinfo)
> +#barebox renamed barebox.bin.ift to MLO, so fall back to barebox.bin.ift

#	# comment

> +	@if test -e $(BAREBOX_MLO_DIR)/MLO; then \
> +		install -D -m644 $(BAREBOX_MLO_DIR)/MLO $(IMAGEDIR)/MLO ; \
> +	else \
> +		install -D -m644 $(BAREBOX_MLO_DIR)/barebox.bin.ift $(IMAGEDIR)/MLO ; \
> +	fi

	@ptxd_get_path "$(BAREBOX_MLO_DIR)/MLO" \
		"$(BAREBOX_MLO_DIR)/barebox.bin.ift" && \
	install -D -m644 "${ptxd_reply}" "$(IMAGEDIR)/MLO"

> +
> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Clean
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/barebox_mlo.clean:
> +	@$(call targetinfo)
> +	@$(call clean_pkg, BAREBOX_MLO)
> +	rm -rf $(IMAGEDIR)/MLO
> +
> +# ----------------------------------------------------------------------------
> +# oldconfig / menuconfig
> +# ----------------------------------------------------------------------------
> +
> +barebox_mlo_oldconfig barebox_mlo_menuconfig: $(STATEDIR)/barebox_mlo.extract
> +	@if test -e $(BAREBOX_MLO_CONFIG); then \
> +		cp $(BAREBOX_MLO_CONFIG) $(BAREBOX_MLO_DIR)/.config; \
> +	fi
> +	cd $(BAREBOX_MLO_DIR) && \
> +		$(BAREBOX_MLO_PATH) $(BAREBOX_MLO_ENV) $(MAKE) $(BAREBOX_MLO_MAKEVARS) $(subst barebox_mlo_,,$@)
> +	@if cmp -s $(BAREBOX_MLO_DIR)/.config $(BAREBOX_MLO_CONFIG); then \
> +		echo "barebox_mlo configuration unchanged"; \
> +	else \
> +		cp $(BAREBOX_MLO_DIR)/.config $(BAREBOX_MLO_CONFIG); \
> +	fi

At some point I'll find a way to make this generic...

Michael

> +
> +# vim: syntax=make
> -- 
> 1.7.0.4
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

  parent reply	other threads:[~2012-02-23  9:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-21 13:54 [ptxdist] MLO Jan Weitzel
2012-02-21 15:09 ` Michael Olbrich
2012-02-21 15:25   ` Jan Weitzel
2012-02-21 16:47     ` Michael Olbrich
2012-02-23  7:31       ` [ptxdist] [RFC] Build MLO from barebox sources Jan Weitzel
2012-02-23  7:47         ` Jan Weitzel
2012-02-23  9:40           ` Michael Olbrich
2012-02-23 16:46             ` Jan Weitzel
2012-02-23  9:54         ` Michael Olbrich [this message]
2012-02-23 16:40           ` [ptxdist] [PATCH] " Jan Weitzel
2012-03-08 13:23             ` Michael Olbrich
2012-03-09 10:02               ` Jan Weitzel
2012-03-09 10:03                 ` [ptxdist] [PATCH] barebox_mlo: fix resolving BAREBOX_MLO_ Jan Weitzel
2012-03-09 12:47                 ` [ptxdist] [PATCH] Build MLO from barebox sources Michael Olbrich
2012-03-09 14:23                   ` Jan Weitzel
2012-03-09 14:40                     ` Michael Olbrich
2012-03-14 13:15                       ` Jan Weitzel
2012-03-14 14:31                         ` Michael Olbrich
2012-03-15  8:27                           ` Jan Weitzel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120223095448.GB28597@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox