All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm-autonomy/xenguest-mkimage: add extra ramdisk support
@ 2020-10-14 11:54 Kamil Dziezyk
  2020-10-14 12:02 ` Diego Sueiro
  0 siblings, 1 reply; 3+ messages in thread
From: Kamil Dziezyk @ 2020-10-14 11:54 UTC (permalink / raw)
  To: meta-arm; +Cc: nd, Kamil Dziezyk

Some guest images requires a ramdisk, that is built with a custom recipe.
This patch adds an option '--xen-ramdisk',
for xenguest-mkimage script to cover that.
Extra ramdisk support is also added to xenguest-image-extra bbclass,
via 'XENGUEST_EXTRA_RAMDISK' variable.

Issue-Id: SCM-1276
Change-Id: I8ec74a37c0c96ca83a3489911186f3b3262f80fd
Signed-off-by: Kamil Dziezyk <kamil.dziezyk@arm.com>
---
 .../classes/xenguest-image-extra.bbclass        | 12 ++++++++++++
 .../documentation/xenguest-mkimage.md           |  2 ++
 .../xenguest/files/xenguest-mkimage             | 17 +++++++++++++++++
 3 files changed, 31 insertions(+)

diff --git a/meta-arm-autonomy/classes/xenguest-image-extra.bbclass b/meta-arm-autonomy/classes/xenguest-image-extra.bbclass
index 502a083..533b973 100644
--- a/meta-arm-autonomy/classes/xenguest-image-extra.bbclass
+++ b/meta-arm-autonomy/classes/xenguest-image-extra.bbclass
@@ -12,6 +12,11 @@ inherit xenguest-image
 # recipes, the last recipe setting it will prevail.
 XENGUEST_EXTRA_DTB ??= ""
 
+# Add a ramdisk file for the guest
+# Only one file should be added, if this is set multiple times or in several
+# recipes, the last recipe setting it will prevail.
+XENGUEST_EXTRA_RAMDISK ??= ""
+
 # Append something to the guest xen configuration
 # All files here will be merged together in the final xen configuration
 # This can contain several files or be used in several recipes
@@ -49,6 +54,13 @@ do_deploy_append() {
         call_xenguest_mkimage partial --xen-device-tree=${XENGUEST_EXTRA_DTB}
     fi
 
+    if [ -n "${XENGUEST_EXTRA_RAMDISK}" ]; then
+        if [ ! -f ${XENGUEST_EXTRA_RAMDISK} ]; then
+            die "xenguest-image: DTB file ${XENGUEST_EXTRA_RAMDISK} does not exist"
+        fi
+        call_xenguest_mkimage partial --xen-ramdisk=${XENGUEST_EXTRA_RAMDISK}
+    fi
+
     if [ -n "${XENGUEST_EXTRA_XENCONFIG}" ]; then
         for f in ${XENGUEST_EXTRA_XENCONFIG}; do
             if [ ! -f $f ]; then
diff --git a/meta-arm-autonomy/documentation/xenguest-mkimage.md b/meta-arm-autonomy/documentation/xenguest-mkimage.md
index 3dcc28b..ece17f7 100644
--- a/meta-arm-autonomy/documentation/xenguest-mkimage.md
+++ b/meta-arm-autonomy/documentation/xenguest-mkimage.md
@@ -99,6 +99,8 @@ For a detailed help on available operations, please use:
   times to add several command line options.
 - --xen-device-tree=FILE: add dtb FILE as device tree. This both adding the
   file to the image and modifying the xen configuration to use it.
+- --xen-ramdisk=FILE: add ramdisk FILE as guest ramdisk. This both adding the
+  file to the image and modifying the xen configuration to use it.
 - --init-script=FILE: add guest init script. The script is embedded inside the
   image file. Several script can be added and the basename of FILE is used to
   distinguish them (calling the option twice with the same file will update the
diff --git a/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-mkimage b/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-mkimage
index 4c1b4a8..a3f987a 100755
--- a/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-mkimage
+++ b/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-mkimage
@@ -82,6 +82,9 @@ Xen configuration for the guest
 --xen-device-tree=      disable device tree parameter in xen configuration
 --xen-device-tree=FILE  set guest device tree in xen configuration and add
                          file to xen files
+--xen-ramdisk=          disable ramdisk parameter in xen configuration
+--xen-ramdisk=FILE      set guest ramdisk in xen configuration and add
+                         file to xen files
 --xen-disk=             disable disk parameter in xen configuration
 --xen-disk=DEV          set guest disk to device DEV (phy:DEV,xvda,w is set)
 --xen-append=FILE       append FILE content to xen configuration
@@ -668,6 +671,20 @@ for arg in "${@}"; do
                 install -m 644 ${optarg} ${IMAGE_TMPDIR}/files/guest.dtb
             fi
             ;;
+        --xen-ramdisk=*)
+            if [ -z "${optarg}" ]; then
+                xen_config_disable_param "ramdisk"
+                rm -f ${IMAGE_TMPDIR}/files/ramdisk.img
+            else
+                if [ ! -f ${optarg} ]; then
+                    echo "Error: invalid ramdisk file ${optarg}"
+                    exit 1
+                fi
+                xen_config_set_string "ramdisk" "files/ramdisk.img"
+                mkdir -p ${IMAGE_TMPDIR}/files
+                install -m 644 ${optarg} ${IMAGE_TMPDIR}/files/ramdisk.img
+            fi
+            ;;
         --xen-disk=*)
             if [ -z "${optarg}" ]; then
                 xen_config_disable_param "disk"
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm-autonomy/xenguest-mkimage: add extra ramdisk support
  2020-10-14 11:54 [PATCH] arm-autonomy/xenguest-mkimage: add extra ramdisk support Kamil Dziezyk
@ 2020-10-14 12:02 ` Diego Sueiro
  2020-10-15 16:56   ` [meta-arm] " Jon Mason
  0 siblings, 1 reply; 3+ messages in thread
From: Diego Sueiro @ 2020-10-14 12:02 UTC (permalink / raw)
  To: meta-arm

On Wed, Oct 14, 2020 at 12:55 PM, Kamil Dziezyk wrote:

>
> Some guest images requires a ramdisk, that is built with a custom recipe.
> This patch adds an option '--xen-ramdisk',
> for xenguest-mkimage script to cover that.
> Extra ramdisk support is also added to xenguest-image-extra bbclass,
> via 'XENGUEST_EXTRA_RAMDISK' variable.
> 
> Issue-Id: SCM-1276
> Change-Id: I8ec74a37c0c96ca83a3489911186f3b3262f80fd
> Signed-off-by: Kamil Dziezyk <kamil.dziezyk@arm.com>

Reviewed-by: Diego Sueiro <diego.sueiro@arm.com>

> ---
>  .../classes/xenguest-image-extra.bbclass        | 12 ++++++++++++
>  .../documentation/xenguest-mkimage.md           |  2 ++
>  .../xenguest/files/xenguest-mkimage             | 17 +++++++++++++++++
>  3 files changed, 31 insertions(+)
> 
> diff --git a/meta-arm-autonomy/classes/xenguest-image-extra.bbclass
> b/meta-arm-autonomy/classes/xenguest-image-extra.bbclass
> index 502a083..533b973 100644
> --- a/meta-arm-autonomy/classes/xenguest-image-extra.bbclass
> +++ b/meta-arm-autonomy/classes/xenguest-image-extra.bbclass
> @@ -12,6 +12,11 @@ inherit xenguest-image
>  # recipes, the last recipe setting it will prevail.
>  XENGUEST_EXTRA_DTB ??= ""
>
> +# Add a ramdisk file for the guest
> +# Only one file should be added, if this is set multiple times or in several
> +# recipes, the last recipe setting it will prevail.
> +XENGUEST_EXTRA_RAMDISK ??= ""
> +
>  # Append something to the guest xen configuration
>  # All files here will be merged together in the final xen configuration
>  # This can contain several files or be used in several recipes
> @@ -49,6 +54,13 @@ do_deploy_append() {
>          call_xenguest_mkimage partial --xen-device-tree=${XENGUEST_EXTRA_DTB}
>      fi
>
> +    if [ -n "${XENGUEST_EXTRA_RAMDISK}" ]; then
> +        if [ ! -f ${XENGUEST_EXTRA_RAMDISK} ]; then
> +            die "xenguest-image: DTB file ${XENGUEST_EXTRA_RAMDISK} does not
> exist"
> +        fi
> +        call_xenguest_mkimage partial --xen-ramdisk=${XENGUEST_EXTRA_RAMDISK}
> +    fi
> +
>      if [ -n "${XENGUEST_EXTRA_XENCONFIG}" ]; then
>          for f in ${XENGUEST_EXTRA_XENCONFIG}; do
>              if [ ! -f $f ]; then
> diff --git a/meta-arm-autonomy/documentation/xenguest-mkimage.md
> b/meta-arm-autonomy/documentation/xenguest-mkimage.md
> index 3dcc28b..ece17f7 100644
> --- a/meta-arm-autonomy/documentation/xenguest-mkimage.md
> +++ b/meta-arm-autonomy/documentation/xenguest-mkimage.md
> @@ -99,6 +99,8 @@ For a detailed help on available operations, please use:
>    times to add several command line options.
>  - --xen-device-tree=FILE: add dtb FILE as device tree. This both adding the
>    file to the image and modifying the xen configuration to use it.
> +- --xen-ramdisk=FILE: add ramdisk FILE as guest ramdisk. This both adding the
> +  file to the image and modifying the xen configuration to use it.
>  - --init-script=FILE: add guest init script. The script is embedded inside
> the
>    image file. Several script can be added and the basename of FILE is used to
>    distinguish them (calling the option twice with the same file will update
> the
> diff --git
> a/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-mkimage
> b/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-mkimage
> index 4c1b4a8..a3f987a 100755
> --- a/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-mkimage
> +++ b/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-mkimage
> @@ -82,6 +82,9 @@ Xen configuration for the guest
>  --xen-device-tree=      disable device tree parameter in xen configuration
>  --xen-device-tree=FILE  set guest device tree in xen configuration and add
>                           file to xen files
> +--xen-ramdisk=          disable ramdisk parameter in xen configuration
> +--xen-ramdisk=FILE      set guest ramdisk in xen configuration and add
> +                         file to xen files
>  --xen-disk=             disable disk parameter in xen configuration
>  --xen-disk=DEV          set guest disk to device DEV (phy:DEV,xvda,w is set)
>  --xen-append=FILE       append FILE content to xen configuration
> @@ -668,6 +671,20 @@ for arg in "${@}"; do
>                  install -m 644 ${optarg} ${IMAGE_TMPDIR}/files/guest.dtb
>              fi
>              ;;
> +        --xen-ramdisk=*)
> +            if [ -z "${optarg}" ]; then
> +                xen_config_disable_param "ramdisk"
> +                rm -f ${IMAGE_TMPDIR}/files/ramdisk.img
> +            else
> +                if [ ! -f ${optarg} ]; then
> +                    echo "Error: invalid ramdisk file ${optarg}"
> +                    exit 1
> +                fi
> +                xen_config_set_string "ramdisk" "files/ramdisk.img"
> +                mkdir -p ${IMAGE_TMPDIR}/files
> +                install -m 644 ${optarg} ${IMAGE_TMPDIR}/files/ramdisk.img
> +            fi
> +            ;;
>          --xen-disk=*)
>              if [ -z "${optarg}" ]; then
>                  xen_config_disable_param "disk"
> -- 
> 2.17.1
> 
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [meta-arm] [PATCH] arm-autonomy/xenguest-mkimage: add extra ramdisk support
  2020-10-14 12:02 ` Diego Sueiro
@ 2020-10-15 16:56   ` Jon Mason
  0 siblings, 0 replies; 3+ messages in thread
From: Jon Mason @ 2020-10-15 16:56 UTC (permalink / raw)
  To: Diego Sueiro; +Cc: meta-arm

On Wed, Oct 14, 2020 at 05:02:45AM -0700, Diego Sueiro wrote:
> On Wed, Oct 14, 2020 at 12:55 PM, Kamil Dziezyk wrote:
> 
> >
> > Some guest images requires a ramdisk, that is built with a custom recipe.
> > This patch adds an option '--xen-ramdisk',
> > for xenguest-mkimage script to cover that.
> > Extra ramdisk support is also added to xenguest-image-extra bbclass,
> > via 'XENGUEST_EXTRA_RAMDISK' variable.
> > 
> > Issue-Id: SCM-1276
> > Change-Id: I8ec74a37c0c96ca83a3489911186f3b3262f80fd
> > Signed-off-by: Kamil Dziezyk <kamil.dziezyk@arm.com>
> 
> Reviewed-by: Diego Sueiro <diego.sueiro@arm.com>

Pulled into master.

Thanks,
Jon

> 
> > ---
> >  .../classes/xenguest-image-extra.bbclass        | 12 ++++++++++++
> >  .../documentation/xenguest-mkimage.md           |  2 ++
> >  .../xenguest/files/xenguest-mkimage             | 17 +++++++++++++++++
> >  3 files changed, 31 insertions(+)
> > 
> > diff --git a/meta-arm-autonomy/classes/xenguest-image-extra.bbclass
> > b/meta-arm-autonomy/classes/xenguest-image-extra.bbclass
> > index 502a083..533b973 100644
> > --- a/meta-arm-autonomy/classes/xenguest-image-extra.bbclass
> > +++ b/meta-arm-autonomy/classes/xenguest-image-extra.bbclass
> > @@ -12,6 +12,11 @@ inherit xenguest-image
> >  # recipes, the last recipe setting it will prevail.
> >  XENGUEST_EXTRA_DTB ??= ""
> >
> > +# Add a ramdisk file for the guest
> > +# Only one file should be added, if this is set multiple times or in several
> > +# recipes, the last recipe setting it will prevail.
> > +XENGUEST_EXTRA_RAMDISK ??= ""
> > +
> >  # Append something to the guest xen configuration
> >  # All files here will be merged together in the final xen configuration
> >  # This can contain several files or be used in several recipes
> > @@ -49,6 +54,13 @@ do_deploy_append() {
> >          call_xenguest_mkimage partial --xen-device-tree=${XENGUEST_EXTRA_DTB}
> >      fi
> >
> > +    if [ -n "${XENGUEST_EXTRA_RAMDISK}" ]; then
> > +        if [ ! -f ${XENGUEST_EXTRA_RAMDISK} ]; then
> > +            die "xenguest-image: DTB file ${XENGUEST_EXTRA_RAMDISK} does not
> > exist"
> > +        fi
> > +        call_xenguest_mkimage partial --xen-ramdisk=${XENGUEST_EXTRA_RAMDISK}
> > +    fi
> > +
> >      if [ -n "${XENGUEST_EXTRA_XENCONFIG}" ]; then
> >          for f in ${XENGUEST_EXTRA_XENCONFIG}; do
> >              if [ ! -f $f ]; then
> > diff --git a/meta-arm-autonomy/documentation/xenguest-mkimage.md
> > b/meta-arm-autonomy/documentation/xenguest-mkimage.md
> > index 3dcc28b..ece17f7 100644
> > --- a/meta-arm-autonomy/documentation/xenguest-mkimage.md
> > +++ b/meta-arm-autonomy/documentation/xenguest-mkimage.md
> > @@ -99,6 +99,8 @@ For a detailed help on available operations, please use:
> >    times to add several command line options.
> >  - --xen-device-tree=FILE: add dtb FILE as device tree. This both adding the
> >    file to the image and modifying the xen configuration to use it.
> > +- --xen-ramdisk=FILE: add ramdisk FILE as guest ramdisk. This both adding the
> > +  file to the image and modifying the xen configuration to use it.
> >  - --init-script=FILE: add guest init script. The script is embedded inside
> > the
> >    image file. Several script can be added and the basename of FILE is used to
> >    distinguish them (calling the option twice with the same file will update
> > the
> > diff --git
> > a/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-mkimage
> > b/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-mkimage
> > index 4c1b4a8..a3f987a 100755
> > --- a/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-mkimage
> > +++ b/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-mkimage
> > @@ -82,6 +82,9 @@ Xen configuration for the guest
> >  --xen-device-tree=      disable device tree parameter in xen configuration
> >  --xen-device-tree=FILE  set guest device tree in xen configuration and add
> >                           file to xen files
> > +--xen-ramdisk=          disable ramdisk parameter in xen configuration
> > +--xen-ramdisk=FILE      set guest ramdisk in xen configuration and add
> > +                         file to xen files
> >  --xen-disk=             disable disk parameter in xen configuration
> >  --xen-disk=DEV          set guest disk to device DEV (phy:DEV,xvda,w is set)
> >  --xen-append=FILE       append FILE content to xen configuration
> > @@ -668,6 +671,20 @@ for arg in "${@}"; do
> >                  install -m 644 ${optarg} ${IMAGE_TMPDIR}/files/guest.dtb
> >              fi
> >              ;;
> > +        --xen-ramdisk=*)
> > +            if [ -z "${optarg}" ]; then
> > +                xen_config_disable_param "ramdisk"
> > +                rm -f ${IMAGE_TMPDIR}/files/ramdisk.img
> > +            else
> > +                if [ ! -f ${optarg} ]; then
> > +                    echo "Error: invalid ramdisk file ${optarg}"
> > +                    exit 1
> > +                fi
> > +                xen_config_set_string "ramdisk" "files/ramdisk.img"
> > +                mkdir -p ${IMAGE_TMPDIR}/files
> > +                install -m 644 ${optarg} ${IMAGE_TMPDIR}/files/ramdisk.img
> > +            fi
> > +            ;;
> >          --xen-disk=*)
> >              if [ -z "${optarg}" ]; then
> >                  xen_config_disable_param "disk"
> > -- 
> > 2.17.1
> > 
> >

> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-15 16:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 11:54 [PATCH] arm-autonomy/xenguest-mkimage: add extra ramdisk support Kamil Dziezyk
2020-10-14 12:02 ` Diego Sueiro
2020-10-15 16:56   ` [meta-arm] " Jon Mason

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.