reference :https://forum.openwrt.org/viewtopic.php?id=43237

reference :http://blog.chinaunix.net/uid-22547469-id-5048943.html

cp  httpd     cus531-16m/  -a

cp  net/httpd.c   cus531-16m/

cp  net/httpd.h   cus531-16m/

修改net.c

#ifdef CONFIG_STATUS_LED

#include <status_led.h>

#include <miiphy.h>

#endif

//add by panzidong

#include "httpd.h"

#include "../httpd/uipopt.h"

#include "../httpd/uip.h"

#include "../httpd/uip_arp.h"

#if (CONFIG_COMMANDS & CFG_CMD_SNTP)

#include "sntp.h"

#endif

#if (CONFIG_COMMANDS & CFG_CMD_NET)

#if 0

#define ET_DEBUG

#endif

// add by panzidong

unsigned char *webfailsafe_data_pointer = NULL;

int     webfailsafe_is_running = 0;

int     webfailsafe_ready_for_upgrade = 0;

int     webfailsafe_upgrade_type = WEBFAILSAFE_UPGRADE_TYPE_FIRMWARE;

void NetReceiveHttpd(volatile uchar * inpkt, int len);

extern int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);

void

NetReceive(volatile uchar * inpkt, int len)

{

// add by panzidong

if(webfailsafe_is_running){

NetReceiveHttpd(inpkt, len);

return;

}

NetRxPkt = inpkt;

NetRxPktLen = len;

et = (Ethernet_t *)inpkt;

从蓝本的net/net.c中将后面三个函数粘贴到此。以#define BUF ((struct uip_eth_hdr *)&uip_buf[0])开头的那段代码。

增加httpd命令:

./include/net.h

/* Initialize the network adapter */

extern int      NetLoop(proto_t);

//add by panzidong

extern int      NetLoopHttpd(void);

extern void     NetSendHttpd(void);

static int netboot_common (proto_t, cmd_tbl_t *, int , char *[]);

// add by panzidong

int do_httpd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){

return NetLoopHttpd();

}

U_BOOT_CMD(httpd, 1, 1, do_httpd, "start www server for firmware recovery\n", NULL);

顶层的Makefiel

board953x_config                :       unconfig

@ >include/config.h

@echo '#define CONFIG_ATHEROS           1'      >include/config.h

@echo '#define CONFIG_MACH_QCA953x      1'      >>include/config.h

@echo '#define CFG_INIT_STACK_IN_SRAM   1'      >>include/config.h

@echo '#define CONFIG_'`echo $(CFG_BOARD_TYPE) | tr [a-z] [A-Z] | sed s/-/_/g`' 1' >>include/config.h

@echo '#define __CONFIG_BOARD_NAME $(CFG_BOARD_TYPE)' >>include/config.h

@echo '#define CONFIG_BOARD_NAME "$(CFG_BOARD_TYPE)"' >>include/config.h

@echo "#define BUILD_VERSION "\"$(BUILDVERSION)\" >>include/config.h

##

## add by panzidong

##

@echo "#define CONFIG_DELAY_TO_AUTORUN_HTTPD        3" >> include/config.h

@echo "#define CONFIG_DELAY_TO_AUTORUN_CONSOLE      5" >> include/config.h

@echo "#define CONFIG_DELAY_TO_AUTORUN_NETCONSOLE   7" >> include/config.h

@echo "#define CONFIG_MAX_BUTTON_PRESSING          10" >> include/config.h

Common/main.c

#ifdef CONFIG_SILENT_CONSOLE

DECLARE_GLOBAL_DATA_PTR;

#endif

// add by panzidong

extern int reset_button_status(void);

extern void all_led_on(void);

extern void all_led_off(void);

extern int NetLoopHttpd(void);

extern void udelay(unsigned long usec);

#define milisecdelay(_x)                        udelay((_x) * 1000)

Board/Atheros/board953x.c

// add by panzidong

int reset_button_status(void){

return 0;

}

void all_led_on(void){

}

void all_led_off(void){

}

learning uboot support web http function in qca4531 cpu的更多相关文章

  1. learning uboot how to enable watchdog in qca4531 cpu

    find cpu datasheet , watchdog relate registers: 0x18060008 watchdong timer control 0x1806000c watchd ...

  2. learning uboot distro design in am335x-evm board

    reference: uboot_dir/doc/README.distro Linux distributions are faced with supporting a variety of bo ...

  3. Orthogonal Least Squares Learning Algorithm for Radial Basis Function Networks

    Orthogonal Least Squares Learning Algorithm for Radial Basis Function Networks S. Chen, C. F. N. Cow ...

  4. learning uboot auto switch to stanbdy system in qca4531 cpu

    design: when uboot load kerne failed,we can switch to stanbdy system; how to realize: when boot fail ...

  5. learning uboot how to set ddr parameter in qca4531 cpu

    DDR工作频率  在600MHZ. include/configs/board953x.h #define CFG_PLL_FREQ            CFG_PLL_650_600_200 #d ...

  6. learning uboot enable protect console

    reference :https://github.com/lentinj/u-boot/blob/master/doc/README.autoboot how to enable protect s ...

  7. learning uboot test command

    uboot commad test test - minimal test like /bin/sh so we can use test command to some judge for exam ...

  8. learning uboot switch to standby system using button

    pseudocode: If(reset_button was pressed ) { Change  uboot env bootslot^1 }

  9. learning uboot source command

    reference: http://www.denx.de/wiki/DULG/UBootCmdGroupExec => help source source - run script from ...

随机推荐

  1. TensorFlow 之 手写数字识别MNIST

    官方文档: MNIST For ML Beginners - https://www.tensorflow.org/get_started/mnist/beginners Deep MNIST for ...

  2. 自己写操作系统---bootsector篇

    其实博主本来想在寒假自己写一个OSkernal的,高高兴兴的影印了本<一个操作系统的实现>. 然后又去图书馆借来<30天自制操作系统>和<X86/X64体系探索编程> ...

  3. BZOJ2818: Gcd 欧拉函数

    Description 给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对. Input 一个整数N Output 如题 Sample Input 4 Sam ...

  4. 获取String类型汉字乱码,如何进行编码

    本文为博主原创,未经允许不得转载: 在解析properties文件中的汉字时,在java代码中解析得到的是一个乱码字符,形如图下: 导致乱码原因:由于在jdk中,默认为gbk编码方式进行编码盒接收的, ...

  5. Pytorch版本yolov3源码阅读

    目录 Pytorch版本yolov3源码阅读 1. 阅读test.py 1.1 参数解读 1.2 data文件解析 1.3 cfg文件解析 1.4 根据cfg文件创建模块 1.5 YOLOLayer ...

  6. The way to Go(3): 安装Go环境

    Reference: Github: Go Github: The way to Go 在mac上安装Go语言初体验 安装Go环境 Go 语言开发团队开发了适用于以下操作系统的编译器: Linux F ...

  7. 如何新建一个datatable,并往表里赋值

    顺序是新建对象-->新建列-->新建行,示例代码如下: DataTable dt=new DataTable(); //新建对象 dt.Columns.Add("姓名" ...

  8. poj 2762 Going from u to v or from v to u? trajan+拓扑

    Going from u to v or from v to u?   Description In order to make their sons brave, Jiajia and Wind t ...

  9. nginx 跨域解决

    server { listen 8811 default_server; root /opt/bp; # Make site accessible from http://localhost/ ser ...

  10. python 元组元素反转

    #create a tuple x = ("w3resource") # Reversed the tuple y = reversed(x) print(tuple(y)) #c ...