-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path03-linux-kernel.txt
196 lines (119 loc) · 5.02 KB
/
03-linux-kernel.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
Guide How to compile and install the Xilinx kernel with a linaro armhf toolchain in the MicroZedboard
Adrian Remonda 2014
Prerequisites
-------------
Get the kernel sources:
01-Get_the_kernel_sources.txt
Linaro toolchain installed
01-setup_SD_card.txt
Zedboard with a linux running, in this case xilinx 3.15
In debian or ubuntu install the next packages:
----------------------------------------------
~$ sudo dpkg --add-architecture i386
~$ sudo apt-get update
~$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386
~$ sudo apt-get install u-boot-tools
Set the compiler and add variables
---------------------------------
export CC=arm-linux-gnueabihf-
export CROSS_COMPILE=${CC}
export LOADADDR=0x10008000
export ARCH=arm
check that is the linaro:
~$ ${CC}gcc --version
Get the config file:
This file contains the linux configuration. Get the default:
~/linux-xlnx$ make xilinx_zynq_defconfig
Configure the kernel (works with the default configuration)
~/linux-xlnx$ make menuconfig
Device tree
-----------
use the device tree in arch/arm/boot/dts/zynq-zed.dts or the one in the examples
~$ gedit arch/arm/boot/dts/zynq-zed.dts
Change the line "chosen" parameters as next:
chosen {
bootargs = "console=ttyPS0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait earlyprintk";
linux,stdout-path = "/amba/serial@e0001000";
};
Compile it:
dtc -I dts -O dtb -o devicetree.dtb arch/arm/boot/dts/zynq-zed.dts
To add new perhiperals edit the next file:
arch/arm/boot/dts/zynq-7000.dtsi
Compile kernel
===============
jx core counts of your processor in this case 4 cores modifiy as need
~$ make menuconfig
~$ make uImage -j4
~$ make modules -j4
~$ make modules_install INSTALL_MOD_PATH=./modules
~$ tar -cf modules.tar -C modules .
To clean:
make clean
rootfs
=======
If you have an SD card with a running system the next must be updated:
- uImage
- devicetree.dtb
- modules
- BOOT.img (optional)
You can also update the Debian partition with the following:
~$ wget -c https://rcn-ee.com/rootfs/eewiki/barefs/debian-8.5-bare-armhf-2016-06-06.tar.xz
~$ sudo tar xfvp ./*-*-*-armhf-*/armhf-rootfs-*.tar -C /media/rootfs/
Install
===========
Insert the sd card. Check were the SD card is mounted with the lsblk command.
~$ lsblk
sdb 8:16 1 3.7G 0 disk
|-sdb1 8:17 1 50M 0 part /media/usb0
`-sdb2 8:18 1 1006M 0 part /media/usb1
In this case, the partition were mounted in /media/usb0 and /media/usb1
~$ export BOOT=/media/BOOT; export ROOTFS=/media/rootfs;
copy the files:
~$ cd linux-xlnx
~$ cp -v arch/arm/boot/uImage $BOOT
~$ cp -v devicetree.dtb $BOOT
In order to write in the rootfs we need to have root rights, and the ROOTFS variable was exported for the user.
We write an script or just hardcoding the path to rootfs as next.
~$ sudo make modules_install INSTALL_MOD_PATH=$ROOTFS
unmount:
~$ sync; sudo umount $BOOT; sudo umount $ROOTFS
Insert the SD card in the MicroZedboar
Configure minicom with the right serial port path
~$ sudo minicom -s
Should get the logs of the just create kernel
uZed:~# uname -a
Linux arm 3.15.0-xilinx-dirty #1 SMP PREEMPT Wed Jan 28 04:43:28 EST 2015 armv7l GNU/Linux
To check the modules, ipv6 should be loaded
uZed:~# lsmod
Module Size Used by
ipv6 253614 12
Install over ssh
=================
Once we have a kernel runing is fast to update it over ssh
Mount "boot" partition
----------------------
Skip this part if you have already mounted the boot partition in /mount/ZYNQ
To automatically mount the boot partition at boot time run the next command in the board:
uZed$ echo "/dev/mmcblk0p1 /media/ZYNQ auto noatime 1 2" >> /etc/fstab
Copy the kernel into the MicroZed
---------------------------------
Assuming that "boot" was mounted in /media/ZYNQ in the MicroZedboard debian and the ip of the board is 192.168.1.103
Copy the uImage and the device tree.
~$ scp -p arch/arm/boot/uImage [email protected]:/media/ZYNQ/
~$ scp -p devicetree.dtb [email protected]:/media/ZYNQ/
~$ rsync -avc modules/lib/. [email protected]:/lib/.
Reboot the board
~$ ssh [email protected] 'sync; reboot'
Install only one module
=======================
Example of coping the driver "drivers/remoteproc/zynq_remoteproc.ko"
~$ make ARCH=arm modules -j4
Copy zynq_remoteproc.ko in the path /lib/modules, x.y.z is the version of the kernel, in our case: 3.15.0-xilinx-00001-gc95b0382a8dc
scp drivers/remoteproc/zynq_remoteproc.ko [email protected]:/lib/modules/x.y.z/kernel/drivers/remoteproc/zynq_remoteproc.ko
To update a precompiled kernel
=============================
- Copy the kernel in the boot partition
- copy the modules .tar created when compiled the kenrel into the rootfs and do the folowing in the target:
~# cd /
~# tar -xf modules.tar
~# depmod -e