Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "João Henrique Ferreira de Freitas" <joaohf@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: Re: [wic][PATCH] wic: Implement --build-rootfs command line option
Date: Wed, 08 Apr 2015 19:18:40 -0300	[thread overview]
Message-ID: <5525A940.5040600@gmail.com> (raw)
In-Reply-To: <1428400661-19372-1-git-send-email-ed.bartosh@linux.intel.com>


Hi Ed,

I liked.

Two points:

- How about if user sets INHERIT = "rm_work"? I mean the image recipe 
will be rm, right? I always put my images in RM_WORK_EXCLUDE so wic can 
use it.

- What will be the behavior if: wic create test-image-4Gb -e test-image 
--rootfs rootfs1=test-image --rootfs rootfs2=bringup-image -f. A 
believed that only 'test-image' will be build. Right?

Thanks.

On 07/04/2015 06:57, Ed Bartosh wrote:
> -f/--build-rootfs option makes wic to run bitbake <image> to
> produce rootfs. This option requires image name to be specified
> with -e/--image-name.
>
> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
> ---
>   scripts/lib/image/help.py | 10 ++++++----
>   scripts/wic               | 25 ++++++++++++++++++++++---
>   2 files changed, 28 insertions(+), 7 deletions(-)
>
> diff --git a/scripts/lib/image/help.py b/scripts/lib/image/help.py
> index e1eb265..e365a07 100644
> --- a/scripts/lib/image/help.py
> +++ b/scripts/lib/image/help.py
> @@ -111,7 +111,7 @@ wic_create_usage = """
>               [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
>               [-e | --image-name] [-s, --skip-build-check] [-D, --debug]
>               [-r, --rootfs-dir] [-b, --bootimg-dir]
> -            [-k, --kernel-dir] [-n, --native-sysroot]
> +            [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs]
>   
>    This command creates an OpenEmbedded image based on the 'OE kickstart
>    commands' found in the <wks file>.
> @@ -132,7 +132,7 @@ SYNOPSIS
>           [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
>           [-e | --image-name] [-s, --skip-build-check] [-D, --debug]
>           [-r, --rootfs-dir] [-b, --bootimg-dir]
> -        [-k, --kernel-dir] [-n, --native-sysroot]
> +        [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs]
>   
>   DESCRIPTION
>       This command creates an OpenEmbedded image based on the 'OE
> @@ -167,6 +167,8 @@ DESCRIPTION
>       The -n option is used to specify the path to the native sysroot
>       containing the tools to use to build the image.
>   
> +    The -f option is used to build rootfs by running "bitbake <image>"
> +
>       The -s option is used to skip the build check.  The build check is
>       a simple sanity check used to determine whether the user has
>       sourced the build environment so that the -e option can operate
> @@ -528,8 +530,8 @@ DESCRIPTION
>          usage: wic create <wks file or image name> [-o <DIRNAME> | ...]
>               [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
>               [-e | --image-name] [-s, --skip-build-check] [-D, --debug]
> -            [-r, --rootfs-dir] [-b, --bootimg-dir]
> -            [-k, --kernel-dir] [-n, --native-sysroot]
> +            [-r, --rootfs-dir] [-b, --bootimg-dir] [-k, --kernel-dir]
> +            [-n, --native-sysroot] [-f, --build-rootfs]
>   
>          This command creates an OpenEmbedded image based on the 'OE
>          kickstart commands' found in the <wks file>.
> diff --git a/scripts/wic b/scripts/wic
> index e7df60f..feff302 100755
> --- a/scripts/wic
> +++ b/scripts/wic
> @@ -40,11 +40,15 @@ import logging
>   # External modules
>   scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0])))
>   lib_path = scripts_path + '/lib'
> -sys.path = sys.path + [lib_path]
> +bitbake_path = os.path.join(scripts_path, '../bitbake/lib')
> +sys.path = sys.path + [lib_path, bitbake_path]
>   
>   from image.help import *
>   from image.engine import *
>   
> +from bb import cookerdata
> +from bb.main import bitbake_main, BitBakeConfigParameters
> +
>   def rootfs_dir_to_args(krootfs_dir):
>       """
>       Get a rootfs_dir dict and serialize to string
> @@ -94,6 +98,7 @@ def wic_create_subcommand(args, usage_str):
>                         action = "store", help = "path to the native sysroot containing the tools to use to build the image")
>       parser.add_option("-p", "--skip-build-check", dest = "build_check",
>                         action = "store_false", default = True, help = "skip the build check")
> +    parser.add_option("-f", "--build-rootfs", action="store_true", help = "build rootfs")
>       parser.add_option("-D", "--debug", dest = "debug", action = "store_true",
>                         default = False, help = "output debug information")
>   
> @@ -123,8 +128,6 @@ def wic_create_subcommand(args, usage_str):
>           else:
>               print "Done.\n"
>   
> -    print "Creating image(s)...\n"
> -
>       bitbake_env_lines = find_bitbake_env_lines(options.image_name)
>       if not bitbake_env_lines:
>           print "Couldn't get bitbake environment, exiting."
> @@ -134,9 +137,24 @@ def wic_create_subcommand(args, usage_str):
>       bootimg_dir = ""
>   
>       if options.image_name:
> +        if options.build_rootfs:
> +            argv = ["bitbake", options.image_name]
> +            if options.debug:
> +                argv.append("--debug")
> +
> +            print "Building rootfs...\n"
> +            if bitbake_main(BitBakeConfigParameters(argv),
> +                            cookerdata.CookerConfiguration()):
> +                sys.exit(1)
> +
>           (rootfs_dir, kernel_dir, bootimg_dir, native_sysroot) \
>               = find_artifacts(options.image_name)
>   
> +    else:
> +        if options.build_rootfs:
> +            print "Image name is not specified, exiting. (Use -e/--image-name to specify it)\n"
> +            sys.exit(1)
> +
>       wks_file = args[0]
>   
>       if not wks_file.endswith(".wks"):
> @@ -194,6 +212,7 @@ def wic_create_subcommand(args, usage_str):
>   
>       rootfs_dir = rootfs_dir_to_args(krootfs_dir)
>   
> +    print "Creating image(s)...\n"
>       wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir,
>                  native_sysroot, scripts_path, image_output_dir,
>                  options.debug, options.properties_file)



  reply	other threads:[~2015-04-08 22:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07  9:57 [wic][PATCH] wic: Implement --build-rootfs command line option Ed Bartosh
2015-04-08 22:18 ` João Henrique Ferreira de Freitas [this message]
2015-04-09 19:12   ` Ed Bartosh
2015-04-09 22:24     ` João Henrique Ferreira de Freitas
2015-04-10  9:16       ` Ed Bartosh
  -- strict thread matches above, loose matches on Subject: below --
2015-04-20 16:13 Adrian Freihofer
2015-04-21 12:39 ` Ed Bartosh

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=5525A940.5040600@gmail.com \
    --to=joaohf@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /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