烧写linux系统到开发板中,【嵌入式开发】向开发板中烧写Linux系统

本文详细介绍了如何在三星S3C6410开发板上烧写Linux系统的过程,包括烧写BootLoader(u-boot)、擦除nand flash、烧写内核和文件系统等步骤。首先,烧写u-boot到sd卡和nand flash,然后设置网络环境,包括网络、tftp和nfs服务。最后,计算SD卡烧写u-boot的位置,并完成烧写操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

作者 : 万境绝尘 终于拿到板子了, 嵌入式开发正式开启. 板子型号 : 三星 S3C6410 基于ARM11, 指令集基于arm6指令集; 为毛不是 Cortext A9的板子; 烧写内容 : BootLoader , Linux Kernel , File System ; 烧写流程 : -- sd卡烧写u-boot并启动 : 首先将 u-boot

作者 : 万境绝尘

终于拿到板子了, 嵌入式开发正式开启.

板子型号 : 三星 S3C6410 基于ARM11, 指令集基于arm6指令集;

为毛不是 Cortext A9的板子;

烧写内容 : BootLoader,Linux Kernel, File System;

烧写流程 :

-- sd卡烧写u-boot并启动 : 首先将 u-boot 烧写到 sd 卡中, 使用 sd 卡的bootloader启动;

-- 擦出nand flash : 之后将开发板的闪存 nand flassh 擦除干净;

-- nand flash 烧写 u-boot : 然后将 u-boot 烧写到 nand flash 中;

-- 烧写内核 : 向nand flash 中烧写内核;

-- 烧写文件系统 : 将文件系统烧写到nand flash 中;

1. BootLoader介绍

嵌入式开发板软件层次 : 从底层到上层 引导程序 -> Linux内核 -> 文件系统 -> 应用程序

-- 引导加载程序 : 分为两部分 硬件中的固化boot代码 和 BootLoader代码, 其中固化的boot代码可有可无, BootLoader是烧写上去的;

-- Linux内核 : 嵌入式开发板定制的内核 和 其启动参数;

-- 文件系统 : 即Linux中的文件系统;

-- 应用程序 : 即用户执行的应用程序, 应用程序 和 内核之间可能包含嵌入式的图形界面;

引导加载程序介绍 : 引导加载程序是系统上电之后执行的第一段程序;

PC机上的引导加载程序 :

-- 组成结构 : BIOS (固件程序) 和 BootLoader(GRUB等程序);

-- 执行过程 : BIOS执行硬件检测 和 资源分配, 之后将BootLoader读取到内存中, 开始执行BootLoader内容;

-- 执行作用 : 将内核读取到内存中, 跳转到内核的入口运行, 正式执行操作系统程序;

嵌入式BootLoader : BootLoader与硬件的依赖性很强, 每一种嵌入式设备都有其对应的BootLoader引导程序, 在这里 S3C6410 板子使用的BootLoader 是 U-BOOT;

BootLoader操作模式 : 将BootLoader烧写到 nand flash 中之后, 第一次启动是靠交互模式启动的, 之后就靠子启动模式启动;

-- 自启动模式 : 系统上电之后自动将 BootLoader 加载到内存, 之后自动开启系统, 整个过程全自动, 用户不介入;

-- 交互模式 : BootLoader 通过串口 或者 网络从服务器上下载内核到内存中, 可以将内核写到磁盘, 或者直接进入系统, 同时可以从串口中接收用户命令;

BootLoader启动过程 : 分为两个阶段;

-- 第一阶段 : 初始化基本硬件, 将BootLoader加载到内存中, 设置堆栈指针, 清空BSS段;

-- 第二阶段 : 初始化本阶段用的硬件, 读取环境变量, 启动BootLoader(两种启动模式);

2. 配置网络

烧写过程需要配置 网络, tftp, nfs 三项, 配置完之后重启服务器;

(1) 网络设置

需要设置网络ip地址 和 关闭防火墙; 如果是 redhat 系统, 还需要关闭SELinux;

设置ip地址命令 : ifcofig eth0 192.168.1.27 命令;

关闭防火墙 : sudo ufw disable 命令;

重启网络服务 :  sudo /etc/init.d/networking restart 命令;

octopus@octopus:~$ sudo ifconfig eth0 192.168.1.27

octopus@octopus:~$ sudo ufw disable

防火墙在系统启动时自动禁用

octopus@octopus:~$ sudo /etc/init.d/networking restart

* Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces

* Reconfiguring network interfaces...

(2) 配置tftp

安装tftp软件 :

-- 安装tftp服务器 : sudo apt-get install tftpd 命令;

-- 安装tftp客户端 : sudo apt-get install tftp 命令;

-- 安装 xinetd : sudo apt-get install xinetd 命令;

配置 tftp : 建立 /etc/xinetd.d/tftp 文件, 使用 sudo vim/etc/xinetd.d/tftp 命令,向文件中写入以下内容 :

service tftp

{

socket_type = dgram

wait = yes

disable = no

user = root

protocol = udp

server = /usr/sbin/in.tftpd

server_args = -s /tftpboot

#log_on_success += PID HOST DURATION

#log_on_failure += HOST

per_source = 11

cps =100 2

flags =IPv4

}

,

创建共享目录 : 查看 根目录下 有没有 tftpboot 目录, 如果没有的话就创建 /tftpboot 目录;

-- 创建共享目录 : sudo mkdir /tftpboot 命令创建;

-- 修改权限 : sudo chmod -R 777 /tftpboot , 加上 -R 表示 递归将其子目录子文件也进行权限修改;

修改 /etc/xinetd.d 配置文件 : 保证配置文件与下面一致即可;

# Simple configuration file for xinetd

#

# Some defaults, and include /etc/xinetd.d/

defaults

{

# Please note that you need a log_type line to be able to use log_on_success

# and log_on_failure. The default is the following :

# log_type = SYSLOG daemon info

}

includedir /etc/xinetd.d

修改 /etc/default/tftpd-hpa 配置文件 :

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"

TFTP_DIRECTORY="/tftpboot"

TFTP_ADDRESS="0.0.0.0:69"

TFTP_OPTIONS="-l -c -s"

重启tftp服务 : 注意按照次序将下面三个命令依次执行 ;

-- 执行service tftpd-hpa restart命令 :

octopus@octopus:~$ service tftpd-hpa restart

stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.83" (uid=1000 pid=5737 comm="stop tftpd-hpa ") interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")

start: Rejected send message, 1 matched rules; type="method_call", sender=":1.84" (uid=1000 pid=5734 comm="start tftpd-hpa ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")-- 执行sudo /etc/init.d/xinetd reload命令 :

octopus@octopus:~$ sudo /etc/init.d/xinetd reload

[sudo] password for octopus:

Rather than invoking init scripts through /etc/init.d, use the service(8)

utility, e.g. service xinetd reload

Since the script you are attempting to invoke has been converted to an

Upstart job, you may also use the reload(8) utility, e.g. reload xinetd-- 执行sudo /etc/init.d/xinetd restart命令 :

octopus@octopus:~$ sudo /etc/init.d/xinetd restart

Rather than invoking init scripts through /etc/init.d, use the service(8)

utility, e.g. service xinetd restart

Since the script you are attempting to invoke has been converted to an

Upstart job, you may also use the stop(8) and then start(8) utilities,

e.g. stop xinetd ; start xinetd. The restart(8) utility is also available.

xinetd stop/waiting

xinetd start/running, process 5769

测试 tftp 服务 :

-- 进入tftp : 使用 tftp localhost , 进入本地的tftp服务器;

-- 下载其中的文件 : 使用 get uboot.bin 下载其中的 uboot 文件到本地目录, 如果文件不存在会提示 Error code 1: File not found 错误;

octopus@octopus:~$ tftp localhost

tftp> get aaa

Error code 1: File not found

tftp> get uboot.bin

tftp> quit

octopus@octopus:~$ ls

aaa develop icmp ndk Source Insight

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值