全志V3s之根文件系统移植

1、buildroot下载:

从 buildroot 官网下载buildroot 源码,官网地址为:buildroot官网
全志V3s之根文件系统移植_第1张图片

wget https://buildroot.org/downloads/buildroot-2017.08.tar.gz
tar xvf buildroot-2017.08.tar.gz
cd buildroot-2017.08/
make menuconfig

2、配置rootfs:

a、buildroot的目录结构:

.
├── arch: 					//存放CPU架构相关的配置脚本,如arm/mips/x86,这些CPU相关的配置,在制作工具链时,编译uboot和kernel时很关键.
├── board
├── boot
├── CHANGES
├── Config.in
├── Config.in.legacy
├── configs: 				//放置开发板的一些配置参数. 
├── COPYING
├── DEVELOPERS
├── dl: 					//存放下载的源代码及应用软件的压缩包. 
├── docs: 					//存放相关的参考文档. 
├── fs: 					//放各种文件系统的源代码. 
├── linux: 					//存放着Linux kernel的自动构建脚本. 
├── Makefile
├── Makefile.legacy
├── output: 				//是编译出来的输出文件夹. 
│   ├── build: 				//存放解压后的各种软件包编译完成后的现场.
│   ├── host: 				//存放着制作好的编译工具链,如gcc、arm-linux-gcc等工具.
│   ├── images: 			//存放着编译好的uboot.bin, zImage, rootfs等镜像文件,可烧写到板子里, 让linux系统跑起来.
│   ├── staging
│   └── target: 			//用来制作rootfs文件系统,里面放着Linux系统基本的目录结构,以及编译好的应用库和bin可执行文件. (buildroot根据用户配置把.ko .so .bin文件安装到对应的目录下去,根据用户的配置安装指定位置)
├── package:				//下面放着应用软件的配置文件,每个应用软件的配置文件有Config.in和soft_name.mk。
├── README
├── support
├── system
├── toolchain
└── utils               	//实用工具

b、配置rootfs:

选择目标板架构特性。

Target options  --->
	Target Architecture (ARM (little endian))  --->
	Target Binary Format (ELF)  --->
	Target Architecture Variant (cortex-A7)  ---> 
	Target ABI (EABIhf)  ---> 
	Floating point strategy (VFPv4-D16)  ---> 
	ARM instruction set (ARM)  --->

配置编译选项。

Build options  --->
	   Commands  --->                                               
      ($(CONFIG_DIR)/defconfig) Location to save buildroot config        
      ($(TOPDIR)/dl) Download dir                                       
      ($(BASE_DIR)/host) Host dir                                        
          Mirrors and Download locations  --->                         
      (0) Number of jobs to run simultaneously (0 for auto)             
      [ ] Enable compiler cache                                         
      [ ] build packages with debugging symbols                          
      [*] strip target binaries                                          
      ()    executables that should not be stripped                     
      ()    directories that should be skipped when stripping           
          gcc optimization level (optimize for size)  --->              
          build code with Stack Smashing Protection (None)  --->   

配置交叉工具链,使用buildroot工具链还是外部提供。

Toolchain  --->
	         Toolchain type (External toolchain)  --->                     
          *** Toolchain External Options ***                             
          Toolchain (Linaro ARM 2017.02)  --->                           
          Toolchain origin (Toolchain to be downloaded and installed)   
      [ ] Copy gdb server to the Target                                
          *** Host GDB Options ***                                     
      [ ] Build cross gdb for the host                                  
          *** Toolchain Generic Options ***                             
      [ ] Copy gconv libraries                                          
      [*] Enable MMU support                                           
      ()  Target Optimizations                                          
      ()  Target linker options                                        
      [ ] Register toolchain within Eclipse Buildroot plug-in  

配置系统参数

System configuration  --->
        Root FS skeleton (default target skeleton)  --->             
      (licheepi) System hostname                                      
      (Welcome to Buildroot) System banner                             
          Passwords encoding (md5)  --->                               
          Init system (BusyBox)  --->                                  
          /dev management (Dynamic using devtmpfs only)  --->           
      (system/device_table.txt) Path to the permission tables          
      [ ] support extended attributes in device tables                  
      [ ] Use symlinks to /usr for /bin, /sbin and /lib                 
      [*] Enable root login with password                               
      (123) Root password                                                
          /bin/sh (busybox' default shell)  --->                       
      [*] Run a getty (login prompt) after boot  ---> 

3、通过tftp下载zImage和dts,通过nfs挂载文件系统:

在uboot下设置

setenv  bootcmd "tftp 41000000 zImage;tftp 41800000 sun8i-v3s-licheepi-zero-dock.dtb;bootz 0x41000000 - 0x41800000"
setenv bootargs "root=/dev/nfs rw nfsroot=192.168.1.4:/home/luatao/linux/nfs/rootfs,v3 ip=192.168.1.50:192.168.1.4:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc console=ttyS0,115200"
saveenv

参看:
冷月枫啊、Gnep@97

你可能感兴趣的:(全志V3s,linux,嵌入式硬件)