Exchanging files with MarS Board - FrankBau/meta-marsboard-bsp GitHub Wiki
Sometimes you want to upload a file form the build host to the Mars Board or download a file.
There are several choices
trivial, eh?
First time only: create a mount point, a new empty directory like this:
root@marsboard:~# mkdir /media/usb
Connect a USB stick (mass storage class device). On the console, you will see output like
usb 1-1.2: new high-speed USB device number 6 using ci_hdrc
usb-storage 1-1.2:1.0: USB Mass Storage device detected
scsi host1: usb-storage 1-1.2:1.0
scsi 1:0:0:0: Direct-Access Intenso Rainbow Line 1100 PQ: 0 ANSI: 4
sd 1:0:0:0: [sda] 7907328 512-byte logical blocks: (4.04 GB/3.77 GiB)
sd 1:0:0:0: [sda] Write Protect is off
sd 1:0:0:0: [sda] No Caching mode page found
sd 1:0:0:0: [sda] Assuming drive cache: write through
sda: sda1
sd 1:0:0:0: [sda] Attached SCSI removable disk
If you are not using the console, use dmesg | tail
to see that output or use lsusb
to see all usb devices.
A new block device has automagically been created: /dev/sda
. The name sda
may vary, check with
root@marsboard:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 3.8G 0 disk
`-sda1 8:1 1 3.8G 0 part
mmcblk1 179:0 0 3.7G 0 disk
|-mmcblk1p1 179:1 0 8M 0 part
`-mmcblk1p2 179:2 0 3.7G 0 part /
mtdblock0 31:0 0 2M 0 disk
mmcblk1 is the SD card with two partitions mmcblk1p1
(boot partition) and mmcblk1p2
(root file system)
and mtdblock0
is the SPI flash, a memory technology device (mtd), containing U-Boot boot loader. Do not use!
Mount the first partition /dev/sda1
of the block device to the mounting point.
Afterwards, you may use the files on the USB stick:
root@marsboard:~# mount /dev/sda1 /media/usb
root@marsboard:~# ls -l /media/usb/
total 2112
drwxr-xr-x 2 root root 4096 Nov 17 2013 'System Volume Information'
drwxr-xr-x 2 root root 4096 Jan 23 2014 Temp
...
Always unmount the stick before removing it!
root@marsboard:~# umount /dev/sda1
Many images contain a ssh daemon which allows secure file exchange via a network connection by using the scp
command. E.g. to upload a file my_module.ko
from the build host to the home folder of user root on a MarS Board with IP address 123.456.78.90 use
scp my_module.ko root@123.456.78.90:/home/root
This is not as comfortable as a network connection.
Prerequiisites:
- a serial connection from the build host using
minicom -D /dev/ttyUSB0 -w
- the
lrz
program is installed on MarS Board. It comes with thelrzsz
recipe and should already be in your image.
On the MarS board (in the root command shell prompt) enter
lrz
lrz
will now listen for incoming data and the shell will not accept new commands while lzr is running!
root@marsboard:~# lrz �z waiting to receive.**B0100000023be50
On the build host in minicom press Ctrl+A S
("Send file").
A menu appears where you can choose a protocol. zmodem
is the default, that's okay, press Enter.
An ASCII file dialog appears. Navigate to the file to be uploaded. When you have selected the file, press enter and the file is transferred to the board.
Navigation is somewhat akward. to select a file, press SPACE, to change the current directory press SPACE twice. (A good kept secret from my grandfather). For details, see man minicom.
root@marsboard:~# lrz �**B0100000023be50ive.**B0100000023be50 +-----------[zmodem upload - Press CTRL-C to quit]------------+ |Sending: my_module.ko | |Bytes Sent: 384 BPS:187 | |Sending: | |Ymodem sectors/kbytes sent: 0/ 0k | |Transfer complete | | | | READY: press any key to continue... | +-------------------------------------------------------------+ CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7 | VT102 | Offline | ttyUSB0
When finished, the file is on the board.
Note: this does not overwrite existing files, watch out for a "sz: skipped:" message!
On the board, use lsz filename
You may instead try editing files on the target.