Getting error "missing destination file operand after 'arch/arm64/boot/dts/'" when building kernel

I took the sources from the Jetson Download Center (https://developer.nvidia.com/embedded/downloads | L4T Sources for L4T 32.1) and generated the Image and dtb files as indicated in the Kernel Customization section of the Documentation for L4T 32.1. That went all well, and then I achieved to flash the kernel as follows:

sudo ./flash.sh -r -k kernel jetson-tx2 mmcblk0p1

After that, I built a simple char driver, which is working when I build the binary files and load them as a module (insmod *.ko file, mknod /dev/mydev …). Now, I wanted to include it in the kernel, so I copied the char_driver.c file to

kernel-4.9/drivers/char/

And modified the Kconfig and Makefile of this path, including:
Makefile add:

obj-$(CONFIG_HELLOWORLD)	+= helloworld_char_driver.o

Kconfig add:

config HELLOWORLD
	tristate "My simple helloworld driver"
	default n
	help
	  The simplest driver.

I keep proceeding as defined in the Kernel Customization docs, althoug instead of doing “make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig” I just activate the driver doing “make ARCH=arm64 O=$TEGRA_KERNEL_OUT menuconfig” and then save the .config file. Anyway, when building it, it crashes:
Cmd:

make ARCH=arm64 O=$TEGRA_KERNEL_OUT -j12

Output:

make[1]: Entering directory '/home/julen/kernel_src/kernel_out'
  GEN     ./Makefile
  HOSTCC  scripts/kconfig/conf.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  GEN     ./Makefile
  WRAP    arch/arm64/include/generated/asm/bugs.h
  WRAP    arch/arm64/include/generated/asm/clkdev.h
  WRAP    arch/arm64/include/generated/asm/cputime.h
  WRAP    arch/arm64/include/generated/asm/delay.h
  WRAP    arch/arm64/include/generated/asm/div64.h
  WRAP    arch/arm64/include/generated/asm/dma.h
  WRAP    arch/arm64/include/generated/asm/dma-contiguous.h
  WRAP    arch/arm64/include/generated/asm/early_ioremap.h
  WRAP    arch/arm64/include/generated/asm/emergency-restart.h
  WRAP    arch/arm64/include/generated/asm/errno.h
  WRAP    arch/arm64/include/generated/asm/hw_irq.h
  WRAP    arch/arm64/include/generated/asm/ioctl.h
  WRAP    arch/arm64/include/generated/asm/ioctls.h
  WRAP    arch/arm64/include/generated/asm/ipcbuf.h
  WRAP    arch/arm64/include/generated/asm/irq_regs.h
  CHK     include/generated/uapi/linux/version.h
  WRAP    arch/arm64/include/generated/asm/kdebug.h
  WRAP    arch/arm64/include/generated/asm/kmap_types.h
  WRAP    arch/arm64/include/generated/asm/kvm_para.h
  WRAP    arch/arm64/include/generated/asm/local.h
  WRAP    arch/arm64/include/generated/asm/local64.h
  UPD     include/generated/uapi/linux/version.h
  WRAP    arch/arm64/include/generated/asm/mcs_spinlock.h
  WRAP    arch/arm64/include/generated/asm/mm-arch-hooks.h
  WRAP    arch/arm64/include/generated/asm/mman.h
  WRAP    arch/arm64/include/generated/asm/msgbuf.h
  WRAP    arch/arm64/include/generated/asm/msi.h
  WRAP    arch/arm64/include/generated/asm/mutex.h
  WRAP    arch/arm64/include/generated/asm/poll.h
  WRAP    arch/arm64/include/generated/asm/preempt.h
  WRAP    arch/arm64/include/generated/asm/resource.h
  WRAP    arch/arm64/include/generated/asm/rwsem.h
  WRAP    arch/arm64/include/generated/asm/segment.h
  WRAP    arch/arm64/include/generated/asm/sembuf.h
  WRAP    arch/arm64/include/generated/asm/serial.h
  WRAP    arch/arm64/include/generated/asm/shmbuf.h
  WRAP    arch/arm64/include/generated/asm/simd.h
  WRAP    arch/arm64/include/generated/asm/sizes.h
  WRAP    arch/arm64/include/generated/asm/socket.h
  WRAP    arch/arm64/include/generated/asm/sockios.h
  WRAP    arch/arm64/include/generated/asm/swab.h
  WRAP    arch/arm64/include/generated/asm/switch_to.h
  WRAP    arch/arm64/include/generated/asm/termbits.h
  WRAP    arch/arm64/include/generated/asm/termios.h
  WRAP    arch/arm64/include/generated/asm/trace_clock.h
  WRAP    arch/arm64/include/generated/asm/types.h
  WRAP    arch/arm64/include/generated/asm/unaligned.h
  WRAP    arch/arm64/include/generated/asm/user.h
  WRAP    arch/arm64/include/generated/asm/vga.h
  WRAP    arch/arm64/include/generated/asm/xor.h
  WRAP    arch/arm64/include/generated/uapi/asm/kvm_para.h
  HOSTCC  scripts/basic/bin2c
  UPD     include/config/kernel.release
  Using /home/julen/kernel_src/kernel/kernel-4.9 as source for kernel
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  HOSTCC  scripts/dtc/dtc.o
  HOSTCC  scripts/dtc/flattree.o
  HOSTCC  scripts/dtc/fstree.o
  HOSTCC  scripts/dtc/data.o
  HOSTCC  scripts/dtc/livetree.o
  HOSTCC  scripts/dtc/treesource.o
  HOSTCC  scripts/dtc/srcpos.o
  HOSTCC  scripts/dtc/checks.o
  HOSTCC  scripts/dtc/util.o
  CC      scripts/mod/empty.o
  SHIPPED scripts/dtc/dtc-lexer.lex.c
  SHIPPED scripts/dtc/dtc-parser.tab.h
  HOSTCC  scripts/mod/mk_elfconfig
  CHK     include/generated/timeconst.h
  UPD     include/generated/timeconst.h
  CC      kernel/bounds.s
  HOSTCC  scripts/selinux/genheaders/genheaders
  HOSTCC  scripts/selinux/mdp/mdp
  CC      scripts/mod/devicetable-offsets.s
  HOSTCC  scripts/kallsyms
  CHK     include/generated/bounds.h
  UPD     include/generated/bounds.h
  HOSTCC  scripts/conmakehash
  GEN     scripts/gdb/linux/constants.py
  MKELF   scripts/mod/elfconfig.h
  CHK     scripts/mod/devicetable-offsets.h
  UPD     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/recordmcount
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/sumversion.o
  CC      arch/arm64/kernel/asm-offsets.s
  SHIPPED scripts/dtc/dtc-parser.tab.c
  HOSTCC  scripts/sortextable
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  HOSTCC  scripts/asn1_compiler
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  HOSTCC  scripts/sign-file
  HOSTCC  scripts/extract-cert
  HOSTLD  scripts/dtc/dtc
  HOSTCC  scripts/insert-sys-cert
  CHK     include/generated/asm-offsets.h
  UPD     include/generated/asm-offsets.h
  CALL    /home/julen/kernel_src/kernel/kernel-4.9/scripts/checksyscalls.sh
  HOSTLD  scripts/mod/modpost
cp -u   arch/arm64/boot/dts/
cp: missing destination file operand after 'arch/arm64/boot/dts/'
Try 'cp --help' for more information.
/home/julen/kernel_src/kernel/kernel-4.9/arch/arm64/boot/dts/Makefile:136: recipe for target 'dtbs' failed
make[2]: *** [dtbs] Error 1
arch/arm64/Makefile:154: recipe for target 'dtbs' failed
make[1]: *** [dtbs] Error 2
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/julen/kernel_src/kernel_out'
Makefile:171: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

Any suggestion on why this is happening?

Just a comment on this command to start with:

make ARCH=arm64 O=$TEGRA_KERNEL_OUT -j12

This builds everything…not just a kernel. Even things you may not have configured, and tegra18_defconfig will only configure for kernel/modules. Name a target…e.g., “Image”:

make ARCH=arm64 O=$TEGRA_KERNEL_OUT -j12 <b>Image</b>

Also, be sure that if you are reusing the original module directory that the “CONFIG_LOCALVERSION” is a match for the existing suffix of “uname -r” (often that is “-tegra”).

Note that you can only start with “make menuconfig” if you have a preexisting configuration to start with. Otherwise you must configure every option before you know it will succeed. I like to start with a copy of the existing system’s config from “/proc/config.gz” (which is not a real file…it is a reflection in RAM of the current running kernel’s config).

That solved the problem! I cleaned the $TEGRA_KERNEL_OUT directory, then first build the .config file with tegra_defconfig, and after that, I activated the modules I wanted with make menuconfig. Moreover, as you pointed out, I named the target also, and the Image correctly built. Thanks!

1 Like