开发板不同启动方式

1:以太网启动

uboot bootargs bootcmd bootm启动参数的意义:(http://blog.csdn.net/cgzhello1/article/details/7852033)
环境参数如下:


setenv bootargs ‘root=/dev/nfs rw nfsroot=192.168.1.4:/exports/rfs ip=192.168.1.200 console=ttySC0 video=HDMI-A-1:1280x800 video=HDMI-A-2:1280x960’
setenv bootcmd ‘tftp 0x48080000 Image;tftp 0x48000000 r8a7795-salvator-xs.dtb;booti 0x48080000 - 0x48000000’
setenv bootcmd ‘run nfscmd’


2: EMMC启动

环境参数如下:


setenv bootargs ‘root=/dev/mmcblk0p2 console=ttySC0 video=HDMI-A-1:1280x800 video=HDMI-A-2:1280x960’
setenv bootcmd ‘ext4load mmc 2:1 0x48080000 Image;ext4load mmc 2:1 0x48000000 r8a7795-salvator-xs.dtb;booti 0x48080000 - 0x48000000’


2.1格式化工具为 e2fsprogs 地址 https://sourceforge.net/projects/e2fsprogs/?source=typ_redirect

tar -zxvf /mnt/hgfs/linuxbak/e2fsprogs-1.43.7.tar.gz

sourc 交叉工具编译脚本

生成 makefile ./configure --host=aarch64-poky-linux --prefix=/exports/rfs/usr

make install

2.2 EMMC分区:
EMMC的相关指令:https://blog.csdn.net/simonjay2007/article/details/43198353
首先通过NFS挂载进入开发板系统,然后分区:
首先需要使用fdisk 进行emmc 分区:

fdisk /dev/mmcblk0
( 分区的大小 依据 自己的 emmc 大小 进行分区 )
Command (m for help): m —输入m获取fdisk工具的使用说明
Command (m for help): n —输入n创建新的分区
Select (default p): p —输入p创建primary分区
Partition number (1-4, default 1): 1 —输入分区号
First sector (2048-31116287, default 2048): —输入该分区的起始地址,回车使用默认值
Last sector, +sectors or +size{K,M,G} (2048-31116287, default 31116287): +2G —输入该分区的结束地址
Command (m for help): n —创建第二个分区
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (1-4, default 2): 2
First sector (10000001-31116287, default 10000001):
Using default value 10000001
Last sector, +sectors or +size{K,M,G} (10000001-31116287, default 31116287): +1G

Command (m for help): p —打印mmcblk0的分区情况

Command (m for help): w —保存分区设置并退出
2.3 给分区格式化 文件系统
mkfs.ext4 /dev/mmcblk0p1

mkfs.ext4 /dev/mmcblk0p2 给 分区 1 分区 2 格式化 ext4 系统

mount 分区

mkdir /mnt/emmc1

mkdir /mnt/emmc2

mount /dev/mmcblk0p1 /mnt/emmc1

mount /dev/mmcblk0p2 /mnt/emmc2
(每次通过NFS启动时都需要运行mount命令挂载emmc1文件夹和mmcblk0p1分区,不然无法看见文件夹里面的内容)

3: 从ramdisk根文件系统启动

跳转到要制作的rootfs的上一级目录
#genext2fs -b 8192 -d rootfs ramdisk
#gzip -9 -f ramdisk
将该ramdisk以最优方式压缩为ramdisk.gz

-b是指制作的ramdisk大小为8MB(8192/1024=8, 8MB指的是rfs文件夹的大小) ,可改
-d是指要制作成ramdisk的根文件系统目录(rootfs指的是根文件所在的文件夹名)
最后的ramdisk是制作出来的ramdisk的名字,当然可以改名了。
genext2fs -b 1024 -d rootfs ramdisk.image
报错误了: genext2fs: couldn’t allocate a block (no free space)
经过多次查找发现这个是空间分配不对
只要改成
genext2fs -b 102400 -d rootfs ramdisk.image
这样就通过了
貌似这个是空间大小太小了,这种先使用大的后面使用小的

uboot里面运行

tftp 0x500000000 ramdisk.gz 
mmc dev 1 
mmc write 0x500000000 0x16 0xcbce 
0x500000000是指在RAM中从该地址读取数据放到EMMC中,0x16为起始地址,大小为0xcbce(0xcbce转化为十进制,
再乘以512,即为ramdisk.gz的大小,单位是kb)
mmc write 0x48080000 0xcbe3 51df(image大小)
mmc write 0x48000000 fd1b(0xcbe3+51df) 7e (dtb大小)

对于内核 在.config里面加上

CONFIG_BLK_DEV_RAM=y 
CONFIG_BLK_DEV_RAM_COUNT=16

CONFIG_BLK_DEV_RAM_SIZE=819600重新编译 
配置内核支持的ramdisk的大小(KB)

设置启动参数:

setenv bootargs ‘initrd=0x500000000,0x48e99A6 root=/dev/ram rw console=ttySC0 video=HDMI-A-1:1280x800 video=HDMI-A-2:1280x960’
setenv bootcmd ‘run loadramdisk; run dlkernel; booti 0x48080000 - 0x48000000’
dlkernel=mmc read 0x48080000 24764 648e; mmc read 0x48000000 2abf3 85

猜你喜欢

转载自blog.csdn.net/baidu_38410526/article/details/80053446
今日推荐