流程
片内os起来后,从SDCARD加载uboot,然后使用 tftp 从 PC 下载 kernel,然后使用 nfs 挂载 PC 上的文件系统。
搭建 TFTP 和 NFS server
TFTP
sudo apt-get install tftp-hpa tftpd-hpa xinetd
sudo vim /etc/xinetd.d/tftp
service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /data/tftpdir/ -c disable = no per_source = 11 cps = 100 2 flags = IPv4 }
sudo vim /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa TFTP_USERNAME="tftp" TFTP_DIRECTORY="/data/tftpdir" TFTP_ADDRESS="[::]:69" TFTP_OPTIONS="--secure"
sudo vim /etc/xinetd.conf
defaults
{
# Please note that you need a log_type line to be able to use log_on_success ont-size: 12pt; "> # log_type = SYSLOG daemon info
}
includedir /etc/xinetd.d
restart tftp server:
sudo service tftpd-hpa restart
sudo /etc/init.d/xinetd reload
sudo /etc/init.d/xinetd restart
若遇到错误可查看:tail /var/log/syslog
某些情况下要kill进程:
ps -aux | grep tftp
ps -aux | grep xine
sudo kill xxx
NFS
sudo apt-get install nfs-kernel-serverportmap
sudo vim /etc/exports
/data/nfsdir/ *(rw,no_root_squash,sync)
sudo /etc/init.d/nfs-kernel-server restart
测试:sudo mount -t nfs <ip>:/data/nfsdir /mnt
配置bootargs
#define CONFIG_ETHADDR d0:67:e5:18:02:a4 #define CONFIG_NETMASK 255.255.255.0 #define CONFIG_IPADDR 10.0.161.50 #define CONFIG_SERVERIP 10.0.161.83 #define CONFIG_GATEWAYIP 10.0.161.254 #define CONFIG_BOOTARGS "console=ttySAC0,115200 rw root=/dev/nfs nfsroot=10.0.161.83:/data/nfsdir ip=10.0.161.50:10.0.161.83:10.0.161.254:255.255.255.0:chuck:eth0:off" #define CONFIG_BOOTCOMMAND "tftp 0x20008000 uImage.bin;bootm 0x20008000"
配置DM9000寄存器地址
#ifdef CONFIG_DM9000 #define S5PV210_PA_DM9000_A (0x88001000) #define S5PV210_PA_DM9000_F (S5PV210_PA_DM9000_A + 0x300C) static struct resource tq210_dm9000_resources[] = { [0] = { .start = S5PV210_PA_DM9000_A, .end = S5PV210_PA_DM9000_A + SZ_1K*4 - 1, .flags = IORESOURCE_MEM, }, [1] = { .start = S5PV210_PA_DM9000_F, .end = S5PV210_PA_DM9000_F + SZ_1K*4 - 1, .flags = IORESOURCE_MEM, }, [2] = { .start = IRQ_EINT(10), .end = IRQ_EINT(10), .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, }, };