Your Name

Email: <riku DOT voipio AT SPAMFREE linaro DOT org>

I work at Platform team on porting and crosscompiling issues.

This page is working as my scratchpad to collect notes which as not ready for proper documentation pages.

Networking setup

Setup on device

Using systemd-networkd: /etc/systemd/network/usb.network

[Match]
Name=usb0
[Network]
DHCP=yes

If using usb gadget from PC to board, set up a /etc/modprobe.d/g_ether.conf

options g_ether host_addr=00:11:22:33:44:55 dev_addr=00:11:22:33:44:56

Mac addresses chosen randomly

systemctl enable systemd-networkd

Setup the host

Set up the host as bridge with systemd:

/etc/systemd/network/eth.network

[Match]
Name=eth1
[Network]
Bridge=br0

bridge.netdev:

[NetDev]
Name=br0
Kind=bridge

bridge.network:

[Match]
Name=br0
[Network]
DHCP=yes

usb.network:

[Match]
Name=enx001122334455
[Network]
Bridge=br0

systemctl enable systemd-networkd

NFS file sharing

Host setup

Sometimes you want extra space on the board and easy file exchange. Install nfs server on host:

sudo apt-get install nfs-kernel-server

On the host, pick you UID and GID of you main user (use id command and setup /etc/exports

/srv/nfs  192.168.2.15(rw,insecure,all_squash,anonuid=1000,anongid=1002,async,no_subtree_check)

run:

mkdir -p /srv/nfs
sudo /etc/init.d/nfs-kernel-server reload

Device setup

Install nfs tools and mount the tree:

apt-get install nfs-common
mkdir -p /srv/nfs
mount -t nfs -o nfsvers=3 192.168.2.14:/srv/nfs /srv/nfs

Extra helps

Serial terminal

Dont use minicom, use screen!

screen /dev/ttyUSB0 115200,cs8,-ixon,-ixon,istrip

For shift-pageup/down scrolling to work, put in .screenrc:

# tell screen that you term can scroll
termcapinfo xterm ti@:te@
# bind Shift+PgUp/PgDn
bindkey -m "^[[5;2~" stuff ^b
bindkey -m "^[[6;2~" stuff ^f 

if not using xterm, replace xterm with the $TERM of your console.

ssh keys

Since when developing for boards, we constantly recreate rootfs and have new ssh host keys on the target. This leads to some annoying editing in .ssh/known_hosts. The workaround is to set in in .ssh/config:

Host 192.168.2.15
   StrictHostKeyChecking no
   UserKnownHostsFile=/dev/null

This will disable host keys saving for 192.168.2.15

Keyboard on mouse over ssh

Often USB is bust on boards, and thus using Ubuntu desktop gets impossible. But if you have network, you can use keyboard and mouse from another PC using x2x.

# apt-get install openssh-server x2x
# passwd linaro # give linaro user a password for inbound ssh 

Now from a PC:

ssh -X linaro@192.168.2.15 # the IP address of your board
DISPLAY=:0 setxkbmap fi # make the keymap same for PC and device
linaro-ubuntu-desktop$ x2x -from $DISPLAY -to :0 -east

In this setup, we expect the board display to be on the right side from the PC, hence east.

Now scroll the mouse over the right edge of you PC display, and the mouse cursor will appear in the boards display. Go to system settings and disable screensaver (screensaver doesn't notice mouse input from x2x) and set the keyboard layout to correct.

mounting image files

linaro-media-create always creates two partitions to images even if not needed. This is annoying for mounting filesystesms in images, but workaroundable.

# to mount first partition
sudo mount -t vfat -o loop,offset=$((`/sbin/fdisk -lu sd.img|awk '/sd.img1/ {print $3}'` * 512)) sd.img /mnt

# to mount second partition
sudo mount -t ext4 -o loop,offset=$((`/sbin/fdisk -lu sd.img|awk '/sd.img2/ {print $2}'` * 512)) sd.img /mnt

Qemu nfsroot boot

Set up:

sudo apt install nfs-kernel-server
# add the next line to /etc/exports:
echo '/srv/ 127.0.0.1(rw,sync,no_subtree_check,no_root_squash,insecure)' | sudo tee -a /etc/exports
sudo exportfs -av

And boot

sudo mkdir /srv/rpb
cd /srv/rpb
sudo tar xaf rpb-console-image-intel-core2-32-20170921040647-116.rootfs.tar.xz
qemu-system-x86_64 -enable-kvm -m 2048 -kernel boot/bzImage-4.14.0-rc1-next-20170921 -nographic -append "ip=dhcp root=/dev/nfs nfsroot=10.0.2.2:/srv/rpb,nfsvers=3 console=ttyS0"

Or an arm64boot:

qemu-system-aarch64 -m 2048 -cpu cortex-a57 -M virt -kernel Image -netdev bridge,id=e0 -device virtio-net-device,netdev=e0 -nographic -append "earlycon root=/dev/nfs rootdelay=5 console=ttyAMA0 ip=dhcp nfsroot=10.0.2.2:/srv/buster-arm64"


CategoryPeople

RikuVoipio (last modified 2017-09-22 08:13:38)