All of lore.kernel.org
 help / color / mirror / Atom feed
* [4.17 nice-to-have] Remaining Xen build output
@ 2022-10-13 14:58 Andrew Cooper
  2022-10-14 11:01 ` Anthony PERARD
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Cooper @ 2022-10-13 14:58 UTC (permalink / raw)
  To: xen-devel, Anthony Perard, Henry Wang

Hi,

Having got Kbuild almost integrated, there are a few artefacts remaining
which it would be nice to address seeing as out-of-tree builds is a big
feature for 4.17.  Picking at parts of a build, we've got:

  CHK     include/headers++.chk
/usr/bin/make -C include/xen/lib/x86 -f
/builddir/build/BUILD/xen-4.17.0/xen/include/xen/lib/x86/Makefile all
  CPP     include/compat/arch-x86_32.i
  CPP     include/compat/features.i
/usr/bin/python
/builddir/build/BUILD/xen-4.17.0/xen/../xen/tools/gen-cpuid.py -i
/builddir/build/BUILD/xen-4.17.0/xen/../xen/include/public/arch-x86/cpufeatureset.h
-o cpuid-autogen.h.new
  CPP     include/compat/nmi.i
if ! cmp -s cpuid-autogen.h.new cpuid-autogen.h; then mv -f
cpuid-autogen.h.new cpuid-autogen.h; else rm -f cpuid-autogen.h.new; fi
  CPP     include/compat/physdev.i
  CPP     arch/x86/asm-macros.i
  CC      arch/x86/boot/cmdline.o
  BINFILE common/config_data.S
gzip -n -c .config >common/config.gz
  CC      common/core_parking.o
  UPD     arch/x86/include/asm/asm-macros.h
gcc -MMD -MP -MF ./.asm-offsets.s.d -m64 -DBUILD_ID -fno-strict-aliasing
-std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement
-Wno-unused-but-set-variable -Wno-unused-local-typedefs -O1
-fno-omit-frame-pointer -nostdinc -fno-builtin -fno-common -Werror
-Wredundant-decls -Wno-pointer-arith -Wvla -pipe -D__XEN__ -include
../include/xen/config.h -g -mindirect-branch=thunk-extern
-mindirect-branch-register -fno-jump-tables -I./include
-I./arch/x86/include -I../include -I../arch/x86/include
-I../arch/x86/include/asm/mach-generic
-I../arch/x86/include/asm/mach-default -DXEN_IMG_OFFSET=0x200000
-msoft-float -fno-pie -fno-stack-protector -fno-exceptions
-fno-asynchronous-unwind-tables -Wnested-externs -DHAVE_AS_VMX
-DHAVE_AS_SSE4_2 -DHAVE_AS_EPT -DHAVE_AS_RDRAND -DHAVE_AS_FSGSBASE
-DHAVE_AS_XSAVEOPT -DHAVE_AS_RDSEED -DHAVE_AS_CLAC_STAC -DHAVE_AS_CLWB
-DHAVE_AS_QUOTED_SYM -DHAVE_AS_INVPCID -DHAVE_AS_MOVDIR -DHAVE_AS_ENQCMD
-DHAVE_AS_NEGATIVE_TRUE -DHAVE_AS_NOPS_DIRECTIVE -mno-red-zone -fpic
-mno-mmx -mno-sse -mskip-rax-setup -fcf-protection=none
'-D__OBJECT_LABEL__=asm-offsets.s' -mpreferred-stack-boundary=3 -S -g0
-o asm-offsets.s.new -MQ asm-offsets.s ../arch/x86/x86_64/asm-offsets.c
if ! cmp -s asm-offsets.s.new asm-offsets.s; then mv -f
asm-offsets.s.new asm-offsets.s; else rm -f asm-offsets.s.new; fi
  CC      common/symbols-dummy.o
  CC      lib/x86/cpuid.o
ld -melf_i386  -N -T ../arch/x86/boot/build32.lds -o
arch/x86/boot/cmdline.lnk arch/x86/boot/cmdline.o
ld -melf_i386  -N -T ../arch/x86/boot/build32.lds -o
arch/x86/boot/reloc.lnk arch/x86/boot/reloc.o
objcopy -j .text -O binary arch/x86/boot/cmdline.lnk
arch/x86/boot/cmdline.bin
objcopy -j .text -O binary arch/x86/boot/reloc.lnk arch/x86/boot/reloc.bin
  CC      arch/x86/boot/head.o
  CC      drivers/acpi/tables/tbfadt.o
rm arch/x86/boot/cmdline.lnk arch/x86/boot/reloc.lnk
  CC      common/memory.o
  LD      prelink.o
ld    -melf_x86_64  -T arch/x86/xen.lds -N prelink.o --build-id=sha1 \
    ./common/symbols-dummy.o -o ./.xen-syms.0
  HOSTCC  arch/x86/boot/mkelf32
nm -pa --format=sysv ./.xen-syms.0 \
    | ./tools/symbols  --sysv --sort \
    >./.xen-syms.0.S
/usr/bin/make -f ../Rules.mk obj=. ./.xen-syms.0.o
  CC      .xen-syms.0.o
ld    -melf_x86_64  -T arch/x86/xen.lds -N prelink.o --build-id=sha1 \
    ./.xen-syms.0.o -o ./.xen-syms.1
nm -pa --format=sysv ./.xen-syms.1 \
    | ./tools/symbols  --sysv --sort --warn-dup \
    >./.xen-syms.1.S
/usr/bin/make -f ../Rules.mk obj=. ./.xen-syms.1.o
  CC      .xen-syms.1.o
ld    -melf_x86_64  -T arch/x86/xen.lds -N prelink.o --build-id=sha1 \
    --orphan-handling=warn ./.xen-syms.1.o -o xen-syms
nm -pa --format=sysv ./xen-syms \
    | ./tools/symbols --all-symbols --xensyms --sysv --sort \
    >./xen-syms.map
rm -f ./.xen-syms.[0-9]* ./..xen-syms.[0-9]*
arch/x86/boot/mkelf32 --notes xen-syms ./.xen.elf32 0x200000 \
               `nm xen-syms | sed -ne 's/^\([^ ]*\) .
__2M_rwdata_end$/0x\1/p'`
od -t x4 -N 8192 ./.xen.elf32  | grep 1badb002 > /dev/null || \
    { echo "No Multiboot1 header found" >&2; false; }
od -t x4 -N 32768 ./.xen.elf32 | grep e85250d6 > /dev/null || \
    { echo "No Multiboot2 header found" >&2; false; }
mv ./.xen.elf32 xen
gzip -n -f -9 < xen > xen.gz.new
{ nm -n xen-syms | grep -v '\(compiled\)\|\(\.o$\)\|\( [aUw]
\)\|\(\.\.ng$\)\|\(LASH[RL]DI\)'; \
awk < arch/x86/include/asm/asm-offsets.h \
'/^#define __ASM_OFFSETS_H__/ { next } ; /^#define / { printf "%016x -
+%s\n", $3, $2 }'; } > System.map
mv xen.gz.new xen.gz


Presumably all of these examples want switching from their current
ad-hoc logic to a cmd_* based version?  Are there some simple
instructions for how to convert?

~Andrew

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

* Re: [4.17 nice-to-have] Remaining Xen build output
  2022-10-13 14:58 [4.17 nice-to-have] Remaining Xen build output Andrew Cooper
@ 2022-10-14 11:01 ` Anthony PERARD
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony PERARD @ 2022-10-14 11:01 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: xen-devel, Henry Wang

On Thu, Oct 13, 2022 at 02:58:18PM +0000, Andrew Cooper wrote:
> Hi,
> 
> Having got Kbuild almost integrated, there are a few artefacts remaining
> which it would be nice to address seeing as out-of-tree builds is a big

Those would be nice to address indeed, but can those wait for the next
release? Out-of-tree still works fine without fixing those. The down
size is some output that doesn't seems to belong, and those command
aren't actually check for changes in the command line.

> feature for 4.17.  Picking at parts of a build, we've got:
> 
>   CHK     include/headers++.chk
> /usr/bin/make -C include/xen/lib/x86 -f
> /builddir/build/BUILD/xen-4.17.0/xen/include/xen/lib/x86/Makefile all

I guess we could just hide this line with $(Q)

> /usr/bin/python /builddir/build/BUILD/xen-4.17.0/xen/../xen/tools/gen-cpuid.py -i /builddir/build/BUILD/xen-4.17.0/xen/../xen/include/public/arch-x86/cpufeatureset.h -o cpuid-autogen.h.new

> if ! cmp -s cpuid-autogen.h.new cpuid-autogen.h; then mv -f cpuid-autogen.h.new cpuid-autogen.h; else rm -f cpuid-autogen.h.new; fi

Those two cpuid related commands can't really use Kbuild infrastructure,
because the ./xen/include/xen/lib/x86/Makefile is also used by the
toolstack.

>   CPP     include/compat/physdev.i
>   CPP     arch/x86/asm-macros.i
>   CC      arch/x86/boot/cmdline.o
>   BINFILE common/config_data.S
> gzip -n -c .config >common/config.gz
>   CC      common/core_parking.o
>   UPD     arch/x86/include/asm/asm-macros.h
> gcc -MMD -MP -MF ./.asm-offsets.s.d -m64 -DBUILD_ID -fno-strict-aliasing
> -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement
> -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O1
> -fno-omit-frame-pointer -nostdinc -fno-builtin -fno-common -Werror
> -Wredundant-decls -Wno-pointer-arith -Wvla -pipe -D__XEN__ -include
> ../include/xen/config.h -g -mindirect-branch=thunk-extern
> -mindirect-branch-register -fno-jump-tables -I./include
> -I./arch/x86/include -I../include -I../arch/x86/include
> -I../arch/x86/include/asm/mach-generic
> -I../arch/x86/include/asm/mach-default -DXEN_IMG_OFFSET=0x200000
> -msoft-float -fno-pie -fno-stack-protector -fno-exceptions
> -fno-asynchronous-unwind-tables -Wnested-externs -DHAVE_AS_VMX
> -DHAVE_AS_SSE4_2 -DHAVE_AS_EPT -DHAVE_AS_RDRAND -DHAVE_AS_FSGSBASE
> -DHAVE_AS_XSAVEOPT -DHAVE_AS_RDSEED -DHAVE_AS_CLAC_STAC -DHAVE_AS_CLWB
> -DHAVE_AS_QUOTED_SYM -DHAVE_AS_INVPCID -DHAVE_AS_MOVDIR -DHAVE_AS_ENQCMD
> -DHAVE_AS_NEGATIVE_TRUE -DHAVE_AS_NOPS_DIRECTIVE -mno-red-zone -fpic
> -mno-mmx -mno-sse -mskip-rax-setup -fcf-protection=none
> '-D__OBJECT_LABEL__=asm-offsets.s' -mpreferred-stack-boundary=3 -S -g0
> -o asm-offsets.s.new -MQ asm-offsets.s ../arch/x86/x86_64/asm-offsets.c
> if ! cmp -s asm-offsets.s.new asm-offsets.s; then mv -f
> asm-offsets.s.new asm-offsets.s; else rm -f asm-offsets.s.new; fi
>   CC      common/symbols-dummy.o
>   CC      lib/x86/cpuid.o
> ld -melf_i386  -N -T ../arch/x86/boot/build32.lds -o
> arch/x86/boot/cmdline.lnk arch/x86/boot/cmdline.o
> ld -melf_i386  -N -T ../arch/x86/boot/build32.lds -o
> arch/x86/boot/reloc.lnk arch/x86/boot/reloc.o
> objcopy -j .text -O binary arch/x86/boot/cmdline.lnk
> arch/x86/boot/cmdline.bin
> objcopy -j .text -O binary arch/x86/boot/reloc.lnk arch/x86/boot/reloc.bin
>   CC      arch/x86/boot/head.o
>   CC      drivers/acpi/tables/tbfadt.o
> rm arch/x86/boot/cmdline.lnk arch/x86/boot/reloc.lnk
>   CC      common/memory.o
>   LD      prelink.o
> ld    -melf_x86_64  -T arch/x86/xen.lds -N prelink.o --build-id=sha1 \
>     ./common/symbols-dummy.o -o ./.xen-syms.0
>   HOSTCC  arch/x86/boot/mkelf32
> nm -pa --format=sysv ./.xen-syms.0 \
>     | ./tools/symbols  --sysv --sort \
>     >./.xen-syms.0.S
> /usr/bin/make -f ../Rules.mk obj=. ./.xen-syms.0.o
>   CC      .xen-syms.0.o
> ld    -melf_x86_64  -T arch/x86/xen.lds -N prelink.o --build-id=sha1 \
>     ./.xen-syms.0.o -o ./.xen-syms.1
> nm -pa --format=sysv ./.xen-syms.1 \
>     | ./tools/symbols  --sysv --sort --warn-dup \
>     >./.xen-syms.1.S
> /usr/bin/make -f ../Rules.mk obj=. ./.xen-syms.1.o
>   CC      .xen-syms.1.o
> ld    -melf_x86_64  -T arch/x86/xen.lds -N prelink.o --build-id=sha1 \
>     --orphan-handling=warn ./.xen-syms.1.o -o xen-syms
> nm -pa --format=sysv ./xen-syms \
>     | ./tools/symbols --all-symbols --xensyms --sysv --sort \
>     >./xen-syms.map
> rm -f ./.xen-syms.[0-9]* ./..xen-syms.[0-9]*
> arch/x86/boot/mkelf32 --notes xen-syms ./.xen.elf32 0x200000 \
>                `nm xen-syms | sed -ne 's/^\([^ ]*\) .
> __2M_rwdata_end$/0x\1/p'`
> od -t x4 -N 8192 ./.xen.elf32  | grep 1badb002 > /dev/null || \
>     { echo "No Multiboot1 header found" >&2; false; }
> od -t x4 -N 32768 ./.xen.elf32 | grep e85250d6 > /dev/null || \
>     { echo "No Multiboot2 header found" >&2; false; }
> mv ./.xen.elf32 xen
> gzip -n -f -9 < xen > xen.gz.new
> { nm -n xen-syms | grep -v '\(compiled\)\|\(\.o$\)\|\( [aUw]
> \)\|\(\.\.ng$\)\|\(LASH[RL]DI\)'; \
> awk < arch/x86/include/asm/asm-offsets.h \
> '/^#define __ASM_OFFSETS_H__/ { next } ; /^#define / { printf "%016x -
> +%s\n", $3, $2 }'; } > System.map
> mv xen.gz.new xen.gz
> 
> 
> Presumably all of these examples want switching from their current
> ad-hoc logic to a cmd_* based version?  Are there some simple
> instructions for how to convert?

There is "Custom commands" in "./docs/misc/xen-makefiles/makefiles.rst".
But sometime one wants to use "filechk" instead, which is documented in
"./xen/scripts/Kbuild.include", not sure it applies here.
As for the last part of linking xen all together from prelink.o to xen,
Linux have a separate script for that and don't really use the Makefile,
so maybe it's something we could look into but Arm and x86 have
different way to build the binary which make writing a script annoying.

Cheers,

-- 
Anthony PERARD


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

end of thread, other threads:[~2022-10-14 11:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-13 14:58 [4.17 nice-to-have] Remaining Xen build output Andrew Cooper
2022-10-14 11:01 ` Anthony PERARD

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.