Ethernet/SSH over usb - LS1046ardb

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ethernet/SSH over usb - LS1046ardb

3,776 Views
renemarcker
Contributor II

Hello,

I'm working on the LS1046ardb and want to enable ethernet/SSH over USB.

I'm following the Yocto Guide (Layerscape Software Development Kit User Guide for Yocto, Rev. 3.1, 04 October 2021)

I have downloaded Yocto layers and build Yocto images which work fine.

I have my build directory: "build_ls1046ardb" and have the images in  "tmp/deploy/images/ls1046ardb"

I have build using "bitbake -k fsl-image-networking"



So far, in my attempt for making Ethernet/SSH over USB, I have taking inspiration from:
LS1021a USB3.0 Ethernet Over USB Issue - NXP Community

-> but unsure where I find the .dts file and if I can use "usb3" when it is ls1046ardb


iMXRT1062 - Ethernet over USB - NXP Community

-> no idea how to translate to the ls1046ardb


Modifying LS1046ARDB kernel - NXP Community

-> again unsure where the .dts file is and what to add to it


12 Features — The Yocto Project ® 3.1.18 documentation

-> wonder if need to add machine and distro features (usbgadget and usbhost)


Connect to Your Raspberry Pi Over USB Using Gadget Mode - Howchoo

-> what I like to do, but unsure how to make the parallel to ls1046ardb.

Hope someone can assist me and thank you in advance. 




0 Kudos
Reply
10 Replies

3,769 Views
renemarcker
Contributor II

Hello Yipingwang,

thank you for the answer. I'm currently at the "Kernel Features" menu. I cant see USB gadget support or the other two. Are they in a sub menu?

0 Kudos
Reply

3,766 Views
renemarcker
Contributor II

I found them: Device Drivers -> USB support -> USB gadget support

0 Kudos
Reply

3,771 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please download "Layerscape Software Development Kit User Guide, Rev. 21.08" from the following link.

https://www.nxp.com/design/software/embedded-software/linux-software-and-development-tools/layerscap...

Then refer to section "Ethernet gadget" in LSDK 21.08 User Guide.

Please go to folder build_ls1046ardb/tmp/work/ls1046ardb-fsl-linux/linux-qoriq/5.4.3+gitAUTOINC+134788b164-r0/build, run "make ARCH=arm64 menuconfig" and configure Linux Kernel as the following.

yipingwang_0-1661413288438.png

Go to Linux Kernel source code folder build_ls1046ardb/tmp/work/ls1046ardb-fsl-linux/linux-qoriq/5.4.3+gitAUTOINC+134788b164-r0/git, please modify the following in dts file arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi.

Device Tree update, change property dr_mode’s data from “host” to “peripheral”, add property maximum-speed = “super-speed” as below:

usb0: usb@2f00000 {
compatible = "fsl,ls1046a-dwc3", "snps,dwc3";
reg = <0x0 0x2f00000 0x0 0x10000>;
interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
dr_mode = "peripheral";
snps,quirk-frame-length-adjustment = <0x20>;
snps,dis_rxdet_inp3_quirk;
snps,incr-burst-type-adjustment = <1>, <4>, <8>, <16>;
usb3-lpm-capable;
snps,dis-u1u2-when-u3-quirk;
snps,host-vbus-glitches;
dma-coherent;

maximum-speed = “super-speed”;
};

Go back to folder build_ls1046ardb to rebuild Linux Kernel.

$ bitbake virtual/kernel -c compile -f

$ bitbake virtual/kernel

The generated Kernel modules are in build_ls1046ardb/tmp/deploy/images/ls1046ardb/modules-ls1046ardb.tgz

Execute below shell commands to insmod related ko files on RDB board.
root@ls1043a:/run/media/mmcblk0p1# insmod libcomposite.ko
root@ls1043a:/run/media/mmcblk0p1# insmod u_ether.ko
root@ls1043a:/run/media/mmcblk0p1# insmod usb_f_ecm.ko
root@ls1043a:/run/media/mmcblk0p1# insmod usb_f_ecm_subset.ko
root@ls1043a:/run/media/mmcblk0p1# insmod usb_f_rndis.ko
root@ls1043a:/run/media/mmcblk0p1# insmod g_ether.ko
[ 138.046732] using random self ethernet address
[ 138.051188] using random host ethernet address
[ 138.055884] usb0: HOST MAC 5e:4a:86:d0:dc:b6
[ 138.060219] usb0: MAC c2:53:e1:5b:d0:d9
[ 138.064100] using random self ethernet address
[ 138.068549] using random host ethernet address
[ 138.073041] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[ 138.079653] g_ether gadget: g_ether ready

 

 

0 Kudos
Reply

3,765 Views
renemarcker
Contributor II

Hello  @yipingwang 

 

I have come to the point where I have rebuild Linux Kernel and I have the modules-ls1046ardb.tgz.

how to I use this for making bootable sd card?

My normal process is like this:

flex-installer -b boot_LS_arm64_lts_5.10.tgz -r fsl-image-networking-ls1046ardb.tar.gz -f firmware_ls1046ardb_sdboot.img -d /dev/sdd

where

  • boot_LS_arm64_lts_5.10.tgz and firmware_ls1046ardb_sdboot.img have I got from flex-installer download
  • fsl-image-networking-ls1046ardb.tar.gz is from the Yocto build.


Additional question: can I switch boot_LS_arm64_lts_5.10.tgz and firmware_ls1046ardb_sdboot.img with files in the build_ls1046ardb/tmp/deploy/images/ls1046ardb folder? 

0 Kudos
Reply

3,758 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please refer to the following procedure to deploy Yocto built images to SD card.

Please connect SD card to your host PC

  1. Please create two partitions with Linux command "fdisk", one 1G FAT16 and 2G one ext2/ext3 or with remainder of the available disk size.
    # mkfs.vfat /dev/sdb1
    # mkfs.ext2 /dev/sdb2

  2. Please deployed RCW + PBI + BL2(bl2_.pbl)image to SD card as the following.
    dd if=bl2_sd.pbl of=/dev/sdb bs=512 seek=8

note:/dev/sdb is SD device name.

Please deploy TF-A FIP image at 0x00800 in SD card.

dd if=fip_uboot.bin of=/dev/sdb bs=512 seek=2048

$ sudo dd if=fsl_fman_ucode_ls1046_r1.0_106_4_18.bin of=/dev/sdb bs=512 seek=184323.

3. Please deploy rootfs filesystem to SD card in the host PC as the following.
# mkdir  ~/temp
# mount  /dev/sdb2  ~/temp
# cp  fsl-image-networking-ls1046ardb.tar.gz ~/temp

# cd ~/temp
# tar -xzvf  fsl-image-networking-ls1046ardb.tar.gz
# rm  fsl-image-networking-ls1046ardb.tar.gz

# cd –

# cp modules-ls1046ardb.tgz ~/temp

Please deploy Kernel Image and the dtb to the /boot folder.

# cp Image ~/temp/boot

# cp  fsl-ls1046a-rdb-sdk.dtb ~/temp/boot

Configure the switch setting boot from SD card 


Set the environment in uboot for SD boot.
=> setenv bootcmd 'setenv bootargs root=/dev/mmcblk0p2 rw rootdelay=5 console=ttyS0,115200;mmcinfo;ext2load mmc 0:2 0xa0000000 /boot/Image;ext2load mmc 0:2 0xb0000000 /boot/ fsl-ls1046a-rdb-sdk.dtb;booti 0xa0000000 - 0xb0000000'
=> saveenv

Boot up Linux
=> boot

0 Kudos
Reply

3,755 Views
renemarcker
Contributor II

Hey again @yipingwang 

 

I understand all the steps, but unsure on some of them:

1) I can find all the other files in the build_ls1046ardb/tmp/deploy/images/ls1046ardb.

and it is correct the bl2_sd.pbl and fip_uboot.bin is at the ../atf folder?


2) How about the modules-ls1046ardb.tgz, it does not need to be uncompromised?

3) I dont need to run "sync" and umount ~/temp?  

4) When do as descripted, I get following error output from the RDB (attached image)

0 Kudos
Reply

3,720 Views
yipingwang
NXP TechSupport
NXP TechSupport

1. Correct.

2. It could be uncompromised on the LS1046ARDB target board.

3. "sync" is needed.

4. Please apply the attached patch in atf source code.

Please go to atf souce folder build_ls1046ardb/tmp/work/ls1046ardb-fsl-linux/atf/git-r0/git/, apply the attached patch and rebuild atf images.

$ bitbake atf -c compile -f

$ bitbake atf

0 Kudos
Reply

3,636 Views
renemarcker
Contributor II

Hello @yipingwang ,

 

I'm now able to boot from SD card and set the environment in uboot for SD boot.

I'm at the point of executing the shells commands to insmod related ko files on RDB board.

But, there is some issues...

  1. There is no directory named "/run/media/mmcblk0p1"
  2. There is no of the .ko files

I have found the .ko files in the yocto build directory on my host PC and tried add them on the SD card and ran it from the root directory. but got the error:

insmod: ERROR: could not insert module libcomposite.ko: Invalid module format

I have added the boot sequence output as attached txt file. There is also the insmod error.

0 Kudos
Reply

3,626 Views
renemarcker
Contributor II

@yipingwang 

now I can run the shell commands to insmod from root directory (those .ko files I have added from my Yocto build folder) without getting errors, but it seems to do nothing. I dont get the output:

[ 138.046732] using random self ethernet address
[ 138.051188] using random host ethernet address
[ 138.055884] usb0: HOST MAC 5e:4a:86:d0:dc:b6
[ 138.060219] usb0: MAC c2:53:e1:5b:d0:d9
[ 138.064100] using random self ethernet address
[ 138.068549] using random host ethernet address
[ 138.073041] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[ 138.079653] g_ether gadget: g_ether ready

 

I can also see the interface by "ifconfig -a": 

usb0: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether e6:e7:2b:7a:47:a3 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

@yipingwang , can you explain this? Thx in advanced

 

P.S I have changed to the kirkstone Yocto repo.

0 Kudos
Reply

3,586 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please refer to the attached log provided by the testing team with Yocto 5.10 Linux Kernel.

0 Kudos
Reply