DVB support for R2

My intention is to have DVB support available in R2 in order to use it as Tvheadend server with USB DVB stick. Currently I run the latest available Ubuntu Mate image 2017-09-04-ubuntu-16.04-mate-desktop-bpi-r2-sd-emmc-v1.2.0.img on my R2. So started to build DVB modules provided by linuxtv.org but I ended very soon with the following error:

File not found: /lib/modules/4.4.70-BPI-R2-Kernel/build/.config

The /lib/modules/4.4.70-BPI-R2-Kernel/build is symlinked to a nonexisting /work/BPI-R2-bsp/linux-mt. I installed linux-headers-generic and kernel-source from default repositories but it didn’t helped because it installed these for kernel 4.4.0-97.

Could you please anybody give me an advise how to get the right 4.4.70-BPI-R2-Kernel source and headers into my R2?

Thank you in advance.

Thank you Frank. Ok, I cloned kernel source, changed symlinks to point from /lib/modules/4.4.70-BPI-R2-Kernel/build and source to linux-mt directory in cloned kernel source. But the problem remains because the requested .config file is missing in this directory. Do not know how to get it so I just tried to create it as a symlink to Kconfig file in the same directory. And started again building the DVB support. Now it complains as follows:

Preparing to compile for kernel version 4.4.70
You appear to have loadable modules turned off in your kernel.  You can
not compile the v4l-dvb drivers, as modules, and use them with a kernel
that has modules disabled.

If you want to compile these drivers into your kernel, you should
use 'make kernel-links' to link the source for these drivers into
your kernel tree.  Then configure and compile the kernel.

Are loadable modules really turned off in kernel? Or is this just result of my mistake when I made .config the same as Kconfig? So how to turn loadable modules on or better how to get (make) the right .config in kernel sources? I’m sorry for my stupid questions, but I do not have experience with kernel bulding and the things around…

.config and Kconfig are 2 different files. Kconfig defines entries for menuconfig and .config is configuration of kernel. You can create .config by importing the defconfig using “make mt7623n_evb_bpi_defconfig” in folder linux-mt (the folder where are kernel-sources). The defconfig itself lies in arch/arm/configs

unless your DVB hardware handles its own scaling (probably not) then the framerate will be terrible - there’s no hardware scaling in X11 atm

Not a problem. I don’t want to play DVB streams on R2. Just to make it a Tvheadend server for streaming to another clients on LAN. So only SATA and GLAN performance is of my concern. Right after making my USB DVB stick working well with R2, of course…:slight_smile:

1 Like

Please clone the code to a host , and run ./build with option 1 to build entire BSP.

And then build DVB driver on the host,(cross compiling).

Thank you gary, I will try that.

BTW: I believe I’m already not far from having DVB support successfully built on R2. Thanks to @frank-w help I proceeded to the point where most of the DVB divers are built but it failed on building the others. I already thought of cross compiling on host (building on R2 is too slow) but didn’t know how to do…

Unfortunately I’m not able to build BSD. I do it in a virtual machine with Ubuntu Mate 16.04.03 32 bit. Both gcc-arm-linux-gnueabihf and u-boot-tools are installed. There are many warnings in the build output and finally it ends with syntax error I really don’t uderstand.

Any idea what is wrong?

NOTICE:
new build.sh default select BPI-R2-720P and pack all boards
supported boards:
BPI-R2-720P

BPI-R2-720P configured. Now run `make`
This tool support following building mode(s):
--------------------------------------------------------------------------------
	1. Build all, uboot and kernel and pack to download images.
	2. Build uboot only.
	3. Build kernel only.
	4. kernel configure.
	5. Pack the builds to target download image, this step must execute after u-boot,
	   kernel and rootfs build out
	6. update files for SD
	7. Clean all build.
--------------------------------------------------------------------------------
Please choose a mode(1-7): 1

 Now building...

make -C u-boot-mt mt7623_evb_config CROSS_COMPILE=arm-linux-gnueabihf- -j8
make[1]: Entering directory '/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt'
Configuring for mt7623_evb board...
make[1]: Leaving directory '/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt'
make -C u-boot-mt all CROSS_COMPILE=arm-linux-gnueabihf- -j8
make[1]: Entering directory '/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt'
  GEN     include/autoconf.mk.dep
  GEN     include/autoconf.mk
  CHK     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/version_autogenerated.h
  UPD     include/config/uboot.release
  UPD     include/generated/timestamp_autogenerated.h
  HOSTCC  scripts/basic/fixdep
  CC      lib/asm-offsets.s
  GEN     include/generated/generic-asm-offsets.h
  LDS     u-boot.lds
  HOSTCC  tools/aisimage.o
  HOSTCC  tools/crc32.o
  HOSTCC  tools/default_image.o
  HOSTCC  tools/dumpimage.o
  HOSTCC  tools/gen_eth_addr
  HOSTCC  tools/fdt.o
  HOSTCC  tools/img2srec
  HOSTCC  tools/fdt_ro.o
  HOSTCC  tools/fdt_rw.o
  HOSTCC  tools/fdt_strerror.o
  HOSTCC  tools/fdt_wip.o
  HOSTCC  tools/fit_image.o
  HOSTCC  tools/image-fit.o
  HOSTCC  tools/image-host.o
  HOSTCC  tools/image.o
  HOSTCC  tools/imagetool.o
  HOSTCC  tools/imximage.o
  HOSTCC  tools/kwbimage.o
  HOSTCC  tools/md5.o
  HOSTCC  tools/mkenvimage.o
  HOSTCC  tools/mkimage.o
  HOSTCC  tools/mxsimage.o
  HOSTCC  tools/omapimage.o
  HOSTCC  tools/os_support.o
  HOSTCC  tools/pblimage.o
  HOSTCC  tools/sha1.o
  HOSTCC  tools/ublimage.o
  HOSTCC  tools/proftool
  HOSTLD  tools/mkenvimage
  HOSTLD  tools/dumpimage
  HOSTLD  tools/mkimage
  LD      arch/arm/cpu/built-in.o
  AS      arch/arm/cpu/armv7/mt7623/lowlevel_init.o
  CC      board/mediatek/common/mtk_cmd.o
  CC      arch/arm/cpu/armv7/cache_v7.o
  CC      disk/part.o
board/mediatek/common/mtk_cmd.c: In function ‘do_read_mtk_image_blks’:
board/mediatek/common/mtk_cmd.c:162:13: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat=]
      printf("[%s]Bad Magic Number = 0x%x\n", 
             ^
board/mediatek/common/mtk_cmd.c:172:12: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat=]
     printf("[%s]Good Magic Number = 0x%x\n", 
            ^
board/mediatek/common/mtk_cmd.c:174:12: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat=]
     printf("[%s]Good Data size = 0x%x\n", 
            ^
board/mediatek/common/mtk_cmd.c:176:12: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘long unsigned int’ [-Wformat=]
     printf("[%s]Good name = %s\n", 
            ^
board/mediatek/common/mtk_cmd.c:180:12: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat=]
     printf("[%s]img_size = 0x%x\n", __func__, img_size);
            ^
board/mediatek/common/mtk_cmd.c:140:21: warning: unused variable ‘img_hdr’ [-Wunused-variable]
     image_header_t *img_hdr = (image_header_t *)load_addr;
                     ^
board/mediatek/common/mtk_cmd.c: In function ‘do_serious_image_check’:
board/mediatek/common/mtk_cmd.c:225:33: warning: unused variable ‘len’ [-Wunused-variable]
  __u32 chksum = 0, chksum2 = 0, len = 0; 
                                 ^
board/mediatek/common/mtk_cmd.c:225:20: warning: unused variable ‘chksum2’ [-Wunused-variable]
  __u32 chksum = 0, chksum2 = 0, len = 0; 
                    ^
board/mediatek/common/mtk_cmd.c:225:8: warning: unused variable ‘chksum’ [-Wunused-variable]
  __u32 chksum = 0, chksum2 = 0, len = 0; 
        ^
board/mediatek/common/mtk_cmd.c:223:17: warning: unused variable ‘header’ [-Wunused-variable]
  image_header_t header;
                 ^
board/mediatek/common/mtk_cmd.c: In function ‘do_backup_message’:
board/mediatek/common/mtk_cmd.c:262:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
board/mediatek/common/mtk_cmd.c: In function ‘do_reco_message’:
board/mediatek/common/mtk_cmd.c:268:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
  LD      board/mediatek/common/built-in.o
  LD      drivers/block/built-in.o
  AS      arch/arm/lib/crt0.o
  CC      board/mediatek/mt7623_evb/mt7623_evb.o
  CC      common/main.o
  LD      drivers/dma/built-in.o
  LD      drivers/crypto/built-in.o
  CC      arch/arm/cpu/armv7/mt7623/init.o
  CC      disk/part_dos.o
  CC      arch/arm/cpu/armv7/cpu.o
  AS      arch/arm/lib/relocate.o
  LD      disk/built-in.o
  CC      board/mediatek/mt7623_evb/mt_gpt.o
  LD      drivers/dfu/built-in.o
  CC      common/command.o
  CC      arch/arm/cpu/armv7/mt7623/reset.o
  LD      drivers/gpio/built-in.o
  LD      drivers/hwmon/built-in.o
  CC      arch/arm/cpu/armv7/syslib.o
  CC      arch/arm/lib/board.o
  LD      arch/arm/cpu/armv7/mt7623/built-in.o
arch/arm/lib/board.c:517:0: warning: "MCUSYS_CFGREG_BASE" redefined
 #define MCUSYS_CFGREG_BASE           0x10200000
 ^
In file included from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/configs/mt7623_evb.h:22:0,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/config.h:10,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/common.h:18,
                 from arch/arm/lib/board.c:25:
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/arch/arm/include/asm/arch/mt_reg_base.h:21:0: note: this is the location of the previous definition
 #define MCUSYS_CFGREG_BASE  (IO_PHYS + 0x00200000)
 ^
  CC      drivers/flash/mtk_nor.o
  CC      board/mediatek/mt7623_evb/uart.o
  CC      common/exports.o
In file included from drivers/flash/mtk_nor.c:48:0:
drivers/flash/mtk_nor.c: In function ‘mt53xx_nor_SendCmd’:
drivers/flash/mtk_nor.c:568:43: warning: suggest parentheses around ‘+’ in operand of ‘&’ [-Wparentheses]
   SFLASH_WREG8(SFLASH_CMD_REG, index*0x40 + cmdval);
                                           ^
drivers/flash/mtk_nor.h:228:102: note: in definition of macro ‘SFLASH_WREG8’
 e SFLASH_WREG8(offset, value)       ((*(volatile unsigned int *)(SFLASH_REG_BASE + offset)) = (value & 0xF
                                                                                                ^
drivers/flash/mtk_nor.c: In function ‘mt53xx_nor_Read’:
drivers/flash/mtk_nor.c:1493:12: warning: variable ‘attr’ set but not used [-Wunused-but-set-variable]
   u8 info, attr;
            ^
drivers/flash/mtk_nor.c:1492:50: warning: unused variable ‘i’ [-Wunused-variable]
   u32 ret = 0, dram_addr_off = 0, len_align = 0, i;
                                                  ^
drivers/flash/mtk_nor.c:1492:16: warning: unused variable ‘dram_addr_off’ [-Wunused-variable]
   u32 ret = 0, dram_addr_off = 0, len_align = 0, i;
                ^
drivers/flash/mtk_nor.c: In function ‘mtk_nor_read’:
drivers/flash/mtk_nor.c:1846:1: warning: label ‘done’ defined but not used [-Wunused-label]
 done:
 ^
drivers/flash/mtk_nor.c:1725:1: warning: label ‘MultiRead’ defined but not used [-Wunused-label]
 MultiRead:
 ^
drivers/flash/mtk_nor.c:1695:8: warning: unused variable ‘phyaddr’ [-Wunused-variable]
    u32 phyaddr; 
        ^
drivers/flash/mtk_nor.c:1694:16: warning: unused variable ‘i’ [-Wunused-variable]
   u32 ret = 0, i;
                ^
drivers/flash/mtk_nor.c: In function ‘mt53xx_nor_WriteBuffer’:
drivers/flash/mtk_nor.c:2049:27: warning: variable ‘addr’ set but not used [-Wunused-but-set-variable]
   u32 i, j, bufidx, data, addr;
                           ^
drivers/flash/mtk_nor.c: In function ‘mtk_nor_write’:
drivers/flash/mtk_nor.c:2394:1: warning: label ‘done’ defined but not used [-Wunused-label]
 done:
 ^
drivers/flash/mtk_nor.c:2347:14: warning: unused variable ‘info’ [-Wunused-variable]
   u8 *u1buf, info;
              ^
drivers/flash/mtk_nor.c:2347:7: warning: unused variable ‘u1buf’ [-Wunused-variable]
   u8 *u1buf, info;
       ^
drivers/flash/mtk_nor.c:2346:48: warning: unused variable ‘j’ [-Wunused-variable]
   u32 addr, u4len, i, count, pgalign, ret = 0, j;
                                                ^
drivers/flash/mtk_nor.c:2346:30: warning: unused variable ‘pgalign’ [-Wunused-variable]
   u32 addr, u4len, i, count, pgalign, ret = 0, j;
                              ^
drivers/flash/mtk_nor.c:2346:23: warning: unused variable ‘count’ [-Wunused-variable]
   u32 addr, u4len, i, count, pgalign, ret = 0, j;
                       ^
drivers/flash/mtk_nor.c:2346:20: warning: unused variable ‘i’ [-Wunused-variable]
   u32 addr, u4len, i, count, pgalign, ret = 0, j;
                    ^
drivers/flash/mtk_nor.c:2346:13: warning: unused variable ‘u4len’ [-Wunused-variable]
   u32 addr, u4len, i, count, pgalign, ret = 0, j;
             ^
drivers/flash/mtk_nor.c:2346:7: warning: unused variable ‘addr’ [-Wunused-variable]
   u32 addr, u4len, i, count, pgalign, ret = 0, j;
       ^
drivers/flash/mtk_nor.c: In function ‘_SetFlashExit4Byte’:
drivers/flash/mtk_nor.c:2877:6: warning: variable ‘u4Index’ set but not used [-Wunused-but-set-variable]
  u32 u4Index, u4DualReg, u4Polling;
      ^
drivers/flash/mtk_nor.c: In function ‘_SetFlashEnter4Byte’:
drivers/flash/mtk_nor.c:2929:6: warning: variable ‘u4Index’ set but not used [-Wunused-but-set-variable]
  u32 u4Index, u4DualReg, u4Polling;
      ^
drivers/flash/mtk_nor.c: In function ‘mtk_nor_init’:
drivers/flash/mtk_nor.c:2994:6: warning: unused variable ‘reg’ [-Wunused-variable]
  int reg;
      ^
drivers/flash/mtk_nor.c: In function ‘mtk_nor_command’:
drivers/flash/mtk_nor.c:3120:31: warning: pointer targets in passing argument 3 of ‘mtk_nor_read’ differ in signedness [-Wpointer-sign]
   if (mtk_nor_read(addr, len, &retlen, p))
                               ^
drivers/flash/mtk_nor.c:1687:5: note: expected ‘size_t * {aka unsigned int *}’ but argument is of type ‘int *’
 u32 mtk_nor_read(u32 from, u32 len, size_t *retlen, u_char *buf)
     ^
drivers/flash/mtk_nor.c:3152:5: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
   p = (((u32)porig+31)/32)*32;
     ^
drivers/flash/mtk_nor.c:3156:30: warning: pointer targets in passing argument 1 of ‘simple_strtoul’ differ in signedness [-Wpointer-sign]
    *(p + i) = simple_strtoul(t, NULL, 16);
                              ^
In file included from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/common.h:851:0,
                 from drivers/flash/mtk_nor.c:45:
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/vsprintf.h:11:7: note: expected ‘const char *’ but argument is of type ‘u8 * {aka unsigned char *}’
 ulong simple_strtoul(const char *cp, char **endp, unsigned int base);
       ^
drivers/flash/mtk_nor.c:3158:28: warning: pointer targets in passing argument 3 of ‘mtk_nor_write’ differ in signedness [-Wpointer-sign]
   mtk_nor_write(addr, len, &retlen, p);
                            ^
drivers/flash/mtk_nor.c:2339:5: note: expected ‘size_t * {aka unsigned int *}’ but argument is of type ‘int *’
 u32 mtk_nor_write(u32 to, u32 len, size_t *retlen, const u_char *buf)
     ^
In file included from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/image.h:39:0,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/common.h:97,
                 from drivers/flash/mtk_nor.c:45:
drivers/flash/mtk_nor.c: At top level:
drivers/flash/mtk_nor.c:3177:26: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
   nor,   4,      1,      mtk_nor_command,
                          ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:165:29: note: in definition of macro ‘U_BOOT_CMD_MKENT_COMPLETE’
   { #_name, _maxargs, _rep, _cmd, _usage,   \
                             ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:178:2: note: in expansion of macro ‘U_BOOT_CMD_COMPLETE’
  U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, NULL)
  ^
drivers/flash/mtk_nor.c:3176:1: note: in expansion of macro ‘U_BOOT_CMD’
 U_BOOT_CMD(
 ^
drivers/flash/mtk_nor.c:3177:26: note: (near initialization for ‘_u_boot_list_2_cmd_2_nor.cmd’)
   nor,   4,      1,      mtk_nor_command,
                          ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:165:29: note: in definition of macro ‘U_BOOT_CMD_MKENT_COMPLETE’
   { #_name, _maxargs, _rep, _cmd, _usage,   \
                             ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:178:2: note: in expansion of macro ‘U_BOOT_CMD_COMPLETE’
  U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, NULL)
  ^
drivers/flash/mtk_nor.c:3176:1: note: in expansion of macro ‘U_BOOT_CMD’
 U_BOOT_CMD(
 ^
drivers/flash/mtk_nor.c: In function ‘mtk_uboot_nor_command’:
drivers/flash/mtk_nor.c:3203:31: warning: pointer targets in passing argument 3 of ‘mtk_nor_read’ differ in signedness [-Wpointer-sign]
   if (mtk_nor_read(addr, len, &retlen, p))
                               ^
drivers/flash/mtk_nor.c:1687:5: note: expected ‘size_t * {aka unsigned int *}’ but argument is of type ‘int *’
 u32 mtk_nor_read(u32 from, u32 len, size_t *retlen, u_char *buf)
     ^
drivers/flash/mtk_nor.c:3229:28: warning: pointer targets in passing argument 3 of ‘mtk_nor_write’ differ in signedness [-Wpointer-sign]
   mtk_nor_write(addr, len, &retlen, p);
                            ^
drivers/flash/mtk_nor.c:2339:5: note: expected ‘size_t * {aka unsigned int *}’ but argument is of type ‘int *’
 u32 mtk_nor_write(u32 to, u32 len, size_t *retlen, const u_char *buf)
     ^
drivers/flash/mtk_nor.c:3192:11: warning: unused variable ‘i’ [-Wunused-variable]
  int len, i, retlen = 0;
           ^
In file included from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/image.h:39:0,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/common.h:97,
                 from drivers/flash/mtk_nor.c:45:
drivers/flash/mtk_nor.c: At top level:
drivers/flash/mtk_nor.c:3238:27: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
   snor,   5,      1,      mtk_uboot_nor_command,
                           ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:165:29: note: in definition of macro ‘U_BOOT_CMD_MKENT_COMPLETE’
   { #_name, _maxargs, _rep, _cmd, _usage,   \
                             ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:178:2: note: in expansion of macro ‘U_BOOT_CMD_COMPLETE’
  U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, NULL)
  ^
drivers/flash/mtk_nor.c:3237:1: note: in expansion of macro ‘U_BOOT_CMD’
 U_BOOT_CMD(
 ^
drivers/flash/mtk_nor.c:3238:27: note: (near initialization for ‘_u_boot_list_2_cmd_2_snor.cmd’)
   snor,   5,      1,      mtk_uboot_nor_command,
                           ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:165:29: note: in definition of macro ‘U_BOOT_CMD_MKENT_COMPLETE’
   { #_name, _maxargs, _rep, _cmd, _usage,   \
                             ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:178:2: note: in expansion of macro ‘U_BOOT_CMD_COMPLETE’
  U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, NULL)
  ^
drivers/flash/mtk_nor.c:3237:1: note: in expansion of macro ‘U_BOOT_CMD’
 U_BOOT_CMD(
 ^
  LD      drivers/i2c/built-in.o
  LD      drivers/flash/built-in.o
  AS      arch/arm/cpu/armv7/start.o
  CC      arch/arm/lib/bootm.o
  LD      drivers/misc/mediatek/built-in.o
  LD      drivers/misc/built-in.o
  LD      arch/arm/cpu/armv7/built-in.o
  CC      board/mediatek/mt7623_evb/mtk_wdt.o
  CC      common/hash.o
  LD      board/mediatek/mt7623_evb/built-in.o
  CC      drivers/input/input.o
  LD      drivers/mtd/built-in.o
  CC      arch/arm/lib/sections.o
  LD      drivers/mtd/onenand/built-in.o
  LD      drivers/input/built-in.o
  CC      common/hush.o
  LD      drivers/mtd/spi/built-in.o
  CC      drivers/pcmcia/rpx_pcmcia.o
  CC      drivers/rtc/date.o
  LD      drivers/net/phy/built-in.o
  LD      drivers/rtc/built-in.o
  CC      drivers/mmc/mediatek/msdc.o
  CC      arch/arm/lib/interrupts.o
drivers/mmc/mediatek/msdc.c:46:0: warning: "MSDC0_BASE" redefined
 #define MSDC0_BASE (0x11230000)
 ^
In file included from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/configs/mt7623_evb.h:22:0,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/config.h:10,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/common.h:18,
                 from drivers/mmc/mediatek/msdc_utils.h:68,
                 from drivers/mmc/mediatek/msdc.h:43,
                 from drivers/mmc/mediatek/msdc.c:38:
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/arch/arm/include/asm/arch/mt_reg_base.h:46:0: note: this is the location of the previous definition
 #define MSDC0_BASE          (IO_PHYS + 0x01230000)
 ^
drivers/mmc/mediatek/msdc.c:50:0: warning: "MSDC1_BASE" redefined
 #define MSDC1_BASE (0x11240000)
 ^
In file included from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/configs/mt7623_evb.h:22:0,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/config.h:10,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/common.h:18,
                 from drivers/mmc/mediatek/msdc_utils.h:68,
                 from drivers/mmc/mediatek/msdc.h:43,
                 from drivers/mmc/mediatek/msdc.c:38:
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/arch/arm/include/asm/arch/mt_reg_base.h:47:0: note: this is the location of the previous definition
 #define MSDC1_BASE          (IO_PHYS + 0x01240000)
 ^
drivers/mmc/mediatek/msdc.c:53:0: warning: "MSDC2_BASE" redefined
 #define MSDC2_BASE (0x11250000)
 ^
In file included from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/configs/mt7623_evb.h:22:0,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/config.h:10,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/common.h:18,
                 from drivers/mmc/mediatek/msdc_utils.h:68,
                 from drivers/mmc/mediatek/msdc.h:43,
                 from drivers/mmc/mediatek/msdc.c:38:
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/arch/arm/include/asm/arch/mt_reg_base.h:48:0: note: this is the location of the previous definition
 #define MSDC2_BASE          (IO_PHYS + 0x01250000)
 ^
drivers/mmc/mediatek/msdc.c:55:0: warning: "MSDC3_BASE" redefined
 #define MSDC3_BASE (0x11260000)
 ^
In file included from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/configs/mt7623_evb.h:22:0,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/config.h:10,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/common.h:18,
                 from drivers/mmc/mediatek/msdc_utils.h:68,
                 from drivers/mmc/mediatek/msdc.h:43,
                 from drivers/mmc/mediatek/msdc.c:38:
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/arch/arm/include/asm/arch/mt_reg_base.h:49:0: note: this is the location of the previous definition
 #define MSDC3_BASE          (IO_PHYS + 0x01260000)
 ^
drivers/mmc/mediatek/msdc.c: In function ‘msdc_cmd’:
drivers/mmc/mediatek/msdc.c:2271:27: warning: comparison of constant ‘2’ with boolean expression is always true [-Wbool-compare]
         if ( host->app_cmd!=2 ) { //Light 20121225, to prevent recursive call path: msdc_tune_cmdrsp->msdc_app_cmd->msdc_cmd->msdc_tune_cmdrsp
                           ^
drivers/mmc/mediatek/msdc.c: In function ‘msdc_emmc_boot_start’:
drivers/mmc/mediatek/msdc.c:4206:14: warning: implicit declaration of function ‘msdc_cal_timeout’ [-Wimplicit-function-declaration]
     acktmo = msdc_cal_timeout(host, 50 * 1000 * 1000, 0, 256);   /* 50ms */
              ^
drivers/mmc/mediatek/msdc.c: In function ‘msdc_emmc_boot_read’:
drivers/mmc/mediatek/msdc.c:4304:9: warning: unused variable ‘totalsz’ [-Wunused-variable]
     u32 totalsz = size;
         ^
  LD      drivers/pci/built-in.o
  CC      common/s_record.o
  LD      drivers/power/battery/built-in.o
  LD      drivers/power/built-in.o
  CC      drivers/net/rt2880_eth.o
drivers/net/rt2880_eth.c: In function ‘rt2880_eth_initialize’:
drivers/net/rt2880_eth.c:645:14: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
  dev->send   = rt2880_eth_send;
              ^
drivers/net/rt2880_eth.c:631:6: warning: unused variable ‘regValue’ [-Wunused-variable]
  u32 regValue;
      ^
drivers/net/rt2880_eth.c: In function ‘wait_loop’:
drivers/net/rt2880_eth.c:919:6: warning: variable ‘read_data’ set but not used [-Wunused-but-set-variable]
  int read_data;
      ^
drivers/net/rt2880_eth.c: In function ‘trgmii_calibration_7623’:
drivers/net/rt2880_eth.c:955:6: warning: unused variable ‘TRGMII_7530_base’ [-Wunused-variable]
  u32 TRGMII_7530_base;
      ^
drivers/net/rt2880_eth.c:954:7: warning: variable ‘TRGMII_RCK_CTRL’ set but not used [-Wunused-but-set-variable]
  u32  TRGMII_RCK_CTRL;
       ^
drivers/net/rt2880_eth.c:953:7: warning: unused variable ‘TRGMII_RXCTL’ [-Wunused-variable]
  u32  TRGMII_RXCTL;
       ^
drivers/net/rt2880_eth.c:952:7: warning: unused variable ‘TRGMII_RD_3’ [-Wunused-variable]
  u32  TRGMII_RD_3;
       ^
drivers/net/rt2880_eth.c:951:7: warning: unused variable ‘TRGMII_RD_2’ [-Wunused-variable]
  u32  TRGMII_RD_2;
       ^
drivers/net/rt2880_eth.c:950:7: warning: unused variable ‘TRGMII_RD_1’ [-Wunused-variable]
  u32  TRGMII_RD_1;
       ^
drivers/net/rt2880_eth.c:945:15: warning: variable ‘training_word’ set but not used [-Wunused-but-set-variable]
  unsigned int training_word;
               ^
drivers/net/rt2880_eth.c:942:15: warning: variable ‘init_toggle_data’ set but not used [-Wunused-but-set-variable]
  unsigned int init_toggle_data;
               ^
drivers/net/rt2880_eth.c:934:16: warning: unused variable ‘bslip_en’ [-Wunused-variable]
  unsigned int  bslip_en;
                ^
drivers/net/rt2880_eth.c: In function ‘trgmii_calibration_7530’:
drivers/net/rt2880_eth.c:1158:6: warning: variable ‘TRGMII_7530_TX_base’ set but not used [-Wunused-but-set-variable]
  u32 TRGMII_7530_TX_base;
      ^
drivers/net/rt2880_eth.c:1156:7: warning: variable ‘TRGMII_RCK_CTRL’ set but not used [-Wunused-but-set-variable]
  u32  TRGMII_RCK_CTRL;
       ^
drivers/net/rt2880_eth.c:1155:7: warning: unused variable ‘TRGMII_RXCTL’ [-Wunused-variable]
  u32  TRGMII_RXCTL;
       ^
drivers/net/rt2880_eth.c:1154:7: warning: unused variable ‘TRGMII_RD_3’ [-Wunused-variable]
  u32  TRGMII_RD_3;
       ^
drivers/net/rt2880_eth.c:1153:7: warning: unused variable ‘TRGMII_RD_2’ [-Wunused-variable]
  u32  TRGMII_RD_2;
       ^
drivers/net/rt2880_eth.c:1152:7: warning: unused variable ‘TRGMII_RD_1’ [-Wunused-variable]
  u32  TRGMII_RD_1;
       ^
drivers/net/rt2880_eth.c:1145:15: warning: variable ‘training_word’ set but not used [-Wunused-but-set-variable]
  unsigned int training_word;
               ^
drivers/net/rt2880_eth.c:1142:15: warning: variable ‘init_toggle_data’ set but not used [-Wunused-but-set-variable]
  unsigned int init_toggle_data;
               ^
drivers/net/rt2880_eth.c:1139:9: warning: unused variable ‘j’ [-Wunused-variable]
  int  i,j;
         ^
drivers/net/rt2880_eth.c:1134:16: warning: unused variable ‘bslip_en’ [-Wunused-variable]
  unsigned int  bslip_en;
                ^
drivers/net/rt2880_eth.c: In function ‘rt2880_eth_init’:
drivers/net/rt2880_eth.c:1462:3: warning: implicit declaration of function ‘setup_internal_gsw’ [-Wimplicit-function-declaration]
   setup_internal_gsw();
   ^
drivers/net/rt2880_eth.c: At top level:
drivers/net/rt2880_eth.c:1769:68: warning: backslash and newline separated by space
 #elif defined (MT7621_ASIC_BOARD) || defined (MT7621_FPGA_BOARD) ||\ 
                                                                    ^
drivers/net/rt2880_eth.c:2811:6: warning: conflicting types for ‘setup_internal_gsw’
 void setup_internal_gsw(void)
      ^
drivers/net/rt2880_eth.c:1462:3: note: previous implicit declaration of ‘setup_internal_gsw’ was here
   setup_internal_gsw();
   ^
drivers/net/rt2880_eth.c: In function ‘rt2880_eth_setup’:
drivers/net/rt2880_eth.c:3170:9: warning: variable ‘temp’ set but not used [-Wunused-but-set-variable]
  uchar *temp;
         ^
drivers/net/rt2880_eth.c: In function ‘rt2880_eth_recv’:
drivers/net/rt2880_eth.c:3602:5: warning: unused variable ‘temp_mac’ [-Wunused-variable]
  u8 temp_mac[6];
     ^
drivers/net/rt2880_eth.c:3598:27: warning: unused variable ‘bb’ [-Wunused-variable]
  int length = 0,hdr_len=0,bb=0;
                           ^
drivers/net/rt2880_eth.c:3598:17: warning: variable ‘hdr_len’ set but not used [-Wunused-but-set-variable]
  int length = 0,hdr_len=0,bb=0;
                 ^
In file included from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/image.h:39:0,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/common.h:97,
                 from drivers/net/rt2880_eth.c:1:
drivers/net/rt2880_eth.c: At top level:
  CC      drivers/pcmcia/tqm8xx_pcmcia.o
drivers/net/rt2880_eth.c:4300:14: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
   reg, 4, 1, rdm_ioctl,
              ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:165:29: note: in definition of macro ‘U_BOOT_CMD_MKENT_COMPLETE’
   { #_name, _maxargs, _rep, _cmd, _usage,   \
                             ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:178:2: note: in expansion of macro ‘U_BOOT_CMD_COMPLETE’
  U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, NULL)
  ^
drivers/net/rt2880_eth.c:4299:1: note: in expansion of macro ‘U_BOOT_CMD’
 U_BOOT_CMD(
 ^
drivers/net/rt2880_eth.c:4300:14: note: (near initialization for ‘_u_boot_list_2_cmd_2_reg.cmd’)
   reg, 4, 1, rdm_ioctl,
              ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:165:29: note: in definition of macro ‘U_BOOT_CMD_MKENT_COMPLETE’
   { #_name, _maxargs, _rep, _cmd, _usage,   \
                             ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:178:2: note: in expansion of macro ‘U_BOOT_CMD_COMPLETE’
  U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, NULL)
  ^
drivers/net/rt2880_eth.c:4299:1: note: in expansion of macro ‘U_BOOT_CMD’
 U_BOOT_CMD(
 ^
drivers/net/rt2880_eth.c:4308:23: warning: ‘struct seq_file’ declared inside parameter list
 int EswCntRead(struct seq_file *seq, void *v)
                       ^
drivers/net/rt2880_eth.c:4308:23: warning: its scope is only this definition or declaration, which is probably not what you want
In file included from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/image.h:39:0,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/common.h:97,
                 from drivers/net/rt2880_eth.c:1:
drivers/net/rt2880_eth.c:4385:19: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
   esw_read, 4, 1, EswCntRead,
                   ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:165:29: note: in definition of macro ‘U_BOOT_CMD_MKENT_COMPLETE’
   { #_name, _maxargs, _rep, _cmd, _usage,   \
                             ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:178:2: note: in expansion of macro ‘U_BOOT_CMD_COMPLETE’
  U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, NULL)
  ^
drivers/net/rt2880_eth.c:4384:1: note: in expansion of macro ‘U_BOOT_CMD’
 U_BOOT_CMD(
 ^
drivers/net/rt2880_eth.c:4385:19: note: (near initialization for ‘_u_boot_list_2_cmd_2_esw_read.cmd’)
   esw_read, 4, 1, EswCntRead,
                   ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:165:29: note: in definition of macro ‘U_BOOT_CMD_MKENT_COMPLETE’
   { #_name, _maxargs, _rep, _cmd, _usage,   \
                             ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:178:2: note: in expansion of macro ‘U_BOOT_CMD_COMPLETE’
  U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, NULL)
  ^
drivers/net/rt2880_eth.c:4384:1: note: in expansion of macro ‘U_BOOT_CMD’
 U_BOOT_CMD(
 ^
drivers/net/rt2880_eth.c:1498:13: warning: ‘ResetSWusingGPIOx’ defined but not used [-Wunused-function]
 static void ResetSWusingGPIOx(void)
             ^
drivers/net/rt2880_eth.c:3825:15: warning: ‘delete_char’ defined but not used [-Wunused-function]
 static char * delete_char (char *buffer, char *p, int *colp, int *np, int plen)
               ^
  LD      drivers/pcmcia/built-in.o
  CC      arch/arm/lib/reset.o
  LD      drivers/power/fuel_gauge/built-in.o
  CC      drivers/mmc/mediatek/mmc_core.o
drivers/mmc/mediatek/mmc_core.c:4521:0: warning: "EFUSE_BASE" redefined
 #define EFUSE_BASE                      0x10200000
 ^
In file included from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/configs/mt7623_evb.h:22:0,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/config.h:10,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/common.h:18,
                 from drivers/mmc/mediatek/msdc_utils.h:68,
                 from drivers/mmc/mediatek/msdc.h:43,
                 from drivers/mmc/mediatek/mmc_core.c:42:
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/arch/arm/include/asm/arch/mt_reg_base.h:12:0: note: this is the location of the previous definition
 #define EFUSE_BASE          (IO_PHYS + 0x00206000)
 ^
  LD      drivers/power/mfd/built-in.o
  LD      drivers/power/pmic/built-in.o
  CC      drivers/net/mii_mgr.o
  LD      drivers/sound/built-in.o
drivers/net/mii_mgr.c: In function ‘rt2880_mdio_access’:
drivers/net/mii_mgr.c:744:11: warning: unused variable ‘j’ [-Wunused-variable]
  u32 i=0, j=0;
           ^
In file included from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/image.h:39:0,
                 from /mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/common.h:97,
                 from drivers/net/mii_mgr.c:1:
drivers/net/mii_mgr.c: At top level:
drivers/net/mii_mgr.c:955:15: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
   mdio, 4, 1, rt2880_mdio_access,
               ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:165:29: note: in definition of macro ‘U_BOOT_CMD_MKENT_COMPLETE’
   { #_name, _maxargs, _rep, _cmd, _usage,   \
                             ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:178:2: note: in expansion of macro ‘U_BOOT_CMD_COMPLETE’
  U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, NULL)
  ^
drivers/net/mii_mgr.c:954:1: note: in expansion of macro ‘U_BOOT_CMD’
 U_BOOT_CMD(
 ^
drivers/net/mii_mgr.c:955:15: note: (near initialization for ‘_u_boot_list_2_cmd_2_mdio.cmd’)
   mdio, 4, 1, rt2880_mdio_access,
               ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:165:29: note: in definition of macro ‘U_BOOT_CMD_MKENT_COMPLETE’
   { #_name, _maxargs, _rep, _cmd, _usage,   \
                             ^
/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt/include/command.h:178:2: note: in expansion of macro ‘U_BOOT_CMD_COMPLETE’
  U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, NULL)
  ^
drivers/net/mii_mgr.c:954:1: note: in expansion of macro ‘U_BOOT_CMD’
 U_BOOT_CMD(
 ^
  CC      common/xyzModem.o
  LD      drivers/net/built-in.o
  CC      drivers/mmc/mediatek/cust_msdc.o
  LD      drivers/usb/eth/built-in.o
  CC      arch/arm/lib/cache.o
  LD      drivers/tpm/built-in.o
  LD      drivers/twserial/built-in.o
  LD      drivers/usb/gadget/built-in.o
  LD      drivers/video/built-in.o
  LD      drivers/watchdog/built-in.o
  CC      drivers/serial/serial.o
  CC      common/cmd_disk.o
  LD      drivers/built-in.o
  CC      drivers/mmc/mediatek/msdc_utils.o
  LD      drivers/serial/built-in.o
  CC      arch/arm/lib/cache-cp15.o
  CC      drivers/spi/spi.o
  LD      drivers/spi/built-in.o
  LD      drivers/usb/host/built-in.o
  LD      drivers/usb/musb/built-in.o
  LD      drivers/usb/phy/built-in.o
  LD      drivers/usb/musb-new/built-in.o
  LD      drivers/usb/ulpi/built-in.o
  CC      common/cmd_boot.o
  CC      drivers/mmc/mediatek/mtk_mmc.o
  CC      arch/arm/lib/eabi_compat.o
  LD      arch/arm/lib/built-in.o
  LD      drivers/mmc/mediatek/built-in.o
  LD      drivers/mmc/built-in.o
  LD      lib/libfdt/built-in.o
  LD      test/built-in.o
  LD      test/dm/built-in.o
  CC      common/cmd_bootm.o
  CC      fs/fs.o
  CC      lib/crc7.o
  CC      net/arp.o
  CC      lib/zlib/zlib.o
  CC      common/cmd_help.o
  CC      net/bootp.o
  CC      lib/crc8.o
  CC      fs/fat/fat.o
  CC      common/cmd_version.o
  LD      lib/zlib/built-in.o
  CC      net/eth.o
  CC      lib/crc16.o
  CC      fs/fat/file.o
  LD      fs/fat/built-in.o
  CC      common/env_attr.o
  LD      fs/built-in.o
  CC      lib/gunzip.o
  CC      net/net.o
net/net.c: In function ‘net_init’:
net/net.c:307:15: warning: assignment discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   NetTxPacket = &PktBuf[0] + (PKTALIGN - 1);
               ^
  CC      common/env_callback.o
  CC      lib/initcall.o
  CC      net/ping.o
  CC      common/env_flags.o
  CC      lib/lmb.o
  CC      net/tftp.o
  LD      net/built-in.o
  CC      common/env_mmc.o
  CC      lib/ldiv.o
  CC      common/cmd_source.o
  CC      lib/net_utils.o
  CC      common/cmd_bdinfo.o
  CC      lib/qsort.o
  CC      common/cmd_bootmenu.o
  CC      lib/strmhz.o
  CC      common/cmd_console.o
  CC      lib/hashtable.o
  CC      common/cmd_echo.o
  CC      lib/errno.o
  CC      common/cmd_exit.o
  CC      lib/display_options.o
  CC      common/cmd_fat.o
  CC      lib/crc32.o
  CC      common/cmd_itest.o
  CC      lib/ctype.o
  CC      common/cmd_load.o
  CC      lib/div64.o
  CC      common/cmd_mem.o
  CC      lib/hang.o
  CC      common/cmd_misc.o
  CC      lib/linux_string.o
  CC      common/cmd_mmc.o
  CC      lib/string.o
  CC      common/cmd_net.o
  CC      lib/time.o
  CC      common/cmd_pcmcia.o
  CC      lib/vsprintf.o
  LD      lib/built-in.o
  CC      common/cmd_test.o
  CC      common/cmd_ximg.o
  CC      common/flash.o
  CC      common/splash.o
  CC      common/menu.o
  CC      common/cmd_nvedit.o
  CC      common/env_common.o
  CC      common/console.o
  CC      common/dlmalloc.o
  CC      common/image.o
  CC      common/memsize.o
  CC      common/stdio.o
  LD      common/built-in.o
  CC      examples/standalone/stubs.o
  CC      examples/standalone/hello_world.o
  LD      examples/standalone/libstubs.o
  LD      examples/standalone/hello_world
  OBJCOPY examples/standalone/hello_world.bin
  OBJCOPY examples/standalone/hello_world.srec
  LD      u-boot
  OBJCOPY u-boot.srec
  OBJCOPY u-boot.bin
./mkimage: 1: ./mkimage: Syntax error: "(" unexpected
Makefile:814: recipe for target 'u-boot-mtk.bin' failed
make[1]: *** [u-boot-mtk.bin] Error 2
make[1]: Leaving directory '/mnt/BPI-R2/BPI-R2-bsp/u-boot-mt'
Makefile:40: recipe for target 'u-boot' failed
make: *** [u-boot] Error 2

 Build failed!

can you please confirm if the tool mkimage is installed? If not, please install it by re-installing u-boot-tools.

Yes, it is installed.

jirka@vm-jirka:~$ uname -a
Linux vm-jirka 4.10.0-28-generic #32~16.04.2-Ubuntu SMP Thu Jul 20 10:19:13 UTC 2017 i686 athlon i686 GNU/Linux
jirka@vm-jirka:~$ mkimage 
    Usage: mkimage -l image
              -l ==> list image header information
           mkimage [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image
              -A ==> set architecture to 'arch'
              -O ==> set operating system to 'os'
              -T ==> set image type to 'type'
              -C ==> set compression type 'comp'
              -a ==> set load address to 'addr' (hex)
              -e ==> set entry point to 'ep' (hex)
              -n ==> set image name to 'name'
              -d ==> use image data from 'datafile'
              -x ==> set XIP (execute in place)
           mkimage [-D dtc_options] [-f fit-image.its|-F] fit-image
              -D => set all options for device tree compiler
              -f => input filename for FIT source
    Signing / verified boot not supported (CONFIG_FIT_SIGNATURE undefined)
           mkimage -V ==> print version information and exit
    Use -T to see a list of available image types

I finally succeeded in building the BSP. Believe me or not the success trigger was to built it on x86_64 Ubuntu Mate 16.04 instead of the i686 architecture of the same system! I have two freshly installed VMs one with i686 and the other with x86_64 version of Ubuntu Mate 16.04. While BSP building fails in the first one, it finishes well in the second. No idea why at all…

But now I ran in another problem when proceeded to building the V4L. When I have forgotten to set cross compiling it compiled against the 4.10.0-37-generic system’s kernel well. But when I corrected my mistake and set cross compiling against the just built BSP tree, it failed, see below.

Couldn’t it be missing the /lib/modules/4.4.70 for example? I’m afraid that despite cross compiling being set by make -j5 release DIR=/home/jirka/BPI-R2/BPI-R2-bsp/linux-mt/ it still uses the system /lib/modules/4.10.0-37-generic.

I appreciate any idea on what could be wrong.

jirka@vm-jirka:~/BPI-R2$ git clone git://linuxtv.org/media_build.git
Cloning into 'media_build'...
remote: Counting objects: 3974, done.
remote: Compressing objects: 100% (1116/1116), done.
remote: Total 3974 (delta 2850), reused 3918 (delta 2815)
Receiving objects: 100% (3974/3974), 695.73 KiB | 999.00 KiB/s, done.
Resolving deltas: 100% (2850/2850), done.
Checking connectivity... done.

jirka@vm-jirka:~/BPI-R2$ cd media_build/

jirka@vm-jirka:~/BPI-R2/media_build$ make -j5 release DIR=/home/jirka/BPI-R2/BPI-R2-bsp/linux-mt/
make -C /home/jirka/BPI-R2/media_build/v4l release
make[1]: Entering directory '/home/jirka/BPI-R2/media_build/v4l'
Searching in /home/jirka/BPI-R2/BPI-R2-bsp/linux-mt//Makefile for kernel version.
Forcing compiling to version 4.4.70
make[1]: Leaving directory '/home/jirka/BPI-R2/media_build/v4l'

jirka@vm-jirka:~/BPI-R2/media_build$ ./build 
Checking if the needed tools for Ubuntu 16.04.3 LTS are available
Needed package dependencies are met.

************************************************************
* This script will download the latest tarball and build it*
* Assuming that your kernel is compatible with the latest  *
* drivers. If not, you'll need to add some extra backports,*
* ./backports/<kernel> directory.                          *
* It will also update this tree to be sure that all compat *
* bits are there, to avoid compilation failures            *
************************************************************
************************************************************
* All drivers and build system are under GPLv2 License     *
* Firmware files are under the license terms found at:     *
* http://www.linuxtv.org/downloads/firmware/               *
* Please abort in the next 5 secs if you don't agree with  *
* the license                                              *
************************************************************

Not aborted. It means that the licence was agreed. Proceeding...

****************************
Updating the building system
****************************
From git://linuxtv.org/media_build
 * branch            master     -> FETCH_HEAD
Already up-to-date.
make: Entering directory '/home/jirka/BPI-R2/media_build/linux'
wget http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2.md5 -O linux-media.tar.bz2.md5.tmp
--2017-10-24 21:01:05--  http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2.md5
Resolving linuxtv.org (linuxtv.org)... 130.149.80.248
Connecting to linuxtv.org (linuxtv.org)|130.149.80.248|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2.md5 [following]
--2017-10-24 21:01:06--  https://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2.md5
Connecting to linuxtv.org (linuxtv.org)|130.149.80.248|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 105 [application/x-bzip2]
Saving to: ‘linux-media.tar.bz2.md5.tmp’

linux-media.tar.bz2.md5 100%[==============================>]     105  --.-KB/s    in 0s      

2017-10-24 21:01:06 (1,75 MB/s) - ‘linux-media.tar.bz2.md5.tmp’ saved [105/105]

cat: linux-media.tar.bz2.md5: No such file or directory
--2017-10-24 21:01:06--  http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2
Resolving linuxtv.org (linuxtv.org)... 130.149.80.248
Connecting to linuxtv.org (linuxtv.org)|130.149.80.248|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2 [following]
--2017-10-24 21:01:06--  https://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2
Connecting to linuxtv.org (linuxtv.org)|130.149.80.248|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6673742 (6,4M) [application/x-bzip2]
Saving to: ‘linux-media.tar.bz2’

linux-media.tar.bz2     100%[==============================>]   6,36M   241KB/s    in 14s     

2017-10-24 21:01:21 (467 KB/s) - ‘linux-media.tar.bz2’ saved [6673742/6673742]

make: Leaving directory '/home/jirka/BPI-R2/media_build/linux'
make: Entering directory '/home/jirka/BPI-R2/media_build/linux'
tar xfj linux-media.tar.bz2
rm -f .patches_applied .linked_dir .git_log.md5
make: Leaving directory '/home/jirka/BPI-R2/media_build/linux'
**********************************************************
* Downloading firmwares from linuxtv.org.                *
**********************************************************
--2017-10-24 21:01:22--  http://www.linuxtv.org/downloads/firmware//dvb-firmwares.tar.bz2
Resolving www.linuxtv.org (www.linuxtv.org)... 130.149.80.248
Connecting to www.linuxtv.org (www.linuxtv.org)|130.149.80.248|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.linuxtv.org/downloads/firmware//dvb-firmwares.tar.bz2 [following]
--2017-10-24 21:01:23--  https://www.linuxtv.org/downloads/firmware//dvb-firmwares.tar.bz2
Connecting to www.linuxtv.org (www.linuxtv.org)|130.149.80.248|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1235003 (1,2M) [application/x-bzip2]
Saving to: ‘dvb-firmwares.tar.bz2’

dvb-firmwares.tar.bz2   100%[==============================>]   1,18M   528KB/s    in 2,3s    

2017-10-24 21:01:26 (528 KB/s) - ‘dvb-firmwares.tar.bz2’ saved [1235003/1235003]

as102_data1_st.hex
as102_data2_st.hex
cmmb_vega_12mhz.inp
cmmb_venice_12mhz.inp
dvb-fe-bcm3510-01.fw
dvb-fe-drxj-mc-1.0.8.fw
dvb-fe-drxj-mc-vsb-1.0.8.fw
dvb-fe-drxj-mc-vsb-qam-1.0.8.fw
dvb-fe-or51132-qam.fw
dvb-fe-or51132-vsb.fw
dvb-fe-or51211.fw
dvb-fe-xc4000-1.4.1.fw
dvb-fe-xc5000-1.6.114.fw
dvb-fe-xc5000c-4.1.30.7.fw
dvb-firmwares.tar.bz2
dvb-ttpci-01.fw-261a
dvb-ttpci-01.fw-261b
dvb-ttpci-01.fw-261c
dvb-ttpci-01.fw-261d
dvb-ttpci-01.fw-261f
dvb-ttpci-01.fw-2622
dvb-usb-avertv-a800-02.fw
dvb-usb-bluebird-01.fw
dvb-usb-dib0700-1.20.fw
dvb-usb-dibusb-5.0.0.11.fw
dvb-usb-dibusb-6.0.0.8.fw
dvb-usb-dtt200u-01.fw
dvb-usb-it9135-01.fw
dvb-usb-it9135-02.fw
dvb-usb-terratec-h5-drxk.fw
dvb-usb-terratec-h7-az6007.fw
dvb-usb-terratec-h7-drxk.fw
dvb-usb-umt-010-02.fw
dvb-usb-vp702x-01.fw
dvb-usb-vp7045-01.fw
dvb-usb-wt220u-01.fw
dvb-usb-wt220u-02.fw
dvb_nova_12mhz.inp
dvb_nova_12mhz_b0.inp
isdbt_nova_12mhz.inp
isdbt_nova_12mhz_b0.inp
isdbt_rio.inp
sms1xxx-hcw-55xxx-dvbt-02.fw
sms1xxx-hcw-55xxx-isdbt-02.fw
sms1xxx-nova-a-dvbt-01.fw
sms1xxx-nova-b-dvbt-01.fw
sms1xxx-stellar-dvbt-01.fw
tdmb_nova_12mhz.inp
v4l-cx231xx-avcore-01.fw
v4l-cx23418-apu.fw
v4l-cx23418-cpu.fw
v4l-cx23418-dig.fw
v4l-cx23885-avcore-01.fw
v4l-cx23885-enc-broken.fw
v4l-cx25840.fw
******************
* Start building *
******************
make -C /home/jirka/BPI-R2/media_build/v4l allyesconfig
make[1]: Entering directory '/home/jirka/BPI-R2/media_build/v4l'
make[2]: Entering directory '/home/jirka/BPI-R2/media_build/linux'
Applying patches for kernel 4.4.70
patch -s -f -N -p1 -i ../backports/api_version.patch
patch -s -f -N -p1 -i ../backports/pr_fmt.patch
patch -s -f -N -p1 -i ../backports/debug.patch
patch -s -f -N -p1 -i ../backports/drx39xxj.patch
patch -s -f -N -p1 -i ../backports/v4.12_revert_solo6x10_copykerneluser.patch
patch -s -f -N -p1 -i ../backports/v4.10_sched_signal.patch
patch -s -f -N -p1 -i ../backports/v4.10_fault_page.patch
patch -s -f -N -p1 -i ../backports/v4.10_refcount.patch
patch -s -f -N -p1 -i ../backports/v4.9_mm_address.patch
patch -s -f -N -p1 -i ../backports/v4.9_dvb_net_max_mtu.patch
patch -s -f -N -p1 -i ../backports/v4.9_ktime_cleanups.patch
patch -s -f -N -p1 -i ../backports/v4.8_user_pages_flag.patch
patch -s -f -N -p1 -i ../backports/v4.7_dma_attrs.patch
patch -s -f -N -p1 -i ../backports/v4.7_pci_alloc_irq_vectors.patch
patch -s -f -N -p1 -i ../backports/v4.6_i2c_mux.patch
patch -s -f -N -p1 -i ../backports/v4.5_gpiochip_data_pointer.patch
patch -s -f -N -p1 -i ../backports/v4.5_get_user_pages.patch
patch -s -f -N -p1 -i ../backports/v4.5_uvc_super_plus.patch
patch -s -f -N -p1 -i ../backports/v4.4_gpio_chip_parent.patch
Patched drivers/media/dvb-core/dvbdev.c
Patched drivers/media/v4l2-core/v4l2-dev.c
Patched drivers/media/rc/rc-main.c
make[2]: Leaving directory '/home/jirka/BPI-R2/media_build/linux'
./scripts/make_kconfig.pl /home/jirka/BPI-R2/BPI-R2-bsp/linux-mt/ /home/jirka/BPI-R2/BPI-R2-bsp/linux-mt/ 1
Preparing to compile for kernel version 4.4.70
WARNING: This is the V4L/DVB backport tree, with experimental drivers
	 backported to run on legacy kernels from the development tree at:
		http://git.linuxtv.org/media-tree.git.
	 It is generally safe to use it for testing a new driver or
	 feature, but its usage on production environments is risky.
	 Don't use it in production. You've been warned.
VIDEO_CX231XX: Requires at least kernel 4.7.0
VIDEO_SOLO6X10: Requires at least kernel 4.5.0
VIDEO_MUX: Requires at least kernel 4.13.0
RADIO_WL128X: Requires at least kernel 4.13.0
VIDEO_DW9714: Requires at least kernel 9.255.255
VIDEO_OV5670: Requires at least kernel 4.10.0
VIDEO_OV13858: Requires at least kernel 4.5.0
DVB_M88DS3103: Requires at least kernel 4.7.0
DVB_CXD2820R: Requires at least kernel 4.6.0
DVB_RTL2830: Requires at least kernel 4.7.0
DVB_RTL2832: Requires at least kernel 4.7.0
DVB_SI2168: Requires at least kernel 4.7.0
DVB_LGDT3306A: Requires at least kernel 4.7.0
INTEL_ATOMISP: Requires at least kernel 9.255.255
Created default (all yes) .config file
./scripts/fix_kconfig.pl
make[1]: Leaving directory '/home/jirka/BPI-R2/media_build/v4l'
make -C /home/jirka/BPI-R2/media_build/v4l 
make[1]: Entering directory '/home/jirka/BPI-R2/media_build/v4l'
scripts/make_makefile.pl
./scripts/make_myconfig.pl
perl scripts/make_config_compat.pl /home/jirka/BPI-R2/BPI-R2-bsp/linux-mt/ ./.myconfig ./config-compat.h
creating symbolic links...
Kernel build directory is /home/jirka/BPI-R2/BPI-R2-bsp/linux-mt/
make -C ../linux apply_patches
make[2]: Entering directory '/home/jirka/BPI-R2/media_build/linux'
Patches for 4.4.70 already applied.
make[2]: Leaving directory '/home/jirka/BPI-R2/media_build/linux'
make -C /home/jirka/BPI-R2/BPI-R2-bsp/linux-mt/ SUBDIRS=/home/jirka/BPI-R2/media_build/v4l  modules
make[2]: Entering directory '/home/jirka/BPI-R2/BPI-R2-bsp/linux-mt'
  CC [M]  /home/jirka/BPI-R2/media_build/v4l/msp3400-driver.o
In file included from ./arch/x86/include/asm/bitops.h:16:0,
                 from include/linux/bitops.h:36,
                 from include/linux/kernel.h:10,
                 from include/asm-generic/bug.h:13,
                 from ./arch/x86/include/asm/bug.h:35,
                 from include/linux/bug.h:4,
                 from include/linux/mmdebug.h:4,
                 from /home/jirka/BPI-R2/media_build/v4l/config-compat.h:12,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:10,
                 from <command-line>:0:
./arch/x86/include/asm/arch_hweight.h: In function '__arch_hweight64':
./arch/x86/include/asm/arch_hweight.h:56:42: error: expected ':' or ')' before 'POPCNT64'
  asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)
                                          ^
./arch/x86/include/asm/alternative.h:131:28: note: in definition of macro 'ALTINSTR_REPLACEMENT'
  b_replacement(num)":\n\t" newinstr "\n" e_replacement(num) ":\n\t"
                            ^
./arch/x86/include/asm/arch_hweight.h:56:7: note: in expansion of macro 'ALTERNATIVE'
  asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)
       ^
In file included from ./arch/x86/include/asm/pgtable_types.h:250:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
include/asm-generic/pgtable-nopud.h: At top level:
include/asm-generic/pgtable-nopud.h:15:0: warning: "PUD_SHIFT" redefined
 #define PUD_SHIFT PGDIR_SHIFT
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:205:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
./arch/x86/include/asm/pgtable_64_types.h:33:0: note: this is the location of the previous definition
 #define PUD_SHIFT 30
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:250:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
include/asm-generic/pgtable-nopud.h:16:0: warning: "PTRS_PER_PUD" redefined
 #define PTRS_PER_PUD 1
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:205:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
./arch/x86/include/asm/pgtable_64_types.h:34:0: note: this is the location of the previous definition
 #define PTRS_PER_PUD 512
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:250:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
include/asm-generic/pgtable-nopud.h:17:0: warning: "PUD_SIZE" redefined
 #define PUD_SIZE   (1UL << PUD_SHIFT)
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:205:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
./arch/x86/include/asm/pgtable_64_types.h:50:0: note: this is the location of the previous definition
 #define PUD_SIZE (_AC(1, UL) << PUD_SHIFT)
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:250:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
include/asm-generic/pgtable-nopud.h:18:0: warning: "PUD_MASK" redefined
 #define PUD_MASK   (~(PUD_SIZE-1))
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:205:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
./arch/x86/include/asm/pgtable_64_types.h:51:0: note: this is the location of the previous definition
 #define PUD_MASK (~(PUD_SIZE - 1))
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:271:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
include/asm-generic/pgtable-nopmd.h:19:0: warning: "PMD_SHIFT" redefined
 #define PMD_SHIFT PUD_SHIFT
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:205:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
./arch/x86/include/asm/pgtable_64_types.h:40:0: note: this is the location of the previous definition
 #define PMD_SHIFT 21
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:271:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
include/asm-generic/pgtable-nopmd.h:20:0: warning: "PTRS_PER_PMD" redefined
 #define PTRS_PER_PMD 1
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:205:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
./arch/x86/include/asm/pgtable_64_types.h:41:0: note: this is the location of the previous definition
 #define PTRS_PER_PMD 512
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:271:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
include/asm-generic/pgtable-nopmd.h:21:0: warning: "PMD_SIZE" redefined
 #define PMD_SIZE   (1UL << PMD_SHIFT)
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:205:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
./arch/x86/include/asm/pgtable_64_types.h:48:0: note: this is the location of the previous definition
 #define PMD_SIZE (_AC(1, UL) << PMD_SHIFT)
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:271:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
include/asm-generic/pgtable-nopmd.h:22:0: warning: "PMD_MASK" redefined
 #define PMD_MASK   (~(PMD_SIZE-1))
 ^
In file included from ./arch/x86/include/asm/pgtable_types.h:205:0,
                 from ./arch/x86/include/asm/processor.h:18,
                 from ./arch/x86/include/asm/thread_info.h:52,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
./arch/x86/include/asm/pgtable_64_types.h:49:0: note: this is the location of the previous definition
 #define PMD_MASK (~(PMD_SIZE - 1))
 ^
In file included from ./arch/x86/include/asm/thread_info.h:52:0,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
./arch/x86/include/asm/processor.h:172:0: warning: "cache_line_size" redefined
 #define cache_line_size() (boot_cpu_data.x86_cache_alignment)
 ^
In file included from include/linux/printk.h:8:0,
                 from include/linux/kernel.h:13,
                 from include/asm-generic/bug.h:13,
                 from ./arch/x86/include/asm/bug.h:35,
                 from include/linux/bug.h:4,
                 from include/linux/mmdebug.h:4,
                 from /home/jirka/BPI-R2/media_build/v4l/config-compat.h:12,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:10,
                 from <command-line>:0:
include/linux/cache.h:78:0: note: this is the location of the previous definition
 #define cache_line_size() L1_CACHE_BYTES
 ^
In file included from ./arch/x86/include/asm/segment.h:155:0,
                 from ./arch/x86/include/asm/ptrace.h:4,
                 from ./arch/x86/include/asm/alternative.h:8,
                 from ./arch/x86/include/asm/bitops.h:16,
                 from include/linux/bitops.h:36,
                 from include/linux/kernel.h:10,
                 from include/asm-generic/bug.h:13,
                 from ./arch/x86/include/asm/bug.h:35,
                 from include/linux/bug.h:4,
                 from include/linux/mmdebug.h:4,
                 from /home/jirka/BPI-R2/media_build/v4l/config-compat.h:12,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:10,
                 from <command-line>:0:
./arch/x86/include/asm/cache.h:7:25: error: 'CONFIG_X86_L1_CACHE_SHIFT' undeclared here (not in a function)
 #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
                         ^
./arch/x86/include/asm/cache.h:8:30: note: in expansion of macro 'L1_CACHE_SHIFT'
 #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
                              ^
include/linux/cache.h:12:25: note: in expansion of macro 'L1_CACHE_BYTES'
 #define SMP_CACHE_BYTES L1_CACHE_BYTES
                         ^
include/linux/cache.h:34:58: note: in expansion of macro 'SMP_CACHE_BYTES'
 #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
                                                          ^
./arch/x86/include/asm/processor.h:275:27: note: in expansion of macro '____cacheline_aligned'
 } __attribute__((packed)) ____cacheline_aligned;
                           ^
In file included from ./arch/x86/include/asm/preempt.h:5:0,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
./arch/x86/include/asm/processor.h: In function 'current_top_of_stack':
./arch/x86/include/asm/processor.h:466:30: error: 'cpu_current_top_of_stack' undeclared (first use in this function)
  return this_cpu_read_stable(cpu_current_top_of_stack);
                              ^
./arch/x86/include/asm/percpu.h:213:9: note: in definition of macro 'percpu_stable_op'
  typeof(var) pfo_ret__;    \
         ^
./arch/x86/include/asm/processor.h:466:9: note: in expansion of macro 'this_cpu_read_stable'
  return this_cpu_read_stable(cpu_current_top_of_stack);
         ^
./arch/x86/include/asm/processor.h:466:30: note: each undeclared identifier is reported only once for each function it appears in
  return this_cpu_read_stable(cpu_current_top_of_stack);
                              ^
./arch/x86/include/asm/percpu.h:213:9: note: in definition of macro 'percpu_stable_op'
  typeof(var) pfo_ret__;    \
         ^
./arch/x86/include/asm/processor.h:466:9: note: in expansion of macro 'this_cpu_read_stable'
  return this_cpu_read_stable(cpu_current_top_of_stack);
         ^
In file included from ./arch/x86/include/asm/atomic.h:240:0,
                 from include/linux/atomic.h:4,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
./arch/x86/include/asm/atomic64_64.h: At top level:
./arch/x86/include/asm/atomic64_64.h:19:40: error: unknown type name 'atomic64_t'
 static inline long atomic64_read(const atomic64_t *v)
                                        ^
In file included from include/asm-generic/bug.h:4:0,
                 from ./arch/x86/include/asm/bug.h:35,
                 from include/linux/bug.h:4,
                 from include/linux/mmdebug.h:4,
                 from /home/jirka/BPI-R2/media_build/v4l/config-compat.h:12,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:10,
                 from <command-line>:0:
./arch/x86/include/asm/atomic64_64.h: In function 'atomic64_read':
./arch/x86/include/asm/atomic64_64.h:21:22: error: request for member 'counter' in something not a structure or union
  return READ_ONCE((v)->counter);
                      ^
include/linux/compiler.h:279:17: note: in definition of macro '__READ_ONCE'
  union { typeof(x) __val; char __c[1]; } __u;   \
                 ^
./arch/x86/include/asm/atomic64_64.h:21:9: note: in expansion of macro 'READ_ONCE'
  return READ_ONCE((v)->counter);
         ^
./arch/x86/include/asm/atomic64_64.h:21:22: error: request for member 'counter' in something not a structure or union
  return READ_ONCE((v)->counter);
                      ^
include/linux/compiler.h:281:22: note: in definition of macro '__READ_ONCE'
   __read_once_size(&(x), __u.__c, sizeof(x));  \
                      ^
./arch/x86/include/asm/atomic64_64.h:21:9: note: in expansion of macro 'READ_ONCE'
  return READ_ONCE((v)->counter);
         ^
./arch/x86/include/asm/atomic64_64.h:21:22: error: request for member 'counter' in something not a structure or union
  return READ_ONCE((v)->counter);
                      ^
include/linux/compiler.h:281:42: note: in definition of macro '__READ_ONCE'
   __read_once_size(&(x), __u.__c, sizeof(x));  \
                                          ^
./arch/x86/include/asm/atomic64_64.h:21:9: note: in expansion of macro 'READ_ONCE'
  return READ_ONCE((v)->counter);
         ^
./arch/x86/include/asm/atomic64_64.h:21:22: error: request for member 'counter' in something not a structure or union
  return READ_ONCE((v)->counter);
                      ^
include/linux/compiler.h:283:30: note: in definition of macro '__READ_ONCE'
   __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
                              ^
./arch/x86/include/asm/atomic64_64.h:21:9: note: in expansion of macro 'READ_ONCE'
  return READ_ONCE((v)->counter);
         ^
./arch/x86/include/asm/atomic64_64.h:21:22: error: request for member 'counter' in something not a structure or union
  return READ_ONCE((v)->counter);
                      ^
include/linux/compiler.h:283:50: note: in definition of macro '__READ_ONCE'
   __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
                                                  ^
./arch/x86/include/asm/atomic64_64.h:21:9: note: in expansion of macro 'READ_ONCE'
  return READ_ONCE((v)->counter);
         ^
In file included from ./arch/x86/include/asm/atomic.h:240:0,
                 from include/linux/atomic.h:4,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
./arch/x86/include/asm/atomic64_64.h: At top level:
./arch/x86/include/asm/atomic64_64.h:31:33: error: unknown type name 'atomic64_t'
 static inline void atomic64_set(atomic64_t *v, long i)
                                 ^
./arch/x86/include/asm/atomic64_64.h:43:50: error: unknown type name 'atomic64_t'
 static __always_inline void atomic64_add(long i, atomic64_t *v)
                                                  ^
./arch/x86/include/asm/atomic64_64.h:57:41: error: unknown type name 'atomic64_t'
 static inline void atomic64_sub(long i, atomic64_t *v)
                                         ^
./arch/x86/include/asm/atomic64_64.h:73:49: error: unknown type name 'atomic64_t'
 static inline int atomic64_sub_and_test(long i, atomic64_t *v)
                                                 ^
./arch/x86/include/asm/atomic64_64.h:84:42: error: unknown type name 'atomic64_t'
 static __always_inline void atomic64_inc(atomic64_t *v)
                                          ^
./arch/x86/include/asm/atomic64_64.h:97:42: error: unknown type name 'atomic64_t'
 static __always_inline void atomic64_dec(atomic64_t *v)
                                          ^
./arch/x86/include/asm/atomic64_64.h:112:41: error: unknown type name 'atomic64_t'
 static inline int atomic64_dec_and_test(atomic64_t *v)
                                         ^
./arch/x86/include/asm/atomic64_64.h:125:41: error: unknown type name 'atomic64_t'
 static inline int atomic64_inc_and_test(atomic64_t *v)
                                         ^
./arch/x86/include/asm/atomic64_64.h:139:49: error: unknown type name 'atomic64_t'
 static inline int atomic64_add_negative(long i, atomic64_t *v)
                                                 ^
./arch/x86/include/asm/atomic64_64.h:151:57: error: unknown type name 'atomic64_t'
 static __always_inline long atomic64_add_return(long i, atomic64_t *v)
                                                         ^
./arch/x86/include/asm/atomic64_64.h:156:48: error: unknown type name 'atomic64_t'
 static inline long atomic64_sub_return(long i, atomic64_t *v)
                                                ^
./arch/x86/include/asm/atomic64_64.h:164:37: error: unknown type name 'atomic64_t'
 static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new)
                                     ^
./arch/x86/include/asm/atomic64_64.h:169:34: error: unknown type name 'atomic64_t'
 static inline long atomic64_xchg(atomic64_t *v, long new)
                                  ^
./arch/x86/include/asm/atomic64_64.h:183:39: error: unknown type name 'atomic64_t'
 static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
                                       ^
./arch/x86/include/asm/atomic64_64.h:207:45: error: unknown type name 'atomic64_t'
 static inline long atomic64_dec_if_positive(atomic64_t *v)
                                             ^
./arch/x86/include/asm/atomic64_64.h:224:42: error: unknown type name 'atomic64_t'
 static inline void atomic64_##op(long i, atomic64_t *v)   \
                                          ^
./arch/x86/include/asm/atomic64_64.h:232:1: note: in expansion of macro 'ATOMIC64_OP'
 ATOMIC64_OP(and)
 ^
./arch/x86/include/asm/atomic64_64.h:224:42: error: unknown type name 'atomic64_t'
 static inline void atomic64_##op(long i, atomic64_t *v)   \
                                          ^
./arch/x86/include/asm/atomic64_64.h:233:1: note: in expansion of macro 'ATOMIC64_OP'
 ATOMIC64_OP(or)
 ^
./arch/x86/include/asm/atomic64_64.h:224:42: error: unknown type name 'atomic64_t'
 static inline void atomic64_##op(long i, atomic64_t *v)   \
                                          ^
./arch/x86/include/asm/atomic64_64.h:234:1: note: in expansion of macro 'ATOMIC64_OP'
 ATOMIC64_OP(xor)
 ^
In file included from ./arch/x86/include/asm/thread_info.h:53:0,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
include/linux/atomic.h:556:49: error: unknown type name 'atomic64_t'
 static inline void atomic64_andnot(long long i, atomic64_t *v)
                                                 ^
In file included from ./arch/x86/include/asm/preempt.h:6:0,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
include/linux/thread_info.h:149:19: error: redefinition of 'arch_within_stack_frames'
 static inline int arch_within_stack_frames(const void * const stack,
                   ^
In file included from include/linux/thread_info.h:54:0,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:59,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/input.h:11,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:18,
                 from <command-line>:0:
./arch/x86/include/asm/thread_info.h:189:19: note: previous definition of 'arch_within_stack_frames' was here
 static inline int arch_within_stack_frames(const void * const stack,
                   ^
In file included from ./arch/x86/include/asm/segment.h:155:0,
                 from ./arch/x86/include/asm/ptrace.h:4,
                 from ./arch/x86/include/asm/alternative.h:8,
                 from ./arch/x86/include/asm/bitops.h:16,
                 from include/linux/bitops.h:36,
                 from include/linux/kernel.h:10,
                 from include/asm-generic/bug.h:13,
                 from ./arch/x86/include/asm/bug.h:35,
                 from include/linux/bug.h:4,
                 from include/linux/mmdebug.h:4,
                 from /home/jirka/BPI-R2/media_build/v4l/config-compat.h:12,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:10,
                 from <command-line>:0:
./arch/x86/include/asm/cache.h:12:31: error: 'CONFIG_X86_INTERNODE_CACHE_SHIFT' undeclared here (not in a function)
 #define INTERNODE_CACHE_SHIFT CONFIG_X86_INTERNODE_CACHE_SHIFT
                               ^
include/linux/cache.h:71:35: note: in expansion of macro 'INTERNODE_CACHE_SHIFT'
  __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT))))
                                   ^
include/linux/mmzone.h:110:3: note: in expansion of macro '____cacheline_internodealigned_in_smp'
 } ____cacheline_internodealigned_in_smp;
   ^
In file included from include/linux/sched.h:32:0,
                 from include/sound/core.h:26,
                 from /home/jirka/BPI-R2/media_build/v4l/compat.h:265,
                 from <command-line>:0:
include/linux/cputime.h:4:25: fatal error: asm/cputime.h: No such file or directory
compilation terminated.
scripts/Makefile.build:258: recipe for target '/home/jirka/BPI-R2/media_build/v4l/msp3400-driver.o' failed
make[3]: *** [/home/jirka/BPI-R2/media_build/v4l/msp3400-driver.o] Error 1
Makefile:1402: recipe for target '_module_/home/jirka/BPI-R2/media_build/v4l' failed
make[2]: *** [_module_/home/jirka/BPI-R2/media_build/v4l] Error 2
make[2]: Leaving directory '/home/jirka/BPI-R2/BPI-R2-bsp/linux-mt'
Makefile:51: recipe for target 'default' failed
make[1]: *** [default] Error 2
make[1]: Leaving directory '/home/jirka/BPI-R2/media_build/v4l'
Makefile:26: recipe for target 'all' failed
make: *** [all] Error 2
build failed at ./build line 526

I’m definitely out of any idea how to cross compile the DVB driver on my PC. Compiled BSP is my only progress in last days. Compiling DVB drivers directly on BPI-R2 against compiled BSP fails. And I do not know how to cross compile it on PC. LinuxTV provides no info on that here: https://www.linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers

I found some hints in some forums I tried but no success. I’m not experienced in compiling and I didn’t found any guidance I could follow. Really do not know how to proceed any further:-(

I would be glad for any help.

To support DVB, looks like some patches of linux kernel should be applied, right? If yes, this will be a huge task.

make -C …/linux apply_patches make[2]: Entering directory ‘/work/media_build/linux’ Patches for 4.10.0-37-generic already applied.

To be honest I do not know if any kernel patches should be applied. But I have read through several forums on similar topic and did not notice any need for patching the kernel. Unfortunately all the information was several years old, I did not find any up to date. Maybe the most useful list of steps to be done I found is here: http://forum.lemaker.org/forum.php?mod=viewthread&tid=2172&extra=&page=6. But marked as not working though.:frowning:

BTW when you have a look at my DVB build output in my post above DVB support for R2, you can find there also:

make -C ../linux apply_patches
make[2]: Entering directory '/home/jirka/BPI-R2/media_build/linux'
Patches for 4.4.70 already applied.

Above information is from your log, looks like the kernel 4.4.x is not supported.

I don’t think so, Gary. I know this part of the log. I’m sure this means that only these few drivers are not supported but the others (there are hundreds of them) are supported. The LinuxTV V4L-DVB drivers will work only in conjunction with relatively modern 2.6 kernels; specifically 2.6.31 and up., see: https://www.linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers

Kernel version is definitely not the problem.

The problem is that I do not know how to set and do cross compiling of the drivers. I never did it before. Linuxtv does not provide any information on that. And any piece of information on similar topic I find on Internet is a bit different of the others. So I’m lost on how to proceed in order to cross compile it in fact. I believe it has to work when done in the right way.

DVB on R2 already works to me. As usually the problem was in between the keyboard and chair.:slight_smile: I went to totally wrong direction earlier. There is no need to get the DVB drivers from LinuxTV website and compile them. DVB support is already in kernel for years.

So to enable DVB support on R2 this has to be done:

  1. Get R2 source code from https://github.com/BPI-SINOVOIP/BPI-R2-bsp and follow all the steps in order to be ready for building it.

  2. Configure kernel, ie. run ./build.sh and select option nr. 4.

  3. Enable DVB in Device Drivers/Multimedia support/Digital TV support and select appropriate device drivers you need in Media USB Adapters there.

  4. Save the kernel configuration to .config.

  5. Build all the stuff, ie. run ./build.sh and select option nr. 1.

  6. Update both u-boot and Linux kernel according to instructions on the same webpage. One note here. If you run bpi-update on the host PC not on R2, you has to use the command as follows: bpi-update -d /dev/sdb -c bpi-r2.conf, where /dev/sdb is your SD card with burned R2 Ubuntu image.

And that’s it! After booting R2 from this SD card with DVB USB stick inserted DVB should work. I’m running Tvheadend on R2 already for several weeks. It works as it should. No problems so far.

1 Like