Tiny6410 TFTP下载Linux内核 NFS启动文件系统

1. TFTP下载Linux内核

1.1 使用u-boot提供的mkimage工具将zImage制作成uImage

[wf@localhost tools]$ ./mkimage -n 'my_kernel' -A arm -O linux -T kernel -C none -a 0x50008000 -e 0x50008040 -d zImage uImage
Image Name:   my_kernel
Created:      Fri Apr 10 14:01:16 2020
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    3758784 Bytes = 3670.69 kB = 3.58 MB
Load Address: 50008000
Entry Point:  50008040

1.2 配置TFTP服务器

如果系统没有安装tftp服务器,需要先安装:
yum install tftp-server
安装完成后,修改配置文件:/etc/xinetd.d/tftp

[wf@localhost tools]$ vim /etc/xinetd.d/tftp

service tftp
{
    disable = no
    socket_type     = dgram
    protocol        = udp
    wait            = yes
    user            = root
    server          = /usr/sbin/in.tftpd
    server_args     = -s /opt/tftpboot -c
    per_source      = 11
    cps             = 100 2
    flags           = IPv4
}

如图所示,我的tftp服务器的文件夹为/opt/tftpboot
更改tftpboot文件夹的权限为777

[root@localhost opt]# chmod 777 tftpboot
[root@localhost opt]# ll
total 24
drwxr-xr-x  2 root root 4096 Apr  6 23:27 bins
drwxr-xr-x. 5 root root 4096 Dec 10  2018 cross-tools
drwxr-xr-x. 4 root root 4096 Oct  6  2019 dnw
drwxr-xr-x  4 root root 4096 Jan 19 22:34 linux
drwxr-xr-x. 2 root root 4096 Nov 29  2013 minitools
drwxrwxrwx  2 root root 4096 Apr 10 00:20 tftpboot

最后,重新启动xinetd服务,配置就完成了:

[root@localhost opt]# /etc/init.d/xinetd restart
Restarting xinetd (via systemctl):                         [  OK  ]

另外,为了避免使用时出现上传或下载的错误,可以将SELinux关闭:

[root@localhost opt]# setenforce 0
setenforce: SELinux is disabled

修改/etc/selinux/config,将SELINUX一项改为"disabled",这样重启后,就不用再使用刚才的命令关闭SELinux了。

  [root@localhost opt]# vim /etc/selinux/config
  
  1 
  2 # This file controls the state of SELinux on the system.
  3 # SELINUX= can take one of these three values:
  4 #     enforcing - SELinux security policy is enforced.
  5 #     permissive - SELinux prints warnings instead of enforcing.
  6 #     disabled - No SELinux policy is loaded.
  7 SELINUX=disabled
  8 # SELINUXTYPE= can take one of these two values:
  9 #     targeted - Targeted processes are protected,
 10 #     mls - Multi Level Security protection.
 11 SELINUXTYPE=targeted
 12 SELINUX=disable
 13 iptables -F

1.3 TFTP下载uImage

MINI6410 # tftp 50008000 uImage
dm9000 i/o: 0x18000300, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 08:08:10:12:10:27
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.1.100; our IP address is 192.168.1.253
Filename 'uImage'.
Load address: 0x50008000
Loading: ##################################################################################################################################
         
         ##################################################################################################################################
         
         ##################################################################################################################################
         
         ###########################################################################################################################
done
#Bytes transferred = 3758848 (395b00 hex)
MINI6410 # 

2. NFS启动文件系统

2.1 设置NFS服务器端挂载目录

修改/etc/exports,添加/opt/linux/rootfs *(rw,sync,no_root_squash),/opt/linux/rootfs为想挂载的目录

 [root@localhost opt]# vim /etc/exports
 1 /opt/linux/rootfs *(rw,sync,no_root_squash)

重启相关服务service nfs restart,service xinetd restart

[root@localhost opt]# service nfs restart
Restarting nfs (via systemctl):                            [  OK  ]
[root@localhost opt]# service xinetd restart
Restarting xinetd (via systemctl):                         [  OK  ]

2.2 设置启动参数

set bootargs console=ttySAC0,115200n8 proto=tcp ip=192.168.1.253 root=/dev/nfs nfsroot=192.168.1.100:/opt/linux/rootfs rw

MINI6410 # set bootargs console=ttySAC0,115200n8 proto=tcp ip=192.168.1.253 root=/dev/nfs nfsroot=192.168.1.100:/opt/linux/rootfs rw
MINI6410 # saveenv
Saving Environment to MMC...
Writing to MMC(0)... done
MINI6410 # 

2.3 使用bootm命令启动linux内核及文件系统

MINI6410 # bootm 50008000
## Booting kernel from Legacy Image at 50008000 ...
   Image Name:   my_kernel
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3758784 Bytes = 3.6 MiB
   Load Address: 50008000
   Entry Point:  50008040
   Verifying Checksum ... OK
   XIP Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Initializing cgroup subsys cpu
Linux version 2.6.38-FriendlyARM (root@tzs-friendlyarm) (gcc version 4.5.1 (ctng-1.8.1-FA) ) #1 PREEMPT Mon Jan 6 14:14:31 HKT 2014
CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: MINI6410
Memory policy: ECC disabled, Data cache writeback
CPU S3C6410 (id 0x36410101)
S3C24XX Clocks, Copyright 2004 Simtec Electronics

可以看到,Linux内核及文件系统成功启动!

eth0: link down
eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1
IP-Config: Guessing netmask 255.255.255.0
IP-Config: Complete:
     device=eth0, addr=192.168.1.253, mask=255.255.255.0, gw=255.255.255.255,
     host=192.168.1.253, domain=, nis-domain=(none),
     bootserver=255.255.255.255, rootserver=192.168.1.100, rootpath=
Freeing init memory: 1408K
one_wire_status: 4
FAT: utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!
fa_cpu_pfn: module license 'Proprietary' taints kernel.
Disabling lock debugging due to kernel taint
FriendlyARM proprietary driver for mini6410 initialized.
[31/Dec/1999:17:01:49 +0000] boa: server version Boa/0.94.13
[31/Dec/1999:17:01:49 +0000] boa: server built Dec 30 2010 at 11:18:35.
[31/Dec/1999:17:01:49 +0000] boa: starting server pid=956, port 80
                        
asoc: wm9713-hifi <-> samsung-ac97 mapping ok
                        
Try to bring eth0 interface up......NFS root ...Done

Please press Enter to activate this console. 
[root@FriendlyARM /]# ls
bin                 linuxrc             study
data                mnt                 sys
dev                 opt                 tmp
etc                 proc                ttys1
fa-network-service  root                usr
home                sbin                var
lib                 sdcard              www
[root@FriendlyARM /]# 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
编译Linux内核是指将Linux内核源代码转换成可执行的二进制文件的过程。Tiny210是一种开发板,它使用ARM架构的处理器。要在Tiny210上编译Linux内核,需要进行以下步骤: 1. 下载内核源代码:从Linux官方网站或其他可靠的资源下载Linux内核源代码压缩包,解压到本地电脑的工作目录中。 2. 配置交叉编译环境:在编译ARM架构的内核时,需要使用交叉编译工具链,以便在x86架构的计算机上生成适用于ARM架构的二进制文件。可以通过安装ARM交叉编译工具链并配置环境变量来实现。 3. 配置内核:通过进入内核源代码所在目录,运行"make menuconfig"命令打开配置菜单界面,在该界面可以根据需要选择或修改不同的内核选项,如设备驱动、网络协议等。 4. 编译内核:在配置完成后,运行"make"命令编译内核。这个过程可能需要一段时间,具体时间取决于计算机的性能和内核源代码的大小。 5. 安装内核:编译完成后,生成的内核可执行文件位于编译目录中。将这个内核可执行文件复制到Tiny210的存储介质中,如SD卡或闪存。 6. 配置启动选项:在Tiny210上启动时,需要配置启动选项来指定从哪里加载并执行内核。这可以通过修改引导加载程序的配置文件(如U-Boot)来实现。 7. 启动系统:将配置好的启动介质插入Tiny210开发板,重启开发板。开发板将根据配置的启动选项从相应位置加载内核,并启动Linux操作系统。 通过以上步骤,就可以在Tiny210上成功编译并运行Linux内核,让它适应开发板的特定硬件和功能。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值