diff mbox

[2/3] Update to use a .config file

Message ID 20160716015522.GB18828@char.us.oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Konrad Rzeszutek Wilk July 16, 2016, 1:55 a.m. UTC
> > OK, I'll split it into two. Feel free to create a stable-47 branch in
> > livepatch-build-tools.git with only the .config patch. Personally, I'd
> > rather not spend much time backporting stuff to support a tech preview
> > feature on an older branch.
> 
> We will need to update the Wiki a bit too...
> 
> What if I we do something simpler?

And the offical patch:

From 929a92b3dbb8467e0a69b50706b69fb206b51ff3 Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date: Fri, 15 Jul 2016 09:36:23 -0400
Subject: [PATCH] Check .config for CONFIG_DEBUG. If not found use --xen-debug
 (if specified)

Xen 4.8 ditched the 'debug=y' and now has CONFIG_DEBUG in the
.config. To still support 4.7 lets just poke the .config
file and see.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 livepatch-build | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

Comments

Ross Lagerwall July 18, 2016, 9:33 a.m. UTC | #1
On 07/16/2016 02:55 AM, Konrad Rzeszutek Wilk wrote:
>>> OK, I'll split it into two. Feel free to create a stable-47 branch in
>>> livepatch-build-tools.git with only the .config patch. Personally, I'd
>>> rather not spend much time backporting stuff to support a tech preview
>>> feature on an older branch.
>>
>> We will need to update the Wiki a bit too...
>>
>> What if I we do something simpler?
>
> And the offical patch:
>
> From 929a92b3dbb8467e0a69b50706b69fb206b51ff3 Mon Sep 17 00:00:00 2001
> From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Date: Fri, 15 Jul 2016 09:36:23 -0400
> Subject: [PATCH] Check .config for CONFIG_DEBUG. If not found use --xen-debug
>  (if specified)
>
> Xen 4.8 ditched the 'debug=y' and now has CONFIG_DEBUG in the
> .config. To still support 4.7 lets just poke the .config
> file and see.
>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Is the intention that this gets applied on top of "[PATCH 
LIVEPATCH-BUILD-TOOLS v2 1/3] Update to use a .config file" and that 
"[PATCH LIVEPATCH-BUILD-TOOLS v2 2/3] Remove --xen-debug" is dropped?

If so, then the approach looks OK to me.

> ---
>  livepatch-build | 20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/livepatch-build b/livepatch-build
> index 6254c29..2165e3b 100755
> --- a/livepatch-build
> +++ b/livepatch-build
> @@ -66,7 +66,7 @@ function build_full()
>  {
>      cd "${SRCDIR}/xen" || die
>      make "-j$CPUS" clean &> "${OUTPUT}/build_full_clean.log" || die
> -    make "-j$CPUS" debug="$XEN_DEBUG" &> "${OUTPUT}/build_full_compile.log" || die
> +    make "-j$CPUS" "$XEN_DEBUG" &> "${OUTPUT}/build_full_compile.log" || die

$XEN_DEBUG needs to be unquoted, otherwise you get a build error from make:
make: *** empty string invalid as file name.  Stop.

>      cp xen-syms "$OUTPUT"
>  }
>
> @@ -87,7 +87,7 @@ function build_special()
>      cd "${SRCDIR}/xen" || die
>      sed -i 's/CFLAGS += -nostdinc/CFLAGS += -nostdinc -ffunction-sections -fdata-sections/' Rules.mk
>      sed -i 's/--section-alignment=0x200000/--section-alignment=0x1000/' arch/x86/Makefile
> -    make "-j$CPUS" debug="$XEN_DEBUG" &> "${OUTPUT}/build_${name}_compile.log" || die
> +    make "-j$CPUS" "$XEN_DEBUG" &> "${OUTPUT}/build_${name}_compile.log" || die

Same here.

>      sed -i 's/CFLAGS += -nostdinc -ffunction-sections -fdata-sections/CFLAGS += -nostdinc/' Rules.mk
>      sed -i 's/--section-alignment=0x1000/--section-alignment=0x200000/' arch/x86/Makefile
>
> @@ -165,7 +165,7 @@ usage() {
>      echo "        -j, --cpus         Number of CPUs to use" >&2
>      echo "        -k, --skip         Skip build or diff phase" >&2
>      echo "        -d, --debug        Enable debug logging" >&2
> -    echo "        --xen-debug        Build debug Xen" >&2
> +    echo "        --xen-debug        Build debug Xen (if your .config does not have the options)" >&2
>      echo "        --xen-syms         Build against a xen-syms" >&2
>      echo "        --depends          Required build-id" >&2
>      echo "        --prelink          Prelink" >&2
> @@ -277,6 +277,20 @@ if [ "${SKIP}" != "build" ]; then
>      cp -f "${CONFIGFILE}" "${OUTPUT}/.config"
>      cp -f "${OUTPUT}/.config" "xen/.config"
>
> +    grep -q CONFIG_DEBUG "xen/.config"
> +    if [ $? -eq 0 ]; then
> +        if [ "$XEN_DEBUG" == "y" ]; then
> +            grep -q "CONFIG_DEBUG=y" "xen/.config"
> +            if [ $? -ne 0 ]; then
> +               echo "CONFIG_DEBUG and --xen-debug mismatch!"
> +               die
> +            fi

This would be cleaner as a oneliner:
grep -q "CONFIG_DEBUG=y" "xen/.config" || die "CONFIG_DEBUG and 
--xen-debug mismatch!"
Konrad Rzeszutek Wilk July 18, 2016, 10:28 a.m. UTC | #2
On Mon, Jul 18, 2016 at 10:33:49AM +0100, Ross Lagerwall wrote:
> On 07/16/2016 02:55 AM, Konrad Rzeszutek Wilk wrote:
> > > > OK, I'll split it into two. Feel free to create a stable-47 branch in
> > > > livepatch-build-tools.git with only the .config patch. Personally, I'd
> > > > rather not spend much time backporting stuff to support a tech preview
> > > > feature on an older branch.
> > > 
> > > We will need to update the Wiki a bit too...
> > > 
> > > What if I we do something simpler?
> > 
> > And the offical patch:
> > 
> > From 929a92b3dbb8467e0a69b50706b69fb206b51ff3 Mon Sep 17 00:00:00 2001
> > From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > Date: Fri, 15 Jul 2016 09:36:23 -0400
> > Subject: [PATCH] Check .config for CONFIG_DEBUG. If not found use --xen-debug
> >  (if specified)
> > 
> > Xen 4.8 ditched the 'debug=y' and now has CONFIG_DEBUG in the
> > .config. To still support 4.7 lets just poke the .config
> > file and see.
> > 
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> Is the intention that this gets applied on top of "[PATCH
> LIVEPATCH-BUILD-TOOLS v2 1/3] Update to use a .config file" and that "[PATCH
> LIVEPATCH-BUILD-TOOLS v2 2/3] Remove --xen-debug" is dropped?
> 
> If so, then the approach looks OK to me.

Yup.
> 
> > ---
> >  livepatch-build | 20 +++++++++++++++++---
> >  1 file changed, 17 insertions(+), 3 deletions(-)
> > 
> > diff --git a/livepatch-build b/livepatch-build
> > index 6254c29..2165e3b 100755
> > --- a/livepatch-build
> > +++ b/livepatch-build
> > @@ -66,7 +66,7 @@ function build_full()
> >  {
> >      cd "${SRCDIR}/xen" || die
> >      make "-j$CPUS" clean &> "${OUTPUT}/build_full_clean.log" || die
> > -    make "-j$CPUS" debug="$XEN_DEBUG" &> "${OUTPUT}/build_full_compile.log" || die
> > +    make "-j$CPUS" "$XEN_DEBUG" &> "${OUTPUT}/build_full_compile.log" || die
> 
> $XEN_DEBUG needs to be unquoted, otherwise you get a build error from make:
> make: *** empty string invalid as file name.  Stop.
> 
> >      cp xen-syms "$OUTPUT"
> >  }
> > 
> > @@ -87,7 +87,7 @@ function build_special()
> >      cd "${SRCDIR}/xen" || die
> >      sed -i 's/CFLAGS += -nostdinc/CFLAGS += -nostdinc -ffunction-sections -fdata-sections/' Rules.mk
> >      sed -i 's/--section-alignment=0x200000/--section-alignment=0x1000/' arch/x86/Makefile
> > -    make "-j$CPUS" debug="$XEN_DEBUG" &> "${OUTPUT}/build_${name}_compile.log" || die
> > +    make "-j$CPUS" "$XEN_DEBUG" &> "${OUTPUT}/build_${name}_compile.log" || die
> 
> Same here.
> 
> >      sed -i 's/CFLAGS += -nostdinc -ffunction-sections -fdata-sections/CFLAGS += -nostdinc/' Rules.mk
> >      sed -i 's/--section-alignment=0x1000/--section-alignment=0x200000/' arch/x86/Makefile
> > 
> > @@ -165,7 +165,7 @@ usage() {
> >      echo "        -j, --cpus         Number of CPUs to use" >&2
> >      echo "        -k, --skip         Skip build or diff phase" >&2
> >      echo "        -d, --debug        Enable debug logging" >&2
> > -    echo "        --xen-debug        Build debug Xen" >&2
> > +    echo "        --xen-debug        Build debug Xen (if your .config does not have the options)" >&2
> >      echo "        --xen-syms         Build against a xen-syms" >&2
> >      echo "        --depends          Required build-id" >&2
> >      echo "        --prelink          Prelink" >&2
> > @@ -277,6 +277,20 @@ if [ "${SKIP}" != "build" ]; then
> >      cp -f "${CONFIGFILE}" "${OUTPUT}/.config"
> >      cp -f "${OUTPUT}/.config" "xen/.config"
> > 
> > +    grep -q CONFIG_DEBUG "xen/.config"
> > +    if [ $? -eq 0 ]; then
> > +        if [ "$XEN_DEBUG" == "y" ]; then
> > +            grep -q "CONFIG_DEBUG=y" "xen/.config"
> > +            if [ $? -ne 0 ]; then
> > +               echo "CONFIG_DEBUG and --xen-debug mismatch!"
> > +               die
> > +            fi
> 
> This would be cleaner as a oneliner:
> grep -q "CONFIG_DEBUG=y" "xen/.config" || die "CONFIG_DEBUG and --xen-debug
> mismatch!"

Yeah, let me put that in the conditional.
diff mbox

Patch

diff --git a/livepatch-build b/livepatch-build
index 6254c29..2165e3b 100755
--- a/livepatch-build
+++ b/livepatch-build
@@ -66,7 +66,7 @@  function build_full()
 {
     cd "${SRCDIR}/xen" || die
     make "-j$CPUS" clean &> "${OUTPUT}/build_full_clean.log" || die
-    make "-j$CPUS" debug="$XEN_DEBUG" &> "${OUTPUT}/build_full_compile.log" || die
+    make "-j$CPUS" "$XEN_DEBUG" &> "${OUTPUT}/build_full_compile.log" || die
     cp xen-syms "$OUTPUT"
 }
 
@@ -87,7 +87,7 @@  function build_special()
     cd "${SRCDIR}/xen" || die
     sed -i 's/CFLAGS += -nostdinc/CFLAGS += -nostdinc -ffunction-sections -fdata-sections/' Rules.mk
     sed -i 's/--section-alignment=0x200000/--section-alignment=0x1000/' arch/x86/Makefile
-    make "-j$CPUS" debug="$XEN_DEBUG" &> "${OUTPUT}/build_${name}_compile.log" || die
+    make "-j$CPUS" "$XEN_DEBUG" &> "${OUTPUT}/build_${name}_compile.log" || die
     sed -i 's/CFLAGS += -nostdinc -ffunction-sections -fdata-sections/CFLAGS += -nostdinc/' Rules.mk
     sed -i 's/--section-alignment=0x1000/--section-alignment=0x200000/' arch/x86/Makefile
 
@@ -165,7 +165,7 @@  usage() {
     echo "        -j, --cpus         Number of CPUs to use" >&2
     echo "        -k, --skip         Skip build or diff phase" >&2
     echo "        -d, --debug        Enable debug logging" >&2
-    echo "        --xen-debug        Build debug Xen" >&2
+    echo "        --xen-debug        Build debug Xen (if your .config does not have the options)" >&2
     echo "        --xen-syms         Build against a xen-syms" >&2
     echo "        --depends          Required build-id" >&2
     echo "        --prelink          Prelink" >&2
@@ -277,6 +277,20 @@  if [ "${SKIP}" != "build" ]; then
     cp -f "${CONFIGFILE}" "${OUTPUT}/.config"
     cp -f "${OUTPUT}/.config" "xen/.config"
 
+    grep -q CONFIG_DEBUG "xen/.config"
+    if [ $? -eq 0 ]; then
+        if [ "$XEN_DEBUG" == "y" ]; then
+            grep -q "CONFIG_DEBUG=y" "xen/.config"
+            if [ $? -ne 0 ]; then
+               echo "CONFIG_DEBUG and --xen-debug mismatch!"
+               die
+            fi
+        fi
+        XEN_DEBUG=""
+    else
+        XEN_DEBUG="--xen-debug $XEN_DEBUG"
+    fi
+
     echo "Perform full initial build with ${CPUS} CPU(s)..."
     build_full