如何移植用于zedboard的kernel

1) 如何下载?
https://github.com/Xilinx/linux-xlnx/releases
下载xilinx官方linux源码。这里下载2017.4版本。
里面是xilinx_zynq_defconfig

或者下载digilent的官方源码。
https://github.com/Digilent/linux-digilent/releases
下载4.4版本。从4.4版本以后,digilent已经停止更新。
里面是xilinx_zynq_defconfig

建议使用xilinx官方代码。

2) 如何利用xilinx_zynq_defconfig修改出适合zed的config?
zedboard在xilinx官方源码的基础上,增加和删减了某些配置。
# cd ~/linux-xlnx
# make xilinx_zynq_defconfig
# make menuconfig
在menuconfig中,把ZED和defconfig之间有差异的选项修改。
例如在3.x版本中:
(1)General setup —> Export task/process statistics through netlink,选上。
(2)General setup —>Configure standard kernel features —>Include all symbols in kallsyms,选上。
(3)System Type —> ARM system type (Xilinx Zynq ARM Cortex A9 Platform) —> Xilinx Zynq ARM Cortex A9 Platform,选上。
(4)Kernel Features —> Tickless System (Dynamic Ticks),去掉。
(5)Device Drivers —> Memory Technology Device (MTD) support —>Self-contained MTD device drivers —> Support most SPI Flash chips (AT26DF, M25P, W25X, …),去掉
(6)Device Drivers —> Memory Technology Device (MTD) support —>Self-contained MTD device drivers —> Support SST25L (non JEDEC) SPI Flash chips,去掉
(7)Device Drivers —> Misc devices —> Silicon Labs Si570 Clock Generator,去掉。
(8)Device Drivers —> Network device support —> Ethernet driver support —> Generate hardware packet timestamps,选上。
(9)Device Drivers —> Network device support —> Ethernet driver support 除了 Xilinx devices,其他全部去掉。
(10)Device Drivers —> Network device support —> PHY Device support and infrastructure —> Drivers for the Vitesse PHYs,去掉。
(11)Device Drivers —> Network device support —>Wireless LAN,去掉
(12)Device Drivers —> Input device support —> Event debugging,去掉。
(13)Device Drivers —> Character devices —> Xilinx Device Configuration,选上。
(14)Device Drivers —> I2C support —> I2C device interface,去掉。
(15)Device Drivers —> I2C support —>Multiplexer I2C Chip support —> Philips PCA954x I2C Mux/switches,去掉。
(16)Device Drivers —> I2C support —> Autoselect pertinent helper modules ,选上。
(17)Device Drivers —> I2C support —> I2C Hardware Bus support —> GPIO-based bitbanging I2C,XILINX PS I2C Controller,Xilinx I2C Controller,选上。
(18)Device Drivers —>SPI support —> GPIO-based bitbanging SPI Master,Xilinx PS QSPI controller,Xilinx PS SPI controller,选上。
(19)Device Drivers —>Graphics support —> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)
(20)Device Drivers —>Graphics support —>Support for frame buffer devices —> Xylon logiCVC frame buffer support,去掉
(21)Device Drivers —>Graphics support —>Console display driver support —> Framebuffer Console support,选上。
(22)Device Drivers —>Graphics support —>Bootup logo ,选上。
(23)Device Drivers —>Sound card support —> Advanced Linux Sound Architecture —> ALSA for SoC audio support ,选上前两个。
(24)Device Drivers —>USB support —> OTG support,选上。
(25)Device Drivers —>LED Support —> LED Class Support,LED Support for GPIO connected LEDs,选上
(26)Device Drivers —>LED Support —> LED Trigger support,所有触发源全部选上。
(27)Device Drivers —>Real Time Clock —> Philips PCF8563/Epson RTC8564 ,去掉。
(28)Device Drivers —>DMA Engine support —> Xilinx DMA engines support,Xilinx DMA engines support,选上。
(29)Device Drivers —>Pmod Support —> 选上PModOLED
(30)File systems —> The Extended 4 (ext4) filesystem,Use ext4 for ext2/ext3 file systems ,Ext4 extended attributes ,选上,去掉Second extended fs support,Ext3 journalling file system support 。
(31)File systems —> Miscellaneous filesystems —> Journalling Flash File System v2 (JFFS2) support ,去掉。
(32)Kernel hacking —> Show timing information on printks,Debug Filesystem ,Compile the kernel with debug info,Kernel low-level debugging port (No low-level debugging UART),Early printk选上,Default message log level (1-7)设为7,
(33)Library routines —> CRC16 functions,CRC32 functions 选上。

先从3.3的移植和编译入手。
3.3有一个digilent_zed_defconfig。
直接用这个配置编译出内核。
menuconfig中,
boot option里面,去掉默认bootcmd,这样,可以从uboot的bootargs中提取启动参数。
kernel hacking里面,
把printk level 放宽到7。即使是7级的信息,也打印出来,虽然增加了很多冗余信息,但是对于移植来说,信息越多越好。
把earlyprint选上,使能它。
其他的一些kernel debug功能,需要的都选上。
然后编译。

用ZImage替换之前官方的那个zImage,发现可以工作。
但是提示Pmodoled加载了两次。
重新menuconfig,把device driver下的pmods中的pmodoled1编译成M,再次运行,没有报错。

再来看看如何移植2017.4版本。
2017.4加入了一些新特性,我们不动它,看看有哪些是zed支持的,我们添加进去。
先加载2017.4defconfig,然后修改:
(1)General setup —> Enable deprecated sysfs features to support old userspace tools,选上。
(2)General setup —> Configure standard kernel features (expert users) —> Include all symbols in kallsyms ,BUG() support,选上
(3)Enable the block layer —>IO Schedulers —>Deadline I/O scheduler,CFQ I/O scheduler,选上。
(4)System Type —>Xilinx Zynq ARM Cortex A9 Platform,选上。
(5)Bus support —> Message Signaled Interrupts (MSI and MSI-X),选上。
(6)Bus support —>Enable PCI resource re-allocation detection ,选上。
(7)Bus support —>PCI host controller drivers —Xilinx AXI PCIe host bridge suppor,选上。
(8)Kernel Features —> Maximum zone order,改为15.
(9)Networking support —> Networking options —> IP: tunneling,改为M.
(10)Networking support —> Networking options —>The IPv6 protocol 改为M。
(11)Networking support —> Networking options —>802.1d Ethernet Bridging,IGMP/MLD snooping,802.1Q/802.1ad VLAN Support,改为M。
(12)Device Drivers —>Block devices —> Default RAM disk size (kbytes) ,改为16384
(13)Device Drivers —>Network device support —> Wireless LAN,Wan interfaces support去掉。
(14)Device Drivers —>Input device support —> Export input device LEDs in sysfs ,去掉。
(15)Device Drivers —>Input device support —>Keyboards —> GPIO Buttons,Polled GPIO buttons,去掉。
(16)Device Drivers —>Character devices —> Xilinx Device Configuration,加上。
(17)Device Drivers —>GPIO-based bitbanging I2C ,Xilinx I2C Controller,加上。
(18)Device Drivers —>SPI support —> GPIO-based bitbanging SPI Master,加上。
(19)Device Drivers —>Hardware Monitoring support,去掉。
(20)Device Drivers —>Graphics support —>Bootup logo,加上。
(21)Device Drivers —>USB support —>OTG support,加上。
(22)Kernel hacking —>printk and dmesg options —> Show timing information on printks,加上,Default message log level (1-7),改为7。
(23)Kernel hacking —>Compile-time checks and compiler options —> Debug Filesystem,Compile the kernel with debug info,加上。
(24)Kernel hacking —>Kernel low-level debugging functions–>Kernel low-level debugging on Xilinx Zynq using UART1,选上。
(25) Kernel hacking —>Early printk,选上。
(26)Cryptographic API —> Disable run-time self tests ,选上。
(27)Cryptographic API —>,默认选中的其他选项,全部改为M。
新版内核强制设置了
支持了multiplatform,就自动选择了auto_zreladdr。
不用管0x00008000的问题了

但是为了生成uImage,需要在makefile里面定义LOADADDR变量。
LOADADDR 在arch/arm/boot/Makefile里面定义成0x00008000.

DTB必须和KERNEL版本匹配,所以,必须用源码下的DTS进行修改得到DTB。

3)在linux内核源码中添加自己的模块代码

4)修改DTS,增加新增模块的设备节点的描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值