OpenWrt Forum Archive

Topic: help with modification of openwrt firmware

The content of this topic has been archived on 25 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
We are doing a project which needs an additional functionality to be implemented in openWRT firmware (squash.fs.bin), so far we have extracted the binary file and viewed teh shell scripting
I presume we need to change the code in the folder rootfs. But we are unsure of how to proceed or what additonal functionality can be implemented. I guess the code has been written in UNIX shellscripts, which looks like this -->

#!/bin/sh

awk -f /usr/lib/common.awk -f - $* <<EOF
BEGIN {
    ipaddr=ip2int(ARGV[1])
    netmask=ip2int(ARGV[2])
    network=and(ipaddr,netmask)
    broadcast=or(network,compl(netmask))
   
    start=or(network,and(ip2int(ARGV[3]),compl(netmask)))
    limit=network+1
    if (start<limit) start=limit
   
    end=start+ARGV[4]
    limit=or(network,compl(netmask))-1
    if (end>limit) end=limit

    print "IP="int2ip(ipaddr)
    print "NETMASK="int2ip(netmask)
    print "BROADCAST="int2ip(broadcast)
    print "NETWORK="int2ip(network)
    print "PREFIX="32-bitcount(compl(netmask))
   
    # range calculations:
    # ipcalc <ip> <netmask> <start> <num>
   
    if (ARGC > 3) {
        print "START="int2ip(start)
        print "END="int2ip(end)
    }
}
EOF

Could you give us some guidance on how to proceed. I did read the code that has been posted on the forum, but I guess that has been written in C language, we are kind of unsure how exactly we can use that on our existing system.

Thanks

its just shell script...what is it you want to do?

The discussion might have continued from here.