系统相关
首页 > 系统相关> > [linux kernel]内核移植过程记录

[linux kernel]内核移植过程记录

作者:互联网

系统版本:Ubuntu18.04-64

编译器版本:gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)

uboot版本:2018.07 -linux4sam_6.0

板子型号:at91sama5d3x-xplained

MCU型号:sama5d36

内核移植主要是裁剪一些不需要的功能,使用对应的交叉工具链把内核重新编译,设备树文件按照硬件去配置。

一、配置文件路径

arch/arm/configs/sama5_defconfig

//配置文件路径
arch/arm/configs/sama5_defconfig

//声明环境变量,指定交叉编译器
$ export CROSS_COMPILE=arm-linux-gnueabi-

//先按照默认配置编译内核文件,看是否会报错,编译出来的文件先进行烧录,是否能正确引导文件系统;
$ make ARCH=arm sama5_defconfig
$ make ARCH=arm

//图形化配置窗口调出
$ make ARCH=arm menuconfig

//单独编译设备树文件,生成dtb文件
$ make ARCH=arm dt

二、把编译的zImage和dtb文件烧录板子,根据打印信息,分析出硬件驱动的情况。

1、内核接收uboot传递过来的分区信息,要和设备树中的分区一致,后面再细讲;

Kernel command line: console=ttyS0,115200 earlyprintk mtdparts=atmel_nand:256k(bootstrap)ro,768k(uboot)ro,256K(env_redundant),256k(env),512k(dtb),6M(kernel)ro,-(rootfs) rootfstype=ubifs ubi.mtd=6 root=ubi0:rootfs

2、GPIO控制器驱动OK

AT91: PM: standby: standby, suspend: ulp0
gpio-at91 fffff200.gpio: at address (ptrval)
gpio-at91 fffff400.gpio: at address (ptrval)
gpio-at91 fffff600.gpio: at address (ptrval)
gpio-at91 fffff800.gpio: at address (ptrval)
gpio-at91 fffffa00.gpio: at address (ptrval)
pinctrl-at91 ahb:apb:pinctrl@fffff200: initialized AT91 pinctrl driver

3、DMA通道生效

at_hdmac ffffe600.dma-controller: Atmel AHB DMA Controller ( cpy set slave ), 8 channels
at_hdmac ffffe800.dma-controller: Atmel AHB DMA Controller ( cpy set slave ), 8 channels

4、USB控制器驱动注册成功

usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb

5、i2C总线驱动模型注册成功

at91_i2c f0014000.i2c: using dma0chan0 (tx) and dma0chan1 (rx) for DMA transfers
at91_i2c f0014000.i2c: AT91 i2c bus driver (hw version: 0x402).
at91_i2c f0018000.i2c: using dma0chan2 (tx) and dma0chan3 (rx) for DMA transfers
at91_i2c f0018000.i2c: AT91 i2c bus driver (hw version: 0x402).

6、蓝牙驱动注册成功

Bluetooth: Core ver 2.22
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO socket layer initialized

7、串口、SPI、CAN驱动注册

ssc f0008000.ssc: Atmel SSC device at 0x(ptrval) (irq 20)
atmel_usart_serial.0.auto: ttyS2 at MMIO 0xf0020000 (irq = 24, base_baud = 4125000) is a ATMEL_SERIAL
atmel_usart_serial.1.auto: ttyS0 at MMIO 0xffffee00 (irq = 34, base_baud = 8250000) is a ATMEL_SERIAL
console [ttyS0] enabled
atmel_spi f0004000.spi: DMA TX channel not available, SPI unable to use DMA
atmel_spi f0004000.spi: Atmel SPI Controller using PIO only
m25p80 spi0.0: unrecognized JEDEC id bytes: 00, 00, 00
atmel_spi f0004000.spi: Atmel SPI Controller version 0x213 at 0xf0004000 (irq 19)
libphy: Fixed MDIO Bus: probed
CAN device driver interface
at91_can f000c000.can: device registered (reg_base=(ptrval), irq=42)

8、GMAC控制器上面的网络芯片没有驱动成功,因为id读取为全0xFF;

libphy: MACB_mii_bus: probed
Generic PHY f0028000.ethernet-ffffffff:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=f0028000.ethernet-ffffffff:01, irq=POLL)
macb f0028000.ethernet eth0: Cadence GEM rev 0x00020119 at 0xf0028000 irq 43 (ee

标签:kernel,at91,irq,driver,内核,linux,i2c,arm,atmel
来源: https://blog.csdn.net/weixin_43771853/article/details/114660682