Adding a module to an assembly

Have a nice day!
Iam struggling with milkv duo sd.
How I should add usb ip to kernel build?
I tried to change the configuration in /linux_5.10/build/cv1800b_milkv_duo_sd/.config
But it didn’t help - after reassembling, this file loses my changes.

3 Likes

Here’s where the config is copied from for Duo 64M SD. Change this one.

build/boards/cv180x/cv1800b_milkv_duo_sd/linux/cvitek_cv1800b_milkv_duo_sd_defconfig
2 Likes

Thank you!
Could you give me another hint?
I have selected items related to usbip and got problems when compiling:

  1. linux_5.10/drivers/usb/dwc2/hcd_intr.c:4 error: error expected } before else
    There is a solution for this point on this site Compile Error After Update Kernel Config
  2. compilation errors with ION
    /home/work/linux_5.10/drivers/staging/android/ion/ion.c:741:27: error: ‘buffer’ undeclared (first use in this function)
    /home/work/linux_5.10/drivers/staging/android/ion/ion_heap.c:25:66: error: ‘struct ion_buffer’ has no member named ‘paddr’;
    and etc.
    I did some digging and realized that the problem is in some defines.
    But simply declaring them in the header file does not solve the problem.

What should be done in these two cases?

1 Like

Strange. Does git status show any inadvertent file changes? Can you try running the steps one-by-one rather than running the top-level build shell script? You could then use the kernel menuconfig any copy over your defconfig.

Failing the above, you could push your changes onto a git branch for review.

2 Likes

I changed build/boards/cv180x/cv1800b_milkv_duo_sd/linux/cvitek_cv1800b_milkv_duo_sd_defconfig (select usbip drivers)
and run build.
Git log shows nothing but the defconfig change.

Can you try running the steps one-by-one rather than running the top-level build shell script?

Did you mean next steps:
get_toolchain
export MILKV_BOARD=“${MILKV_BOARD}”
prepare_env
build_info
milkv_build?

1 Like

Yes, exactly those steps. Probably because the top-level build automation script can sometimes pollute build environment and fail to clean it of conflicting files.

Plus, not git log, but git status or git diff.

1 Like

Of course I mean git status

1 Like

Yes, exactly those steps
Ok, I can try, but how can it help me?

1 Like

Well, this is what was suggested:

1 Like

Ok, I did this.
I have selected the usbip module in defconfig.
And after this I got some problems.

Maybe someone can pick usbip support in kernel (vhci hcd, host driver, vudc driver) and try to build?

1 Like

Hi @vick_lo I will try, but pulling your exact setup from git would be less error-prone.

This is what I ran.

. device/milkv-duo-sd/boardconfig.sh
. build/${MV_BUILD_ENV}
clean_uboot
clean_kernel
build_uboot
menuconfig_kernel

Is this the correct selection (under Device Drivers, USB support)?

<*>   USB/IP support
<*>     VHCI hcd
(8)       Number of ports per USB/IP virtual host controller (NEW
(1)       Number of USB/IP virtual host controllers (NEW)
<*>     Host driver
<*>     VUDC driver
[*]     Debug messages for USB/IP

I then ran

build_kernel

The result was success:

INFO: size:2de974, offset:0, part_sz:8000000, crc:37e8d983
INFO: Packing boot.sd done!

I started from fresh. Perhaps there’s something lurking on your environment?

2 Likes

On this moment I get error:

root@b6604e13bb67:/home/work# clean_kernel                                                                                     │*** Execute 'make' to start the build or try 'make help'.
 Run clean_uboot() function                                                                                                   │
Makefile:52: *** Please execute defconfig/menuconfig/oldconfig first.  Stop.

What I did wrong?

1 Like

There’s an issue with your defconfig. You should stash/restore it to default and try again. E.g. git status should not show changed files.

2 Likes

I literally re cloned repository, rerun docker, reexport variable and functions from boardconfig.sh and ${MV_BUILD_ENV} and got this error.

BTW issue on 52’s string of Makefile chained with variable OUTPUT_DIR.
And echo ${OUTPUT_DIR} got nothing.
May be I should import something else?

Thank you for helping me with my problem!

Added after:

After I did defconfig cv1800b_milkv_duo_sd OUTPUT_DIR has appeared.
But now process failed on build_uboot:

  [TARGET] u-boot-build 
ln -snrf /home/work/build/output/cv1800b_milkv_duo_sd/cvi_board_memmap.h /home/work/u-boot-2021.10/include/
rm -f /home/work/u-boot-2021.10/board/cvitek/cvi_board_init.c
ln -s /home/work/build/boards/cv180x/cv1800b_milkv_duo_sd/u-boot/cvi_board_init.c /home/work/u-boot-2021.10/board/cvitek/cvi_board_init.c
rm -f /home/work/u-boot-2021.10/include/cvitek/cvitek.h
ln -s /home/work/build/boards/cv180x/cv1800b_milkv_duo_sd/u-boot/cvitek.h /home/work/u-boot-2021.10/include/cvitek/cvitek.h
make -j16 -C /home/work/u-boot-2021.10 olddefconfig
make[1]: Entering directory '/home/work/u-boot-2021.10'
make[2]: Entering directory '/home/work/u-boot-2021.10/build/cv1800b_milkv_duo_sd'
/bin/sh: 1: riscv64-unknown-linux-musl-gcc: not found
  HOSTCC  scripts/basic/fixdep
  GEN     Makefile
  HOSTCC  scripts/kconfig/conf.o
  YACC    scripts/kconfig/zconf.tab.c
  LEX     scripts/kconfig/zconf.lex.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
/home/work/u-boot-2021.10/scripts/kconfig/Makefile:105: *** No configuration exists for this target on this architecture.  Stop.
scripts/kconfig/conf  --olddefconfig Kconfig
/home/work/u-boot-2021.10/scripts/gcc-version.sh: 26: riscv64-unknown-linux-musl-gcc: not found
/home/work/u-boot-2021.10/scripts/gcc-version.sh: 27: riscv64-unknown-linux-musl-gcc: not found
/home/work/u-boot-2021.10/scripts/gcc-version.sh: 29: riscv64-unknown-linux-musl-gcc: not found
/home/work/u-boot-2021.10/scripts/gcc-version.sh: 26: riscv64-unknown-linux-musl-gcc: not found
/home/work/u-boot-2021.10/scripts/gcc-version.sh: 27: riscv64-unknown-linux-musl-gcc: not found
/home/work/u-boot-2021.10/scripts/gcc-version.sh: 29: riscv64-unknown-linux-musl-gcc: not found
Kconfig:66: syntax error
Kconfig:65: invalid option
/home/work/u-boot-2021.10/scripts/clang-version.sh: 15: riscv64-unknown-linux-musl-gcc: not found
make[3]: *** [/home/work/u-boot-2021.10/scripts/kconfig/Makefile:75: olddefconfig] Error 1
make[2]: *** [/home/work/u-boot-2021.10/Makefile:578: olddefconfig] Error 2
make[2]: Leaving directory '/home/work/u-boot-2021.10/build/cv1800b_milkv_duo_sd'
make[1]: *** [Makefile:178: sub-make] Error 2
make[1]: Leaving directory '/home/work/u-boot-2021.10'
make: *** [Makefile:201: u-boot-build] Error 2

1 Like

Please try following the step-by-step procedure from the beginning, since the build environment not being able to have your environment variables usually signifies you missed a step.

Correct. If you wiped your entire container rather than running git reset --hard then you lost your downloads and tools. Simplest fix at this point is to run through the complete build using ./build.sh milkv-duo-sd and then re-running the individual steps. You could also try get_toolchain which will be faster if it works.

1 Like

@hannahKobain @ewp
Thank you for help!
I finally managed to build the firmware with usbip.
But after flash to sd I get next problem - I cant connect to milkv through usbip.
dmesg gives the following errors:

[629404.873072] usb 1-4.2: new high-speed USB device number 54 using xhci_hcd
[629410.489134] usb 1-4.2: device descriptor read/64, error -110
[629426.361381] usb 1-4.2: device descriptor read/64, error -110
[629426.633320] usb 1-4.2: new high-speed USB device number 55 using xhci_hcd
[629431.993340] usb 1-4.2: device descriptor read/64, error -110
[629447.865086] usb 1-4.2: device descriptor read/64, error -110
[629447.969594] usb 1-4-port2: attempt power cycle
[629448.649051] usb 1-4.2: new full-speed USB device number 56 using xhci_hcd
[629453.841070] xhci_hcd 0000:03:00.3: Timeout while waiting for setup device command
[629459.473081] xhci_hcd 0000:03:00.3: Timeout while waiting for setup device command
[629459.681242] usb 1-4.2: device not accepting address 56, error -62
[629459.681489] usb 1-4.2: WARN: invalid context state for evaluate context command.
[629459.849291] usb 1-4.2: new full-speed USB device number 57 using xhci_hcd
[629465.105412] xhci_hcd 0000:03:00.3: Timeout while waiting for setup device command
[629470.737081] xhci_hcd 0000:03:00.3: Timeout while waiting for setup device command
[629470.945029] usb 1-4.2: device not accepting address 57, error -62
[629470.945709] usb 1-4.2: WARN: invalid context state for evaluate context command.
[629470.945824] usb 1-4-port2: unable to enumerate USB device
[629646.375879] rtw_8821ce 0000:01:00.0: timed out to flush queue 2
[629646.485852] rtw_8821ce 0000:01:00.0: timed out to flush queue 2

If I removed usbip from kernel it helps to get rid of it.

1 Like

I’m a bit confused, but in which state is the USB controller of the Milk-V Duo board? Because if it’s in host state, then you may fail to «dominate» it over its own USB.

1 Like

It may be because I select host driver on usb/ip support?
If it is true how I can get IP address without connect to milkv through usb-ethernet and without access to router?
Can I get mac-address somewhere?
Or can I set IP address before build firmware?

1 Like

I didn’t try it in this mode myself, although I do have their official (not very much populated, tho) expansion board (the one with the USB hub and Ethernet board).

For a cheap way to start, I’d recommend you trying the serial console method using a USB-to-TTL converter: this way you will at least have access to the OS.
And yes, there are ways to both specify MAC address (so far during compilation stage only) or configure other things.

1 Like