zoukankan      html  css  js  c++  java
  • learning uboot support web http function in qca4531 cpu

    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 ", 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){

     

    }

  • 相关阅读:
    LinkedList的使用方法
    规范HTML页面
    HTML总结(一)
    HTML标签学习总结
    java---线程池的使用
    java对excel表格的操作
    java对cookie及Session的操作
    硬盘分区工具gparted使用
    镜像, 转置, 锐化, 灰度,旋转
    ffmpeg解码
  • 原文地址:https://www.cnblogs.com/lianghong881018/p/10245654.html
Copyright © 2011-2022 走看看