Patchwork [1/1] barebox: Add option of custom environment, and fix PROVIDES

login
register
mail settings
Submitter christian.braunersorensen@prevas.dk
Date Sept. 24, 2013, 7:26 a.m.
Message ID <f93d84cbc30fdcad70bef0456f19522846d4f4ea.1380007519.git.christian.braunersorensen@prevas.dk>
Download mbox | patch
Permalink /patch/277361/
State Superseded
Delegated to: Esben Haabendal
Headers show

Comments

christian.braunersorensen@prevas.dk - Sept. 24, 2013, 7:26 a.m.
From: Christian Sørensen <christian.braunersorensen@prevas.dk>

If environment files are detected (config and init) in SRCDIR, ensure
they are used by setting DEFAULT_ENVIRONMENT_PATH in .config

Additionally, fix provides

Signed-off-by: Christian Sørensen <christian.braunersorensen@prevas.dk>
---
 classes/barebox.oeclass | 11 +++++++++++
 1 file changed, 11 insertions(+)
Esben Haabendal - Sept. 25, 2013, 4:39 p.m.
<christian.braunersorensen@prevas.dk> writes:

> From: Christian Sørensen <christian.braunersorensen@prevas.dk>
>
> If environment files are detected (config and init) in SRCDIR, ensure
> they are used by setting DEFAULT_ENVIRONMENT_PATH in .config
>
> Additionally, fix provides

Please keep unrelated changes in seperate commits.  In this case, I
could easily merge the last part (fix provides), but would like to
discuss the first part (custom env)...

>
> Signed-off-by: Christian Sørensen <christian.braunersorensen@prevas.dk>
> ---
>  classes/barebox.oeclass | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/classes/barebox.oeclass b/classes/barebox.oeclass
> index f7c6ab6..4ce9f9e 100644
> --- a/classes/barebox.oeclass
> +++ b/classes/barebox.oeclass
> @@ -50,6 +50,14 @@ do_configure() {
>  	else
>  		die "No default configuration available"
>  	fi
> +
> +	if [ -f ${SRCDIR}/init ] && [ -f ${SRCDIR}/config ]; then
> +		#Environment files detected. Ensure they are used
> +		mkdir -p ${S}/customenv/bin
> +		cp ${SRCDIR}/init ${S}/customenv/bin/
> +		cp ${SRCDIR}/config ${S}/customenv/
> +		sed -i -e 's/\(CONFIG_DEFAULT_ENVIRONMENT_PATH=\).*/\1"customenv"/' .config
> +	fi
>  }

Could you please generalize this, adding support for adding any kind of
default environment structure, and not hardcoding it to supporting
custom environments looking like this:

   bin/init
   config

and requiring this to be done by adding init and config files in
SRC_URI.

It would be nice to be able to add a dependency on a custom barebox
environment to RDEPENDS (using a USE flag for turning this dependency
on), and then just use this.  The default name for the dependency could
be barebox-env, and the interface for this could be that it should
provide a barebox-env.tar file (or symlink to a file) in the rstage.  It
should be possible to override the 'barebox-env' dependency name (fx. in
cases where multiple barebox environments for same machine is needed).

But it should of-course also be possible to keep the custom environment
directly in the barebox recipe, but in that case, it would still be
necessary to not limit it to a hardcoded structure.

Generally, it should be done in a style simlar to (sort of, at least...)
to the way the USE_barebox_defconfig flag is implemented.

>  
>  do_compile () {
> @@ -75,6 +83,9 @@ PACKAGES = "${PN} ${PN}-elf"
>  FILES_${PN} = "${bootdir}/${BAREBOX_IMAGE_FILENAME}"
>  FILES_${PN}-elf = "${bootdir}/${BAREBOX_IMAGE_BASE}"
>  
> +PROVIDES_${PN} = "barebox"
> +PROVIDES_${PN}-elf = "barebox-elf"
> +

Could you resend this as a separate commit?

>  addtask deploy before build after compile
>  do_deploy[dirs] = "${IMAGE_DEPLOY_DIR} ${S}"
>  REBUILD ?= "1"

/Esben

Patch

diff --git a/classes/barebox.oeclass b/classes/barebox.oeclass
index f7c6ab6..4ce9f9e 100644
--- a/classes/barebox.oeclass
+++ b/classes/barebox.oeclass
@@ -50,6 +50,14 @@  do_configure() {
 	else
 		die "No default configuration available"
 	fi
+
+	if [ -f ${SRCDIR}/init ] && [ -f ${SRCDIR}/config ]; then
+		#Environment files detected. Ensure they are used
+		mkdir -p ${S}/customenv/bin
+		cp ${SRCDIR}/init ${S}/customenv/bin/
+		cp ${SRCDIR}/config ${S}/customenv/
+		sed -i -e 's/\(CONFIG_DEFAULT_ENVIRONMENT_PATH=\).*/\1"customenv"/' .config
+	fi
 }
 
 do_compile () {
@@ -75,6 +83,9 @@  PACKAGES = "${PN} ${PN}-elf"
 FILES_${PN} = "${bootdir}/${BAREBOX_IMAGE_FILENAME}"
 FILES_${PN}-elf = "${bootdir}/${BAREBOX_IMAGE_BASE}"
 
+PROVIDES_${PN} = "barebox"
+PROVIDES_${PN}-elf = "barebox-elf"
+
 addtask deploy before build after compile
 do_deploy[dirs] = "${IMAGE_DEPLOY_DIR} ${S}"
 REBUILD ?= "1"