10 Jul, 2019

1 commit


21 Dec, 2018

1 commit


01 Dec, 2018

1 commit

  • UML fails to build with CONFIG_GCC_PLUGINS=y.

    $ make -s ARCH=um mrproper
    $ make -s ARCH=um allmodconfig
    $ make ARCH=um
    UPD include/generated/uapi/linux/version.h
    WRAP arch/x86/include/generated/uapi/asm/bpf_perf_event.h
    WRAP arch/x86/include/generated/uapi/asm/poll.h
    WRAP arch/x86/include/generated/asm/dma-contiguous.h
    WRAP arch/x86/include/generated/asm/early_ioremap.h
    WRAP arch/x86/include/generated/asm/export.h
    WRAP arch/x86/include/generated/asm/mcs_spinlock.h
    WRAP arch/x86/include/generated/asm/mm-arch-hooks.h
    SYSTBL arch/x86/include/generated/asm/syscalls_32.h
    SYSHDR arch/x86/include/generated/asm/unistd_32_ia32.h
    SYSHDR arch/x86/include/generated/asm/unistd_64_x32.h
    SYSTBL arch/x86/include/generated/asm/syscalls_64.h
    SYSHDR arch/x86/include/generated/uapi/asm/unistd_32.h
    SYSHDR arch/x86/include/generated/uapi/asm/unistd_64.h
    SYSHDR arch/x86/include/generated/uapi/asm/unistd_x32.h
    HOSTCC scripts/unifdef
    CC arch/x86/um/user-offsets.s
    cc1: error: cannot load plugin ./scripts/gcc-plugins/cyc_complexity_plugin.so
    ./scripts/gcc-plugins/cyc_complexity_plugin.so: cannot open shared object file: No such file or directory
    cc1: error: cannot load plugin ./scripts/gcc-plugins/structleak_plugin.so
    ./scripts/gcc-plugins/structleak_plugin.so: cannot open shared object file: No such file or directory
    cc1: error: cannot load plugin ./scripts/gcc-plugins/latent_entropy_plugin.so
    ./scripts/gcc-plugins/latent_entropy_plugin.so: cannot open shared object file: No such file or directory
    cc1: error: cannot load plugin ./scripts/gcc-plugins/randomize_layout_plugin.so
    ./scripts/gcc-plugins/randomize_layout_plugin.so: cannot open shared object file: No such file or directory
    make[1]: *** [scripts/Makefile.build;119: arch/x86/um/user-offsets.s] Error 1
    make: *** [arch/um/Makefile;152: arch/x86/um/user-offsets.s] Error 2

    Reorder the preparation stage (with cleanups) to make sure gcc-plugins
    is built before descending to arch/x86/um/.

    Fixes: 6b90bd4ba40b ("GCC plugin infrastructure")
    Reported-by: kbuild test robot
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

24 Aug, 2018

1 commit

  • Commit a0f97e06a43c ("kbuild: enable 'make CFLAGS=...' to add
    additional options to CC") renamed CFLAGS to KBUILD_CFLAGS.

    Commit 222d394d30e7 ("kbuild: enable 'make AFLAGS=...' to add
    additional options to AS") renamed AFLAGS to KBUILD_AFLAGS.

    Commit 06c5040cdb13 ("kbuild: enable 'make CPPFLAGS=...' to add
    additional options to CPP") renamed CPPFLAGS to KBUILD_CPPFLAGS.

    For some reason, LDFLAGS was not renamed.

    Using a well-known variable like LDFLAGS may result in accidental
    override of the variable.

    Kbuild generally uses KBUILD_ prefixed variables for the internally
    appended options, so here is one more conversion to sanitize the
    naming convention.

    I did not touch Makefiles under tools/ since the tools build system
    is a different world.

    Signed-off-by: Masahiro Yamada
    Acked-by: Kirill A. Shutemov
    Reviewed-by: Palmer Dabbelt

    Masahiro Yamada
     

16 Aug, 2018

1 commit

  • Pull Kconfig consolidation from Masahiro Yamada:
    "Consolidation of Kconfig files by Christoph Hellwig.

    Move the source statements of arch-independent Kconfig files instead
    of duplicating the includes in every arch/$(SRCARCH)/Kconfig"

    * tag 'kconfig-v4.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    kconfig: add a Memory Management options" menu
    kconfig: move the "Executable file formats" menu to fs/Kconfig.binfmt
    kconfig: use a menu in arch/Kconfig to reduce clutter
    kconfig: include kernel/Kconfig.preempt from init/Kconfig
    Kconfig: consolidate the "Kernel hacking" menu
    kconfig: include common Kconfig files from top-level Kconfig
    kconfig: remove duplicate SWAP symbol defintions
    um: create a proper drivers Kconfig
    um: cleanup Kconfig files
    um: stop abusing KBUILD_KCONFIG

    Linus Torvalds
     

07 Aug, 2018

2 commits

  • Now that '%asm-generic' is added to no-dot-config-targets,
    'make asm-generic' does not include the kernel configuration.

    You can simply do 'make asm-generic' in the recursed top Makefile
    without bothering syncconfig.

    Signed-off-by: Masahiro Yamada
    Tested-by: Randy Dunlap
    Acked-by: Richard Weinberger

    Masahiro Yamada
     
  • Randy Dunlap reports UML occasionally fails to build with -j and
    O= options.

    make[1]: Entering directory '/home/rdunlap/mmotm-2018-0802-1529/UM64'
    UPD include/generated/uapi/linux/version.h
    WRAP arch/x86/include/generated/asm/dma-contiguous.h
    WRAP arch/x86/include/generated/asm/export.h
    WRAP arch/x86/include/generated/asm/early_ioremap.h
    WRAP arch/x86/include/generated/asm/mcs_spinlock.h
    WRAP arch/x86/include/generated/asm/mm-arch-hooks.h
    WRAP arch/x86/include/generated/uapi/asm/bpf_perf_event.h
    WRAP arch/x86/include/generated/uapi/asm/poll.h
    GEN ./Makefile
    make[2]: *** No rule to make target 'archheaders'. Stop.
    arch/um/Makefile:119: recipe for target 'archheaders' failed
    make[1]: *** [archheaders] Error 2
    make[1]: *** Waiting for unfinished jobs....
    UPD include/config/kernel.release
    make[1]: *** wait: No child processes. Stop.
    Makefile:146: recipe for target 'sub-make' failed
    make: *** [sub-make] Error 2

    The cause of the problem is the use of '$(MAKE) KBUILD_SRC=',
    which recurses to the top Makefile via the $(objtree)/Makefile
    generated by scripts/mkmakefile.

    When you run "make -j O= ARCH=um", Make can execute
    'archheaders' and 'outputmakefile' targets simultaneously because
    there is no dependency between them.

    If it happens,

    $(Q)$(MAKE) KBUILD_SRC= ARCH=$(HEADER_ARCH) archheaders

    ... tries to run $(objtree)/Makefile that is being updated.

    The correct way for the recursion is

    $(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(HEADER_ARCH) archheaders

    ..., which does not rely on the generated Makefile.

    Reported-by: Randy Dunlap
    Signed-off-by: Masahiro Yamada
    Tested-by: Randy Dunlap
    Acked-by: Richard Weinberger

    Masahiro Yamada
     

02 Aug, 2018

1 commit

  • Instead create a arch/um/Kconfig file that just includes the actual
    per-arch Kconfig file. Note that we use HEADER_ARCH to find the
    per-arch Kconfig file as that variable already includes the
    normalization from i386 or x86_64 to x86.

    Signed-off-by: Christoph Hellwig
    Acked-by: Richard Weinberger
    Signed-off-by: Masahiro Yamada

    Christoph Hellwig
     

28 Jul, 2018

1 commit


28 Nov, 2017

1 commit


14 Sep, 2017

1 commit

  • Debian's gcc defaults to pie. The global Makefile already defines the -fno-pie option.
    Link UML dynamic kernel image also with -no-pie to fix the build.

    Signed-off-by: Thomas Meyer
    Signed-off-by: Richard Weinberger

    Thomas Meyer
     

06 Jul, 2017

1 commit

  • Building a statically linked UML kernel on a Centos 6.9 host resulted in
    the following linking failure (GCC 4.4, glibc-2.12):

    /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpthread.a(libpthread.o):
    In function `siglongjmp':
    (.text+0x8490): multiple definition of `longjmp'
    arch/x86/um/built-in.o:/local/users/fainelli/openwrt/trunk/build_dir/target-x86_64_musl/linux-uml/linux-4.4.69/arch/x86/um/setjmp_64.S:44:
    first defined here
    /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpthread.a(libpthread.o):
    In function `sem_open':
    (.text+0x77cd): warning: the use of `mktemp' is dangerous, better use
    `mkstemp'
    collect2: ld returned 1 exit status
    make[4]: *** [vmlinux] Error 1

    Adopt a solution similar to the one done for vmap where we define
    longjmp/setjmp to be kernel_longjmp/setjmp. In the process, make sure we
    do rename the functions in arch/x86/um/setjmp_*.S accordingly.

    Fixes: a7df4716d195 ("um: link with -lpthread")
    Signed-off-by: Florian Fainelli
    Signed-off-by: Richard Weinberger

    Florian Fainelli
     

19 Jul, 2016

1 commit

  • There are very few files that need add an -I$(obj) gcc for the preprocessor
    or the assembler. For C files, we add always these for both the objtree and
    srctree, but for the other ones we require the Makefile to add them, and
    Kbuild then adds it for both trees.

    As a preparation for changing the meaning of the -I$(obj) directive to
    only refer to the srctree, this changes the two instances in arch/x86 to use
    an explictit $(objtree) prefix where needed, otherwise we won't find the
    headers any more, as reported by the kbuild 0day builder.

    arch/x86/realmode/rm/realmode.lds.S:75:20: fatal error: pasyms.h: No such file or directory

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Michal Marek

    Arnd Bergmann
     

09 Dec, 2015

1 commit

  • On gcc Ubuntu 4.8.4-2ubuntu1~14.04, linking vmlinux fails with:

    arch/um/os-Linux/built-in.o: In function `os_timer_create':
    /android/kernel/android/arch/um/os-Linux/time.c:51: undefined reference to `timer_create'
    arch/um/os-Linux/built-in.o: In function `os_timer_set_interval':
    /android/kernel/android/arch/um/os-Linux/time.c:84: undefined reference to `timer_settime'
    arch/um/os-Linux/built-in.o: In function `os_timer_remain':
    /android/kernel/android/arch/um/os-Linux/time.c:109: undefined reference to `timer_gettime'
    arch/um/os-Linux/built-in.o: In function `os_timer_one_shot':
    /android/kernel/android/arch/um/os-Linux/time.c:132: undefined reference to `timer_settime'
    arch/um/os-Linux/built-in.o: In function `os_timer_disable':
    /android/kernel/android/arch/um/os-Linux/time.c:145: undefined reference to `timer_settime'

    This is because -lrt appears in the generated link commandline
    after arch/um/os-Linux/built-in.o. Fix this by removing -lrt from
    arch/um/Makefile and adding it to the UM-specific section of
    scripts/link-vmlinux.sh.

    Signed-off-by: Lorenzo Colitti
    Signed-off-by: Richard Weinberger

    Lorenzo Colitti
     

07 Nov, 2015

1 commit

  • UML is using an obsolete itimer call for
    all timers and "polls" for kernel space timer firing
    in its userspace portion resulting in a long list
    of bugs and incorrect behaviour(s). It also uses
    ITIMER_VIRTUAL for its timer which results in the
    timer being dependent on it running and the cpu
    load.

    This patch fixes this by moving to posix high resolution
    timers firing off CLOCK_MONOTONIC and relaying the timer
    correctly to the UML userspace.

    Fixes:
    - crashes when hosts suspends/resumes
    - broken userspace timers - effecive ~40Hz instead
    of what they should be. Note - this modifies skas behavior
    by no longer setting an itimer per clone(). Timer events
    are relayed instead.
    - kernel network packet scheduling disciplines
    - tcp behaviour especially under load
    - various timer related corner cases

    Finally, overall responsiveness of userspace is better.

    Signed-off-by: Thomas Meyer
    Signed-off-by: Anton Ivanov
    [rw: massaged commit message]
    Signed-off-by: Richard Weinberger

    Anton Ivanov
     

20 Oct, 2015

1 commit

  • Commit 30b11ee9a (um: Remove copy&paste code from init.h)
    uncovered an issue wrt. out-of-tree builds.
    For out-of-tree builds, we must not rely on relative paths.
    Before 30b11ee9a it worked by chance as no host code included
    generated header files.

    Acked-by: Randy Dunlap
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     

01 Jun, 2015

1 commit

  • Currently UML is abusing __KERNEL__ to distinguish between
    kernel and host code (os-Linux). It is better to use a custom
    define such that existing users of __KERNEL__ don't get confused.

    Signed-off-by: Richard Weinberger

    Richard Weinberger
     

02 Apr, 2015

1 commit

  • Prior to this commit, it was impossible to use relative path to
    include Makefiles from the top level Makefile because the option
    "--include-dir=$(srctree)" becomes effective when Make enters into
    sub Makefiles.

    To use relative path in any places, this commit moves the option
    above the "sub-make" target.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Michal Marek

    Masahiro Yamada
     

05 Jun, 2014

1 commit

  • In an O= build, rely on the generated Makefile to call the main Makefile
    properly. When building in the source tree, we do not need to specify
    the -C and O= either. This fixes the problem when $(objtree) is a
    relative path and the -C changes the directory.

    Reported-by: Richard Weinberger
    Signed-off-by: Michal Marek

    Michal Marek
     

01 Dec, 2013

1 commit


17 Nov, 2013

1 commit

  • arch/um/defconfig only lists one default configuration, and that applies
    only to the i386 architecture. Replace it with two minimal
    configuration files generated using `make savedefconfig`:

    i386_defconfig and x86_64_defconfig

    The build scripts now require two updates:

    1. um's Kconfig (arch/x86/um/Kconfig) should specify an ARCH_DEFCONFIG
    section explicitly pointing to these scripts if the required
    variables are set. Take care to remove the DEFCONFIG_LIST section
    defined in the included file arch/um/Kconfig.common.

    2. um's Makefile (arch/um/Makefile) should set KBUILD_DEFCONFIG properly
    for the top-level Makefile to pick up. Copy the logic in
    arch/x86/Makefile to properly pick the defconfig file depending on
    the actual architecture; except we're working with $SUBARCH here,
    instead of $ARCH.

    Now, you can do:

    $ ARCH=um make defconfig
    $ ARCH=um make

    and successfully build User-Mode Linux on an x86_64 box in default
    configuration.

    Cc: Richard Weinberger
    Cc: Jeff Dike
    Signed-off-by: Ramkumar Ramachandra
    Signed-off-by: Richard Weinberger

    Ramkumar Ramachandra
     

03 Oct, 2012

1 commit

  • Partition the header include path flags into two sets, one for kernelspace
    builds and one for userspace builds.

    Add the following directories to build after the ordinary include directories
    so that #include will pick up the UAPI header directly if the kernel header
    has been moved there.

    The userspace set (represented by the USERINCLUDE make variable) contains:

    -I $(srctree)/arch/$(hdr-arch)/include/uapi
    -I arch/$(hdr-arch)/include/generated/uapi
    -I $(srctree)/include/uapi
    -I include/generated/uapi
    -include $(srctree)/include/linux/kconfig.h

    and the kernelspace set (represented by the LINUXINCLUDE make variable)
    contains:

    -I $(srctree)/arch/$(hdr-arch)/include
    -I arch/$(hdr-arch)/include/generated
    -I $(srctree)/include
    -I include --- if not building in the source tree

    plus everything in the USERINCLUDE set.

    Then use USERINCLUDE in building the x86 boot code.

    Signed-off-by: David Howells
    Acked-by: Arnd Bergmann
    Acked-by: Thomas Gleixner
    Acked-by: Paul E. McKenney
    Acked-by: Dave Jones

    David Howells
     

06 May, 2012

1 commit

  • Move the final link of vmlinux to a script to improve
    readability and maintainability of the code.

    The Makefile fragments used to link vmlinux has over the
    years seen far too many changes and the logic had become
    hard to follow.

    As the process by nature is serialized there was
    nothing gained including this in the Makefile.

    "um" has special link requirments - and the
    only way to handle this was to hard-code the linking
    of "um" in the script.
    This was better than trying to modularize it only for the
    benefit of "um" anyway.

    The shell script has been improved after input from:
    Arnaud Lacombe
    Nick Bowler

    Signed-off-by: Sam Ravnborg
    Cc: Arnaud Lacombe
    Cc: Nick Bowler
    Cc: Richard Weinberger
    Signed-off-by: Michal Marek

    Sam Ravnborg
     

25 Mar, 2012

2 commits

  • x86_64 UML is unable to load modules if more than 504MiB
    of memory are used.
    This happens because on x86_64 the UML process has a quite high
    start address (typically around 0x6000000).
    If UML's memory is larger than 504MiB VMALLOC_START happens to be after
    0x8000000. This is no problem unless one loads a module which was built
    with R_X86_64_32S relocations.
    Symbols with a location > 0x8000000 cannot be used with R_X86_64_32S

    To deal with this x86_64 UML has to be compiled with -mcmodel=large
    such that no R_X86_64_32S relocations are used.

    Signed-off-by: Richard Weinberger
    Reported-by: 전하늘

    Richard Weinberger
     
  • Signed-off-by: Al Viro
    [richard@nod.at: Re-export SUBARCH in arch/um/Makefile]
    Signed-off-by: Richard Weinberger

    Al Viro
     

10 Dec, 2011

1 commit


06 Dec, 2011

2 commits


02 Nov, 2011

8 commits


15 Sep, 2011

1 commit

  • richard@nod.at:
    Fixes:
    /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/libc.a(strrchr.o): In function `rindex':
    (.text+0x0): multiple definition of `strrchr'

    If both STATIC_LINK and UML_NET_VDE are set to "y" libc's strrchr may
    clash with the kernel implementation.

    This workaround comes originally from Jeff Dike:
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=494995#35

    Signed-off-by: Al Viro
    Signed-off-by: Richard Weinberger
    Cc: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Al Viro
     

12 Dec, 2009

1 commit

  • The simplest method was to add an extra asm-offsets.h
    file in arch/$ARCH/include/asm that references the generated file.

    We can now migrate the architectures one-by-one to reference
    the generated file direct - and when done we can delete the
    temporary arch/$ARCH/include/asm/asm-offsets.h file.

    Signed-off-by: Sam Ravnborg
    Cc: Al Viro
    Signed-off-by: Michal Marek

    Sam Ravnborg
     

20 Sep, 2009

1 commit

  • Albin Tonnerre reported:

    Bash 4 filters out variables which contain a dot in them.
    This happends to be the case of CPPFLAGS_vmlinux.lds.
    This is rather unfortunate, as it now causes
    build failures when using SHELL=/bin/bash to compile,
    or when bash happens to be used by make (eg when it's /bin/sh)

    Remove the common definition of CPPFLAGS_vmlinux.lds by
    pushing relevant stuff to either Makefile.build or the
    arch specific kernel/Makefile where we build the linker script.

    This is also nice cleanup as we move the information out where
    it is used.

    Notes for the different architectures touched:

    arm - we use an already exported symbol
    cris - we use a config symbol aleady available
    [Not build tested]
    mips - the jiffies complexity has moved to vmlinux.lds.S where we need it.
    Added a few variables to CPPFLAGS - they are only used by
    the linker script.
    [Not build tested]
    powerpc - removed assignment that is not needed
    [not build tested]
    sparc - simplified it using $(BITS)
    um - introduced a few new exported variables to deal with this
    xtensa - added options to CPP invocation
    [not build tested]

    Cc: Albin Tonnerre
    Cc: Russell King
    Cc: Mikael Starvik
    Cc: Jesper Nilsson
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: "David S. Miller"
    Cc: Jeff Dike
    Cc: Chris Zankel
    Signed-off-by: Sam Ravnborg

    Sam Ravnborg
     

06 Jan, 2009

1 commit

  • We need to make asm-offsets.h contents visible for objects built
    with userland headers. Instead of creating a symlink, just have the
    file with equivalent include (relative to location of header) created
    once. That kills the last symlink used in arch/um builds.

    Additionally, both generated headers can become dependencies of
    archprepare now, killing the misuse of prepare.

    Signed-off-by: Al Viro
    Signed-off-by: Linus Torvalds

    Al Viro