zoukankan      html  css  js  c++  java
  • 使用 mtd-utils 烧写Arm Linux 系统各个部分

    --- title: 使用 mtd-utils 烧写Arm Linux 系统各个部分 date: 2019-12-26 15:01:57 categories: tags: - arm - linux - iap

    ---

    使用 mtd-utils 烧写Arm Linux 系统各个部分

    背景

    作为一项技术储备,可用于增强系统可维护性。

    要求

    要求主板以mtd作为分区管理,要求使用者清楚分区各部分应该存放什么内容

    注:

    笔者的uboot启动参数:

    bootargs 'mem=1024M console=ttyAMA0,115200 ubi.mtd=3  root=ubi0:ubifs rootflags=sync rootfstype=ubifs rw  mtdparts=hinand:1M(u-boot),4M(kernel),1M(logo.jpg),250M(rootfs.img)'
    

    对应的表格如图所示:

    含义 文件名 下载内存 nand size MTD 分区
    bootloader u-boot 0x41000000 0x0 0x80000 0 1m
    uboot_env CONFIG_ENV_OFFSET - 0x080000 0x40000 -
    内核 kernel 0x42000000 0x100000 0x400000 1 4m
    开机画面 logo.jpg 0x43000000 0x500000 0x80000 2 1m
    视频输出 -vobuf- 0x43800000 - - -
    文件系统 rootfs.img 0x42000000 0x600000 0xfa00000 3 250m

    内核中有关的信息:

    / # cat /proc/mtd
    dev:    size   erasesize  name
    mtd0: 00100000 00020000 "u-boot"
    mtd1: 00400000 00020000 "kernel"
    mtd2: 00100000 00020000 "logo.jpg"
    mtd3: 0fa00000 00020000 "rootfs.img"
    

    烧写

    升级内核脚本:(没有任何限制)

    ##
    #    Copyright By Schips, All Rights Reserved
    #    https://gitee.com/schips/
    #    File Name:  update_kernel.sh
    #    Created  :  Thu 05 Dec 2019 05:18:03 PM CST
    ##
    #!/bin/sh
    MTD=/dev/mtd1
    # $1 as the name of kernel , will be "kernel" as default.
    
    if [ "$1" == "" ];then
            KERNEL=kernel
    else
            KERNEL=$1
    fi
    
    if [ -f ${KERNEL} ];then
             ./flash_erase  ${MTD} 0 32
             ./nandwrite -p ${MTD} ${KERNEL}
    else
            echo "[$KERNEL] not found"
            exit 1
    fi
    

    升级文件系统脚本:

    (建议是将有关的工具在额外额外挂载点中执行以下脚本,例如额外挂载的U盘路径下)

    ##
    #    Copyright By Schips, All Rights Reserved
    #    https://gitee.com/schips/
    #    File Name:  update_fs.sh
    #    Created  :  Thu 05 Dec 2019 05:20:13 PM CST
    ##
    #!/bin/sh
    MTD=/dev/mtd3
    # $1 as the name of img, will be "rootfs.img" as default.
    
    if [ "$1" == "" ];then
            FSIMG=rootfs.img
    else
            FSIMG=$1
    fi
    
    if [ -f ${FSIMG} ];then
             ./flash_erase  ${MTD} 0 2000
             ./nandwrite -p ${MTD} ${FSIMG}
    else
            echo "[$FSIMG] not found"
            exit 1
    fi
    
  • 相关阅读:
    网络爬虫之框架(Scrapy)
    模拟投币试验
    [LeetCode#177]Nth Highest Salary
    Windows Server 2008 各版本功能差异与比较各版本概观--转载
    Win2008 R2下Server Core常用命令小结
    powershell 中用Sqlps管理我台sqlserver 2008r2
    初识 Markdown
    React 入门(3): 严格模式 ReactDOM
    ES6 类的正确定义方式 公有类字段 getter / setter
    Lodash 去抖动 节流
  • 原文地址:https://www.cnblogs.com/schips/p/12984630.html
Copyright © 2011-2022 走看看