全志V3s之Kernel移植

2023-12-15 21:32:48

1、安装一些依赖:

sudo apt install gcc flex bison libssl-dev bc kmod

2、下载源码:

Linux的kernel官网:Kernel官网,可以直接去荔枝派的Github仓库下载:荔枝派的Github仓库

git clone -b zero-5.2.y --depth 1 https://github.com/Lichee-Pi/linux.git

加上--depth 1表示拉去的是最近一次更改的版本。

3、修改顶层Makefile文件(方便之后的编译):

ARCH            = arm							//指定芯片架构
CROSS_COMPILE   = arm-linux-gnueabihf-			//指定编译器版本

4、编译源码,生成zImage、dtb

cd linux
make licheepi_zero_defconfig		//生成config文件
make menuconfig   					//一般不用修改,需要时单独改
make -j16
make dtbs 							//编译设备树

编译完成之后,在arch/arm/boot下,生成zImage文件,在arch/arm/boot/dts下生成相应的设备树文件。

5、Kernel适配Ethernet

配置menuconfig:

make ARCH=arm menuconfig

设置以太网支持:

Device Drivers —>
	[ * ] Network device support —>
		[ * ] Ethernet driver support —>
			[ * ] STMicroelectronics devices
				< * > STMicroelectronics Multi-Gigabit Ethernet driver
				[ ] Support for STMMAC Selftests
				< * > STMMAC Platform bus support
				< > Support for snps,dwc-qos-ethernet.txt DT binding.
				< * > Generic driver for DWMAC
				< * > Allwinner GMAC support
				< * > Allwinner sun8i GMAC support

配置NFS文件系统相关网络:

Networking support ->
	Networking options  ->
		TCP/IP networking
		IP: kernel level autoconfiguration
		[ * ] IP: DHCP support
		[ * ] IP: BOOTP support

配置NFS文件系统:

File systems —>
	Network File Systems —>
		< * > NFS client support
		<   > NFS client support for NFS version 2
		[ * ] NFS client support for NFS version 3
		[ * ] NFS client support for the NFSv3 ACL protocol extension
		[ * ] NFS client support for NFS version 4 (EXPERIMENTAL)
		[ * ] NFS client support for NFSv4.1 (DEVELOPER ONLY)
		[ * ] Root file system on NFS

将编译生成的zImage和dtb文件放进boot分区即可启动。

文章来源:https://blog.csdn.net/a_qwq_a/article/details/135018425
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。