搭建linux操作系统_开发阶段/产品阶段部署

一,开发阶段

1,准备镜像文件

TF-A镜像文件: tf-a-stm32mp157a-fsmp1a-trusted.stm32 ===> 烧写设备中:(TF / EMMC)

uboot镜像文件: u-boot-stm32mp157a-fsmp1a-trusted.stm32 ===> 烧写设备中:(TF / EMMC)

内核设备树/镜像文件: stm32mp157a-fsmp1a.dtb / uImage ===> 通过tftp服务器下载

根文件系统文件: rootfs文件 ===> 通过nfs服务器进行挂载

2,烧写镜像文件到EMMC中

1.在串口工具,将开发板中EMMC设备挂载到ubuntu中
    ums 0 mmc 1 
2.进入uboot源码目录下,将uboot和TF-A镜像文件,烧写到EMMC设备中
    ./sdtools.sh /dev/sdb

3,部署linux操作系统

1,准备下载文件

1.将stm32mp157a-fsmp1a.dtb和uImage镜像文件,拷贝到ubuntu中~/tftpboot目录下
2.在串口工具,将uImage镜像文件下载内存中        

     tftp 0xc2000000 uImage
       
3.在串口工具,将设备树镜像文件下载内存中
      tftp 0xc4000000 stm32mp157a-fsmp1a.dtb

2,设置bootargs参数

setenv bootargs
     root=/dev/nfs nfsroot=192.168.1.250:/home/ubuntu/nfs/rootfs,tcp,v4 rw console=ttySTM0,115200 init=/linuxrc ip=192.168.1.100
    解释:
        root=/dev/nfs:使用nfs服务器进行挂载
        nfsroot=192.168.1.250:/home/linux/nfs/rootfs:挂载的ip地址,以及路径一定是自己ubuntu的路径!!!
        tcp,v4 :tcp型号
        rw :读写权限
        console=ttySTM0,115200 :默认使用串口0,波特率为115200
        init=/linuxrc:系统启动成功之后,默认启动linuxrc进程
        ip=192.168.1.100 :板子ip地址
saveenv

3,启动

bootm 0xc2000000 - 0xc4000000

4,设置bootcmd命令(自启动)

setenv bootcmd  tftp 0xc2000000 uImage\;tftp 0xc4000000 stm32mp157a-fsmp1a.dtb\; bootm 0xc2000000 - 0xc4000000
setenv ethaddr 12:56:78:ff:ff:4e
saveenv

搭建linux操作系统_开发阶段/产品阶段部署_第1张图片

二,产品阶段

1,准备镜像文件

TF-A镜像文件: tf-a-stm32mp157a-fsmp1a-trusted.stm32 ===> 烧写设备中:(EMMC)

uboot镜像文件: u-boot-stm32mp157a-fsmp1a-trusted.stm32 ===> 烧写设备中:(EMMC)

内核设备树/镜像文件: stm32mp157a-fsmp1a.dtb / uImage ===> 烧写设备中:(EMMC)

根文件系统镜像文件: ramdisk.img文件 ===> 烧写设备中:(EMMC)

2,产品部署

1、准备需要下载的镜像文件存放到~/tftpboot目录(uImage/设备树/ramdisk.img)

2、将~/tftpboot目录文件下载到开发板内存中(使用tftp命令)

3、使用mmc write命令,将内存中数据写到EMMC设备中

1.在ubuntu中执行,将~/ramdisk.img镜像文件拷贝到~/tftpboot目录下
2.将uImage镜像文件下载到内存中
    ftp 0xc2000000 uImage  ========> 将uImage镜像文件下载到内存中
     
3.将内存中的uImage镜像文件,通过mmc write命令写到EMMC设备中
    mmc write 0xc2000000 0x2000 0x4000
4.将stm32mp157a-fsmp1a.dtb设备树文件下载到内存中    
    tftp 0xc2000000 stm32mp157a-fsmp1a.dtb
5.将内存中的stm32mp157a-fsmp1a.dtb设备树文件,通过mmc write命令写到EMMC设备中  
    mmc write 0xc2000000 0x10000 0x200

6. 将ramdisk.img镜像文件下载到内存中        
    tftp 0xc2000000 ramdisk.img
7. 将内存中的ramdisk.img镜像文件,通过mmc write命令写到EMMC设备中     
    mmc write 0xc2000000 0x21500 0x21500

3,设置bootargs参数

setenv bootargs root=/dev/ram console=ttySTM0,115200 init=/linuxrc initrd=0xc5000040,0x1000000 rw rootstype=ext4
  saveenv

4,产品启动

将EMMC中数据,读到内存中

mmc dev 1                             =====> 选择EMMC设备
mmc read 0xc2000000 0x2000 0x4000     =====> 将EMMC中uImage镜像文件,读到内存中  
mmc read 0xc4000000 0x10000 0x200     =====> 将EMMC中设备树镜像文件,读到内存中
mmc read 0xc5000000 0x21500 0x21500   =====> 将EMMC中ramdisk.img镜像文件,读到内存中
bootm 0xc2000000       0xc5000000          0xc4000000  
      内核镜像地址      根文件系统镜像地址   内核设备树文件地址

5,设置bootcmd参数(自启动)

setenv bootcmd "mmc dev 1;mmc read 0xc2000000 0x2000 0x4000;mmc read 0xc4000000 0x10000 0x200; mmc read 0xc5000000 0x21500 0x21500;bootm 0xc2000000 0xc5000000 0xc4000000"
saveenv

搭建linux操作系统_开发阶段/产品阶段部署_第2张图片

搭建linux操作系统_开发阶段/产品阶段部署_第3张图片

三,区别

1,写入的设备不同

2,bootcmd和bootargs设置的参数不同

3,根文件系统不同,开发阶段:根文件系统文件,产品阶段:根文件系统文件镜像文件

你可能感兴趣的:(系统移植,linux,运维,服务器,ubuntu,arm开发)