DESK-RZ-L/Development/Building Linux kernel

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes
2025/12/16 DESK-RZ-L-1.x.x release



Building Linux[edit | edit source]

Quick reference[edit | edit source]

Repository Information
URL https://git.dave.eu/git/desk-rz-l/rz-linux-cip.git
stable branch desk-rz-l-1.x.x
stable tag desk-rz-l-1.0.0
Build Information
defconfig defconfig
Kernel binary Image
Device trees ConfigID DTB
2002 renesas/rzt2h-eb23-cb2002.dtb
2003 renesas/rzt2h-eb23-cb2003.dtb

Instructions[edit | edit source]

It is assumed that the development environment has been set up properly as described here.

  • Start the Linux development VM and log in to the system
  • Open a terminal window and clone the repository
  • Configure the build environment
dvdk@vagrant:~/desk-rz-l/rz-linux-cip$ source ~/desk-rz-l/desk-rz-l-1.0.0_env.sh 
  • Enter the source tree directory
  • Setup defconfig
dvdk@vagrant:~/desk-rz-l/rz-linux-cip$ make defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
*** Default configuration is based on 'defconfig'
#
# configuration written to .config
#
dvdk@vagrant:~/desk-rz-l/rz-linux-cip$
  • Build kernel Image:
dvdk@vagrant:~/desk-rz-l/rz-linux-cip$ make -j 8
...
  CC      drivers/iio/industrialio-core.o
  CC      drivers/iio/inkern.o
  AR      drivers/tee/optee/built-in.a
  AR      drivers/tee/built-in.a
  AR      drivers/iio/potentiometer/built-in.a
  AR      drivers/iio/built-in.a
  AR      drivers/built-in.a
  GEN     .version
  CHK     include/generated/compile.h
  LD      vmlinux.o
  MODPOST vmlinux.symvers
  MODINFO modules.builtin.modinfo
  GEN     modules.builtin
  LD      .tmp_vmlinux.kallsyms1
  KSYMS   .tmp_vmlinux.kallsyms1.S
  AS      .tmp_vmlinux.kallsyms1.S
  LD      .tmp_vmlinux.kallsyms2
  KSYMS   .tmp_vmlinux.kallsyms2.S
  AS      .tmp_vmlinux.kallsyms2.S
  LD      vmlinux
  SORTTAB vmlinux
  SYSMAP  System.map
  OBJCOPY arch/arm64/boot/Image
dvdk@vagrant:~/desk-rz-l/rz-linux-cip$
  • Build the DTBs:
dvdk@vagrant:~/desk-rz-l/rz-linux-cip$ make renesas/rzt2h-eb23-cb2003.dtb
  DTC     arch/arm64/boot/dts/renesas/rzt2h-eb23-cb2003.dtb
dvdk@vagrant:~/desk-rz-l/rz-linux-cip$ make renesas/rzt2h-eb23-cb2002.dtb
  DTC     arch/arm64/boot/dts/renesas/rzt2h-eb23-cb2002.dtb
dvdk@vagrant:~/desk-rz-l/rz-linux-cip$
  • Optional: build the modules
dvdk@vagrant:~/desk-rz-l/rz-linux-cip$ make modules -j 8
  CALL    scripts/atomic/check-atomics.sh
  CALL    scripts/checksyscalls.sh
  CC [M]  fs/efivarfs/inode.o
  CC [M]  fs/efivarfs/file.o
  CC [M]  fs/efivarfs/super.o
  LD [M]  fs/efivarfs/efivarfs.o
  LDS     scripts/module.lds
  CC [M]  drivers/pci/pcie/aer_inject.o
  CC [M]  drivers/pci/endpoint/functions/pci-epf-test.o
  CC [M]  drivers/xen/gntdev.o
  CC [M]  drivers/xen/gntalloc.o
  LD [M]  drivers/xen/xen-gntalloc.o
  CC [M]  drivers/mtd/tests/oobtest.o
  LD [M]  drivers/xen/xen-gntdev.o
  CC [M]  drivers/input/misc/uinput.o
  CC [M]  drivers/mtd/tests/mtd_test.o
  CC [M]  drivers/usb/gadget/function/f_acm.o
  CC [M]  drivers/usb/gadget/legacy/ether.o
  CC [M]  drivers/mtd/tests/pagetest.o
  CC [M]  drivers/usb/gadget/legacy/mass_storage.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/main.o
  CC [M]  drivers/usb/gadget/function/u_serial.o
  CC [M]  drivers/input/mousedev.o
  CC [M]  drivers/mtd/tests/readtest.o
  CC [M]  drivers/mtd/tests/speedtest.o
  CC [M]  drivers/usb/gadget/legacy/serial.o
  CC [M]  drivers/usb/gadget/function/f_serial.o
  CC [M]  drivers/mtd/tests/stresstest.o
  CC [M]  drivers/mtd/tests/subpagetest.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/init.o
  LD [M]  drivers/usb/gadget/legacy/g_ether.o
  LD [M]  drivers/usb/gadget/legacy/g_mass_storage.o
  LD [M]  drivers/usb/gadget/legacy/g_serial.o
  CC [M]  drivers/usb/gadget/function/f_obex.o
  CC [M]  drivers/usb/gadget/usbstring.o
  CC [M]  drivers/usb/gadget/config.o
  CC [M]  drivers/mtd/tests/torturetest.o
  CC [M]  drivers/usb/gadget/epautoconf.o
  CC [M]  drivers/mtd/tests/mtd_nandecctest.o
  CC [M]  drivers/usb/gadget/composite.o
  CC [M]  drivers/usb/gadget/function/u_ether.o
  CC [M]  drivers/usb/gadget/functions.o
  CC [M]  drivers/mtd/tests/nandbiterrs.o
  CC [M]  drivers/usb/gadget/function/f_ecm.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/cfp.o
  CC [M]  drivers/usb/gadget/configfs.o
  LD [M]  drivers/mtd/tests/mtd_oobtest.o
  LD [M]  drivers/mtd/tests/mtd_pagetest.o
  CC [M]  drivers/usb/gadget/u_f.o
  LD [M]  drivers/mtd/tests/mtd_readtest.o
  LD [M]  drivers/mtd/tests/mtd_speedtest.o
  LD [M]  drivers/mtd/tests/mtd_stresstest.o
  CC [M]  drivers/media/usb/uvc/uvc_driver.o
  LD [M]  drivers/mtd/tests/mtd_subpagetest.o
  LD [M]  drivers/mtd/tests/mtd_torturetest.o
  LD [M]  drivers/mtd/tests/mtd_nandbiterrs.o
  CC [M]  drivers/usb/gadget/function/f_subset.o
  CC [M]  drivers/media/usb/gspca/gspca.o
  CC [M]  drivers/usb/gadget/function/f_rndis.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/cmdevt.o
  LD [M]  drivers/usb/gadget/libcomposite.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/util.o
  CC [M]  drivers/media/usb/uvc/uvc_queue.o
  CC [M]  drivers/usb/gadget/function/rndis.o
  CC [M]  drivers/media/usb/gspca/autogain_functions.o
  CC [M]  drivers/usb/gadget/function/f_mass_storage.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/txrx.o
  CC [M]  drivers/media/usb/uvc/uvc_v4l2.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/wmm.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/11n.o
  LD [M]  drivers/media/usb/gspca/gspca_main.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/11ac.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/11n_aggr.o
  CC [M]  drivers/usb/gadget/function/storage_common.o
  CC [M]  drivers/media/usb/uvc/uvc_video.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/11n_rxreorder.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/scan.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/join.o
  LD [M]  drivers/usb/gadget/function/usb_f_acm.o
  LD [M]  drivers/usb/gadget/function/usb_f_serial.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/sta_ioctl.o
  LD [M]  drivers/usb/gadget/function/usb_f_obex.o
  LD [M]  drivers/usb/gadget/function/usb_f_ecm.o
  LD [M]  drivers/usb/gadget/function/usb_f_ecm_subset.o
  LD [M]  drivers/usb/gadget/function/usb_f_rndis.o
  LD [M]  drivers/usb/gadget/function/usb_f_mass_storage.o
  CC [M]  drivers/media/usb/uvc/uvc_ctrl.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/sta_cmd.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/uap_cmd.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/ie.o
  CC [M]  drivers/media/usb/uvc/uvc_status.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/sta_cmdresp.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/sta_event.o
  CC [M]  drivers/media/usb/uvc/uvc_isight.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/uap_event.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/sta_tx.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/sta_rx.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/uap_txrx.o
  CC [M]  drivers/media/usb/uvc/uvc_debugfs.o
  CC [M]  drivers/media/usb/uvc/uvc_metadata.o
  CC [M]  drivers/media/usb/uvc/uvc_entity.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/cfg80211.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/ethtool.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/11h.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/tdls.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/debugfs.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/pcie.o
  LD [M]  drivers/media/usb/uvc/uvcvideo.o
  LD [M]  drivers/net/wireless/marvell/mwifiex/mwifiex.o
  LD [M]  drivers/net/wireless/marvell/mwifiex/mwifiex_pcie.o
  MODPOST modules-only.symvers
  GEN     Module.symvers
  CC [M]  drivers/input/misc/uinput.mod.o
  CC [M]  drivers/input/mousedev.mod.o
  CC [M]  drivers/media/usb/gspca/gspca_main.mod.o
  CC [M]  drivers/media/usb/uvc/uvcvideo.mod.o
  CC [M]  drivers/mtd/tests/mtd_nandbiterrs.mod.o
  CC [M]  drivers/mtd/tests/mtd_nandecctest.mod.o
  CC [M]  drivers/mtd/tests/mtd_oobtest.mod.o
  CC [M]  drivers/mtd/tests/mtd_pagetest.mod.o
  CC [M]  drivers/mtd/tests/mtd_readtest.mod.o
  CC [M]  drivers/mtd/tests/mtd_speedtest.mod.o
  CC [M]  drivers/mtd/tests/mtd_stresstest.mod.o
  CC [M]  drivers/mtd/tests/mtd_subpagetest.mod.o
  CC [M]  drivers/mtd/tests/mtd_torturetest.mod.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/mwifiex.mod.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/mwifiex_pcie.mod.o
  CC [M]  drivers/pci/endpoint/functions/pci-epf-test.mod.o
  CC [M]  drivers/pci/pcie/aer_inject.mod.o
  CC [M]  drivers/usb/gadget/function/u_ether.mod.o
  CC [M]  drivers/usb/gadget/function/u_serial.mod.o
  CC [M]  drivers/usb/gadget/function/usb_f_acm.mod.o
  CC [M]  drivers/usb/gadget/function/usb_f_ecm.mod.o
  CC [M]  drivers/usb/gadget/function/usb_f_ecm_subset.mod.o
  CC [M]  drivers/usb/gadget/function/usb_f_mass_storage.mod.o
  CC [M]  drivers/usb/gadget/function/usb_f_obex.mod.o
  CC [M]  drivers/usb/gadget/function/usb_f_rndis.mod.o
  CC [M]  drivers/usb/gadget/function/usb_f_serial.mod.o
  CC [M]  drivers/usb/gadget/legacy/g_ether.mod.o
  CC [M]  drivers/usb/gadget/legacy/g_mass_storage.mod.o
  CC [M]  drivers/usb/gadget/legacy/g_serial.mod.o
  CC [M]  drivers/usb/gadget/libcomposite.mod.o
  CC [M]  drivers/xen/xen-gntalloc.mod.o
  CC [M]  drivers/xen/xen-gntdev.mod.o
  CC [M]  fs/efivarfs/efivarfs.mod.o
  LD [M]  drivers/input/misc/uinput.ko
  LD [M]  drivers/input/mousedev.ko
  LD [M]  drivers/media/usb/gspca/gspca_main.ko
  LD [M]  drivers/media/usb/uvc/uvcvideo.ko
  LD [M]  drivers/mtd/tests/mtd_nandbiterrs.ko
  LD [M]  drivers/mtd/tests/mtd_nandecctest.ko
  LD [M]  drivers/mtd/tests/mtd_oobtest.ko
  LD [M]  drivers/mtd/tests/mtd_pagetest.ko
  LD [M]  drivers/mtd/tests/mtd_readtest.ko
  LD [M]  drivers/mtd/tests/mtd_speedtest.ko
  LD [M]  drivers/mtd/tests/mtd_stresstest.ko
  LD [M]  drivers/mtd/tests/mtd_subpagetest.ko
  LD [M]  drivers/net/wireless/marvell/mwifiex/mwifiex.ko
  LD [M]  drivers/net/wireless/marvell/mwifiex/mwifiex_pcie.ko
  LD [M]  drivers/mtd/tests/mtd_torturetest.ko
  LD [M]  drivers/pci/endpoint/functions/pci-epf-test.ko
  LD [M]  drivers/pci/pcie/aer_inject.ko
  LD [M]  drivers/usb/gadget/function/u_ether.ko
  LD [M]  drivers/usb/gadget/function/u_serial.ko
  LD [M]  drivers/usb/gadget/function/usb_f_acm.ko
  LD [M]  drivers/usb/gadget/function/usb_f_ecm.ko
  LD [M]  drivers/usb/gadget/function/usb_f_ecm_subset.ko
  LD [M]  drivers/usb/gadget/function/usb_f_mass_storage.ko
  LD [M]  drivers/usb/gadget/function/usb_f_obex.ko
  LD [M]  drivers/usb/gadget/function/usb_f_rndis.ko
  LD [M]  drivers/usb/gadget/function/usb_f_serial.ko
  LD [M]  drivers/usb/gadget/legacy/g_ether.ko
  LD [M]  drivers/usb/gadget/legacy/g_mass_storage.ko
  LD [M]  drivers/usb/gadget/legacy/g_serial.ko
  LD [M]  drivers/usb/gadget/libcomposite.ko
  LD [M]  drivers/xen/xen-gntalloc.ko
  LD [M]  fs/efivarfs/efivarfs.ko
  LD [M]  drivers/xen/xen-gntdev.ko
dvdk@vagrant:~/desk-rz-l/rz-linux-cip$ 

NOTE: This is the default configuration suitable for the latest target.

The former command selects the default DESK-RZ-L configuration, while the latter builds the kernel binary image with the required U-Boot header and the kernel device tree.

Default Linux kernel configuration can be changed by using the standard menuconfig, xconfig, or gconfig make target. Subsequent builds just require Image make target to update the binary image. Once the build process is complete, the kernel binary image is stored in the arch/arm/boot/Image file. Both this file and the kernel device tree can be copied to the tftp root directory /tftpboot/boot/ with the following commands:

dvdk@vagrant:~/desk-rz-l/rz-linux-cip$ cp arch/arm64/boot/Image /tftpboot/boot/
dvdk@vagrant:~/desk-rz-l/rz-linux-cip$ cp arch/arm64/boot/dts/renesas/*.dtb /tftpboot/boot/

Usually, kernel modules are installed with the make modules_install command, but this method installs the modules into the /lib/modules directory of your MVM, which is not what you want.

A better way to deploy kernel modules while cross-compiling is

  • generate a .tar.gz archive
  • install this archive into the target root file system

The user can create such an archive, for example, using the following commands:

dvdk@vagrant:~/desk-rz-l/rz-linux-cip$ mkdir modules-install
dvdk@vagrant:~/desk-rz-l/rz-linux-cip$ make INSTALL_MOD_PATH=modules-install modules_install
dvdk@vagrant:~/desk-rz-l/rz-linux-cip$ cd modules-install
dvdk@vagrant:~/desk-rz-l/rz-linux-cip/modules-install$ tar cvzf ../modules.tar.gz . && cd ..
dvdk@vagrant:~/desk-rz-l/rz-linux-cip$

Now copy modules.tar.gz into the target root file system and install them as root with the following command

root@desk-t2h-usd-devel:~# tar xvzf modules.tar.gz -C /