用tftp, udpsvd -vE 0 69 tftpd -c /server & 开启tftpd服务器,
然后在318上执行 tftp -pl file ipaddress
tftp -gl main 1.1.1.100即可。
udhcpd -f /app/cfg/udhcpd.conf
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char **argv)
{
if(argc!=2){
printf("error par number\n");
return 0;
}
int fd = open (argv[1], O_RDWR);
if(fd==-1){
printf("open %s error\n",argv[1]);
return 0;
}
fsync (fd);
close (fd);
printf("ok\n");
return 0;
}
然后在318上执行 tftp -pl file ipaddress
tftp -gl main 1.1.1.100即可。
udhcpd -f /app/cfg/udhcpd.conf
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char **argv)
{
if(argc!=2){
printf("error par number\n");
return 0;
}
int fd = open (argv[1], O_RDWR);
if(fd==-1){
printf("open %s error\n",argv[1]);
return 0;
}
fsync (fd);
close (fd);
printf("ok\n");
return 0;
}