By default, to transfer files to the Linux kernel from Xilinx, you can use several methods, which are described on their wiki: xilinx-wiki.atlassian.net.
Files can be transferred to the working system both via the Ethernet port and via the USB (UART) port. But since the file system is in RAM, when the power is turned off, added files will disappear. To save them you will need to change the rootfs file system. First, let's try transferring files via ethernet.
It is worth noting that by default, U-Boot will try to find the Linux kernel via the Ethernet port before searching for it on QSPI. If the cable is not connected, then U-Boot proceeds to the next step, otherwise boot process takes a lot of time, but still will be executed from QSPI.
Firstly, let's check how the network is configured. To do this, use the ifconfig command, which displays all the included network interfaces:
Fig. 1 Executing the ifconfig command |
let's check which network interfaces are configured in the system with command
"ifconfig -a":
Fig.2 Executing the ifconfig -a command |
eth0 is the first ethernet interface,
lo - loopback, more details here,
sit0 - Simple Internet Transition, used to transmit IPv6 over IPv4, more details here.
We are interested in eth0, at the moment it is turned off, in order to turn it on we use the
"ifconfig eth0 up":
Fig. 3 Enabling the interface |
Рис.4 Проверка включения интерфейса |
Fig. 5 Terminal output when connecting an Ethernet device |
First, configure the network device to which Zybo is connected, in my case it is a computer, it is necessary to set the correct IP address. The main thing is that both devices are on the same subnet. The settings are as follows:
IP address 192.168.1.11
Subnet mask 255.255.255.0
Fig. 6 Computer IP settings |
Fig. 7 Interface settings |
Fig. 8 test connection Zybo -> PC |
Fig. 9 Checking PC -> Zybo connection |
SFTP
1 Method to transfer files is via SFTP, SSH File Transfer Protocol. It is enabled by default in Zybo, ethernet is configured, so everything should work. To transfer files, you need to install some client on the transfer side. In Windows, I used "psftp". By default, the login and password for accessing Zybo is "root".
Move the file from computer D:/study/test_file.txt в Zybo /usr/:
Fig. 10 Moving a file through sftp |
ROOTFS
Files can be transferred in both directions, but when the power is turned off, all changes made will be lost. It happens because the file system is located in random access memory (RAM). In order for the files to not disappear when the power is turned off, they must be added to the rootfs file system and the boot image BOOT.bin should be rewritten again. In the same way, additional programs are installed on our system.
A description of the required actions is indicated here: xilinx-wiki.atlassian.net.
If you are using rootfs with the U-boot header already added, then you must first remove it, otherwise you can’t unzip it. If the file is in the root directory, then use this command:
"dd if = uramdisk.image.gz bs = 64 skip = 1 of = ramdisk.gz", a file with a compressed file system with an added header is called "uramdisk.image.gz", a new file "ramdisk.gz", without U-boot title, will appear next to it .
Fig. 11 Removing a header from a file |
Fig. 12 Unzipping a file |
As a result, we got an image of the file system; to change it, you need to mount it. First, change the file permissions, you must allow it's execution:
"chmod u+rwx ramdisk".
Next, create the "tmp_mnt" folder into which the system will be mounted using the command:
"mkdir tmp_mnt".
The last thing is to mount the system with the command:
"sudo mount -o loop ramdisk tmp_mnt"
Fig. 13 Changing priorities and mounting an image |
Now the file system is mounted and you can make changes to it. For the sake of example, let's create "rootfs_test_file.txt" file and move it to the /usr/ directory, commands:
"cat > rootfs_test_file.txt" - create a new file and open it for writing
"CTRL+C" - stop writing to the file and close it
"sudo mv rootfs_test_file.txt tmp_mnt/usr/" - move the file
"ls tmp_mnt/usr" - output it's content for verification
Fig. 14 Creating a file and moving it |
"sudo umount tmp_mnt/"- unmount
"gzip ramdisk" - compression
"u-boot-xlnx/tools/mkimage -A arm -T ramdisk -C gzip -d ramdisk.gz uramdisk.image.gz" - adding a U-boot header, for this you need the mkimage utility supplied with U-boot. It was used in previous tutorial
Fig. 15 Archiving a file and adding a header |
After starting Linux, you can verify that the file is in place:
Fig. 16 Checking the added file |
No comments :
Post a Comment