OpenWrt Forum Archive

Topic: question about firmware

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

hi
i do have a question but i don't know how to put it

so for starts i have a programing background
vb , C# , php , java

not as a job but as a hobby

and i would like to know more about routers

i have searched everywhere until i found this site so i hope any one of
you tell how to start

i have a zte router to try on
and i would like know how to edit the firmware
for all i know its a pin file i upload it to the router and it's done

but that is not what i ask for i want to know how to edit the firmware
how to make a firmware ,what language used to program one

to make it sample
i just want to know how edit or go into router files
for small example if i want to edit background or simple thing like the logo of zte or the font
just how to get into the router files
where is it stored
that all i am asking and then i will search to know the rest of it
i hope you get what i mean

and thank you very much

Not completely clear what you ask. There is a way to build your own version of OpenWRT for a supported device. The wiki is somewhat confusing, but the following works for me:

hvdkamer@openwrt:~$ git clone https://git.openwrt.org/15.05/openwrt.git
hvdkamer@openwrt:~$ cd openwrt/
hvdkamer@openwrt:~/openwrt$ ./scripts/feeds update -a
hvdkamer@openwrt:~/openwrt$ ./scripts/feeds install -a
hvdkamer@openwrt:~/openwrt$ make defconfig
hvdkamer@openwrt:~/openwrt$ make menuconfig
  => select your router
hvdkamer@openwrt:~/openwrt$ make

If successful you can find the images in bin/<your cpu>/ directory. This procedure uses the source code and that you can edit. Is that answering your question?

hvdkamer wrote:

Is that answering your question?

Ik denk 't niet.

The OPer describes 'editing' the web interface of the device, that in all probability, in ZTE-land, is generated via Lua scripting.

N.B. - no mention of CPE routers on the ZTE website, only combo-modems

@harvey84 - have you learned how to gain access to the device's operating system, e.g., telnet or ssh?

Max Hopper wrote:
hvdkamer wrote:

Is that answering your question?

Ik denk 't niet.

Grijns...

But as said, the question was not very clear to me. And on this forum you usualy want OpenWrt as firmware smile.

@harvey84

You are at the beginning of a long/hard/exhausting journey.
The developers either on OpenWRT/Linux or other projects are busy doing there job
-> writing code, fixing bugs
and yell at buggy hardware.

More information you can find is on
https://wiki.openwrt.org/doc/playground/developer

first of all thank you all for your help
@hvdkamer

Is that answering your question

it sort of
the thing is i didn't deal with linux much just few time using ubuntu
so i don't actually understand that code but what i get that i have to know linux to deal with routers

@Max Hopper

@harvey84 - have you learned how to gain access to the device's operating system, e.g., telnet or ssh?

no and that very much might be my question how to gain access to the routers operating system

@elektroman
thank you for the link



what i trying to ask here take that as an example
this forum running punbb script

if you want to edit it or create mods or deal with it
you going to need to know php ,html ,css , java and mysql

and also you need editor like notebad or vasual stdio for vb or c#, a compiler

and a server to run all of this on it

you see that is what i need to know what programing language should i know to deal with routers?
is there a compiler  or a tool like notebad or vasual stdio?

and the most important

how to gain access to the routers operating system ?
where is the files of this system where is it stored ?
how to get into it ?


all i know about routers is to go into 192.168.1.1
and change wireless password or whatever i want do in it

you see it actually like this forum we are in it we all deal with it , write topics ,posts doing what ever we do in it
but to me i know exactly what to do if i want change anything like i can change the place of users information on the left side to appear in any place i want right or on top or at the bottom of the topic
i know how to get into this files and edit it i am not talking about the control panel i mean the script files

i hope you get what mean this time
and thank you very much for your help

harvey84 wrote:

what i trying to ask here take that as an example
this forum running punbb script

if you want to edit it or create mods or deal with it
you going to need to know php ,html ,css , java and mysql

and also you need editor like notebad or vasual stdio for vb or c#, a compiler

and a server to run all of this on it

you see that is what i need to know what programing language should i know to deal with routers?
is there a compiler  or a tool like notebad or vasual stdio?

and the most important

how to gain access to the routers operating system ?
where is the files of this system where is it stored ?
how to get into it ?

As I said a long journey

For the kernel read here
https://kernelnewbies.org/
The main (mostly) conversation is done on lkml or other lists
https://lkml.org/
https://en.wikipedia.org/wiki/Linux_kernel_mailing_list
I advise you not to ask on any mailing list regarding linux kernel,
before you do understand most of the "hidden" schematics.
I the old (tm) days, normally a user would read about 3-6 months on the list.

kernelnewbies is a good place for beginner

For compiler editor and so on
you need a toolchain, normally embedded into the OpenWRT source tree.
This is why a complete build (from scratch) for your target (Router) takes about 2-3 hours.

Editor take your pick: vi, emacs, vim, gvim, geany, joe, nano
The no best tool, read here
https://en.wikipedia.org/wiki/Editor_war
FWIW: users of vi, emacs are mostly linux/kernel developers.

Mail is mostly done with mutt, alpine. Read here why
https://git.kernel.org/cgit/linux/kerne … lients.txt

You need basic/enhanced linux knowledge and a running linux systems.
On Windows or MacOS you are running in some issues which are hard to debug.
And the stupid line ending thing.

Programming language

The big problem on routers are space on flash.
LUA, Luci, UCI  are for the web interface/configuration

MySQL, PHP and others are to big, they will explode your flash.

C is done for the kernel
bash/shell for other stuff

And of course you need some kind of source control
https://en.wikipedia.org/wiki/Git_(software)
https://git-scm.com/

As experienced (kernel) hacker I'm (hobbyist) I expect about 6-12 months
to get the right "mind set" to understand things.

For only changing/adopting hardware you need less time.

For a beginner in this area, the best advice is probably to not try to modify the firmware on an unsupported device, but to start with a well-supported router which suits your requirements and go from there.

What do you wish to accomplish?

@elektroman - did anyone mention procedural thread-safe code, mutexes or networking?

lizby wrote:

For a beginner in this area, the best advice is probably to not try to modify the firmware on an unsupported device, but to start with a well-supported router which suits your requirements and go from there.

And with that my answer wasn't so wrong smile.

@harvey84:
I agree with lizby that you will discover yourself the answers to your questions by modyfing OpenWrt firmware. Firmware on most commercial routers is partly closed, not documented and very difficult to understand. A router with OpenWrt is as the name suggests open. My commands showed how to build a default firmware from the source code. And that you can study, modify etc, and then compile again. That image can easily flashed to your router to see if it works or why not.

My suggestion for a router which is fully supported by OpenWrt -- this is also the firmware they are shipped with, although the webinterface looks different -- is one from GL.iNet. I started with the older 6416 but today I would have bought an GL-AR150 which is $25-$27. Not expensive for a great learning experience...

BTW I'm not affiliated with GL.iNet in any way. If you want it a little bit cheaper you can shop for comaptible routers in China (Aliexpress, DealExtreme, etc.). But if the saving is worth it?

@elektroman
at first thank you and i do appreciate your help

and it really look like a very long journey

you just give me a lot of things to know and to search for

but most of those thing i don't know anything about them like LUA, Luci, UCI

so could you help me put an order to it
at first i have to run linux systems (i get that on Windows going to be hard?)
second the main language is c

so is there some method you advice to start with
for starts which linux distribution is better to work on Ubuntu, Debian, Red Hat, other?

and if there is a cd or pdf books to learn linux ?
i have dealt with ubuntu a few times not much

and you have cleared a lot things to my and thank you very much

still just one question i don't get
there is no way to edit an existing firmware
like zte or d-link or any routers i have to flash
a new os like OpenWRT(open source) in order to edit it at any time or customise it right?

you see i thought it like this forum script
i can go to the files and edit it is that possible with routers?

and again thank for your patience



@lizby
first thank you for the advice
i am trying to collect where to start

What do you wish to accomplish?

knowledge





@hvdkamer
who said you're wrong

i just didn't know i thought i could edit that router or use it to learn on it you know
it an old router i have i thought i use it as personal server if know what i mean to try on it

and thank you for your help




@Max Hopper
i don't get much of what you say and around here we use english
and it seem to me like you have a problem
first hvdkamer now elektroman
every one try to help , you try to make an argument about it here and actually in every fucken topic you ever been in
but you didn't actually present any help even the one question you asked i answered you and you didn't even write a word about it
you just going at anything they say
so stop criticizing and correcting people
you can Combate ignorance somewhere else there no one here
the only ignorant here is the one who think he is the smartest one and criticizing others
no one like a smug son of bitch
get the hell out of my topic before i lose my temper and i think you smart enough to know what that mean



and sorry about the tone guys but he is really annoying
i ignored him once but i found him in another topics also making problems
he is really annoying
could any moderator ban this idiot please

(Last edited by harvey84 on 16 Aug 2016, 11:29)

harvey84 wrote:

at first i have to run linux systems (i get that on Windows going to be hard?)

You could run a Linux machine with VMware or VirtualBox in Windows. I use a minimal -- no graphical interface, only a SSH server -- Debian install in VirtualBox which is running in Ubuntu or Windows 7. Which I use depends on other things I must do that day...

harvey84 wrote:

second the main language is c

No. I know very little of C, but I can build my own images according to my wishes. You set you wanted to see how you can replace a logo in the webinterface. That is probably HTML, CSS or Javascript.

harvey84 wrote:

and if there is a cd or pdf books to learn linux ?

There are. But I learned almost evrything byy repeating what others did and then see if I understood what they were doing. And then experimenting with parameters found in the man pages. And so on.

harvey84 wrote:

there is no way to edit an existing firmware
like zte or d-link or any routers i have to flash
a new os like OpenWRT(open source) in order to edit it at any time or customise it right?

You could potentially edit existing firmware. But that is usually very difficult. If I want to learn something I find it much easier to start with something working and then breaking it. Because then you know what you did. The other way around is much more difficult.

You said you want to understand how firmware works? Why then the hard way? Understanding the OpenWrt firmware is much easier and give you the insights you want. And after that you could do it the hard way with unknown firmware. But again I get the impression that you are starting from almost no knowledge. Make it more fun for yourself by first doing something that is possible and not that hard.

What routers do you have. AR they supported in OpenWrt. If so, no need to buy something new. But the example I gave is cheap price if you want to learn.

harvey84 wrote:

you see i thought it like this forum script
i can go to the files and edit it is that possible with routers?

Theoretically yes. But only with a lot of knowledge you at this moment don't have. The path I suggest is more practical. You edit the files before you compile it into a OpenWrt firmware which you flash onto a device.

harvey84 wrote:

i just didn't know i thought i could edit that router or use it to learn on it you know
it an old router i have i thought i use it as personal server if know what i mean to try on it

Again give us a exact name, so we can see if it is already supported in OpenWrt. If yes, you have a platform for experimenting. If no, again, make it yourself easy and buy a cheap, supported router. You don't want to experiment on your router to the internet. At least not until you know it will work.

I started with a  TP-Link WR741ND. Then I did a TP-Link WDR4300 which is now my router to the internet. Both were easy, but I learned how OpenWrt works. On the first I wrote a Lua script -- the language which generates the router webpages -- which worked. Now I am helping with a Sitecom WLR-6000. That one is not supported yet. But knowledge how OpenWrt works helped in finding necessary information. Part is documented by me in the wiki. But it cost many, many hours. So just start with something that works first smile.

harvey84 wrote:

so is there some method you advice to start with
for starts which linux distribution is better to work on Ubuntu, Debian, Red Hat, other?

and if there is a cd or pdf books to learn linux ?
i have dealt with ubuntu a few times not much

and you have cleared a lot things to my and thank you very much

still just one question i don't get
there is no way to edit an existing firmware
like zte or d-link or any routers i have to flash
a new os like OpenWRT(open source) in order to edit it at any time or customise it right?

Take a distribution you like ...
Yes this is true

For learning linux or in this case firmware/operating system programming.
first read code,
second read more code.
understand this !

For linux (and for windows) books are really rare.
Most hackers knew this.
You have to learn this by yourself
And this is really the hard part.

Editing firmware is quite easy, but not the binary one.
This way is partly good documented (for me), for you
as a very beginner this is hard.
Take a spare router which can run OpenWRT to begin with.

It may possible to brick/damage your device !!!
And this is also pretty normal

Build your own firmware an upload this with TFTP.
Yes TFTP not via webinterface.

And they might be some trolls around the net, don't feed them.

@hvdkamer

i get what you saying
and you completely right and that's what i am going to do start with
supported router at first to openwrt
but the thing is if i bought supported router flash the bin file on openwrt into it
i didn't learn anything i just have a router that work with openwrt
you get what i mean ? if i follow the guide wiki to do something that is not learning

i want to understand the code that is why i want to edit that zte router it an old one not supported

No. I know very little of C, but I can build my own images according to my wishes.

if you know very little of c how could you manage to build your own image


You set you wanted to see how you can replace a logo in the webinterface. That is probably HTML, CSS or Javascript.

yes, edit one for now not build my own image , and i said to replace the logo because it sample not going to take much work and
it would be a start for me to see the code and work on it 
i want you to get that image why i mention the forum as example

you know how i learn php ,html?

how i started ? a friend of mine has a site running some php script and he want to edit something
i found guide how to install private server to test on it
i followed the steps i didn't understand it but i followed them anyway
i read about php for an hour
how to start the code how to end it how to write your first code
<?php
echo "hello world";
<?

just some basics
then i download that script to try on the private server before i upload it to the active site

and i spent 6 hours trying to edit that thing going through files a lot of files didn't understand a word of it but i kept searching for the functions i don't understand and read then continue trying to find the right file to edit after 6 hours may be more after searching and learning ,trying i finally edit it

then i tried to edit something else searching learning , going to another scripts
and the thing about searching when you understand some little of it you at least know what you search for or how to search
and you get to understand it

until i found myself a php programer
i can edit any script
i can build the most complicated one myself
i can do what ever i want with php now

tell me you get what i mean please

i just want to get into the code
doing something small like the lago
tell me step by step how to access the system and edit that small thing and then i will continue in my own way
you see i want a taste of it

and i will also look for supported router to continue on it
but i hope you get what i mean give me some basics

and of course thank you very much for your support and your patience


@elektroman

first read code,
second read more code.
understand this !

good where is the code !!!
that was my question from the beginning where do i find the files so i can read the code
no one give a steps

Build your own firmware an upload this with TFTP.

with what tools or what language

just get me to the point where i get to do this if you know what i mean

<?php
echo "hello world";
<?

again all i know about routers is this 192.168.1.1
nothing more

just exactly what i used to know about sites domine.com
until i found a way to go into this domine.com:2082

so is there is :2082(cpanl) in routers


and i will get a supported router and run openwrt on it

and thank you again for help

harvey84 wrote:

but the thing is if i bought supported router flash the bin file on openwrt into it
i didn't learn anything i just have a router that work with openwrt
you get what i mean ? if i follow the guide wiki to do something that is not learning

But now you have a working platform you can break and repair smile. And that is learning...

harvey84 wrote:

i want to understand the code that is why i want to edit that zte router it an old one not supported

Again, which router do you have? For learning, start with something simple. My suggestion:

1) make a (virtual) Debian/Ubuntu system with the build requirements
2) build the latest version from git:

hvdkamer@openwrt:~$ git clone https://git.openwrt.org/openwrt.git
hvdkamer@openwrt:~$ cd openwrt/
hvdkamer@openwrt:~/openwrt$ ./scripts/feeds update -a
hvdkamer@openwrt:~/openwrt$ ./scripts/feeds install -a
hvdkamer@openwrt:~/openwrt$ make menuconfig

Then select your supported router in the first four selections. Don't change anything else. The first thing you want to prove is that you can build a working firmware for your router. Do exit and save the .config. Now do a make and wait several hours. No errors? Is there something with your router name in /bin/<depends> ? Try to flash it through the normal sysupgrade procedure,

3) If successful try adding a package of interest, repeat

What your are doing is building from source. And that you can study. The LuCI package contains AFAIK the scripts which make the webinterface. You can change stuff and then do a rebuild. You can also try to see where the files are in a running system. You can change them, but after a reboot they are lost.That is why building the changes into the firmware is necessary. Another option is using extroot where the changes are stored on a USB flashdrive.

So you see it is better to use a working system. If one of the above steps goes wrong, you know how to revert. In a unknown system it is often not clear why something doesn't work.

harvey84 wrote:

No. I know very little of C, but I can build my own images according to my wishes.

if you know very little of c how could you manage to build your own image

See above. The developers of OpenWrt made a build system even I can use smile.

harvey84 wrote:

yes, edit one for now not build my own image , and i said to replace the logo because it sample not going to take much work

Do it in the OpenWrt firmware. Change the stylesheet or add a "Welcome Harvey84" page. In OpenWrt because we have the source this is relatively easy. Relative because it will probably take you at least a day smile. But this has a good chance of success and that is in a first experiment a good motivation to go on.

harvey84 wrote:

you know how i learn php ,html?

That is exactly what I suggest above. It is the way I learn things as well.Breaking working stuff, repairing it, get an idea how it works and then enhancing it smile.

harvey84 wrote:

tell me you get what i mean please

I think I do. See above.

harvey84 wrote:

and i will also look for supported router to continue on it

I got the impression above that you already have one? Please tell what routers you already have. And give the model numbers, not ZTE. I for example have a TP-Link WDR4300, Sitecom WLR-6000 and GL.iNet 6416.

The default webinterface in CC is a bit old fashioned. Fine by me, but if I show it to other people they don't like it and therefor won't install OpenWrt. Bit of a shame that a flashy interface is more important but that is how the world works these days...

So I found this. Haven't tried it yet, but that could be an interesting start for your second build. It contains pointers to the source, so experimenting will be much easier. I will try it myself after I finishing my other experiment.

@hvdkamer
Very good ...
But I prefer a real Linux not in a VM because of the TFTP Server.
I don't know if it's possible with VM  because of the protocol.
And I don't care

@harvey84
As I said a (very) long road.

hvdkamer has written for you as a very beginner a good guide.
Use it.
Each step "down the rabbit hole" is tougher.
Please don't think only the pages on OpenWRT are useful, this is not true.
Maybe others can give you some hints to your problem..

If you want to handle with the serial console please
buy some

usb ttl 4 wire

adapter on ebay, and don't connect the "red wire" this is mostly +5V an will
damage the board.

I expect abut two weeks for you to get an running "system"

FWIW
Here is some user with unknown hardware ...
https://forum.openwrt.org/viewtopic.php?id=66501

(Last edited by elektroman on 16 Aug 2016, 16:50)

elektroman wrote:

But I prefer a real Linux not in a VM because of the TFTP Server.

Good point. I build  the firmware in VM's. But use my regular Ubuntu for TFTP.

elektroman wrote:

I don't know if it's possible with VM  because of the protocol. And I don't care

The last is your problem smile. But I use bridged for my VM's so they are all part of the same network. My guess is that it would work...

<hijack>
@hvdkamer - given that you do not program (in C) yet compile images begs the question why then not use Image Generator?
</hijack>
And to the topic, 3X posters (OPer, hvdkamer and elektroman) with different perspectives (webhead, hobbyist and developer). It would seem the advices given are not relevant to a web developer (break / re-flash being the dominant theme).

Advising the OPer to open the device and attach a serial or JTAG connection would seem a logical first step.

Max Hopper wrote:

@hvdkamer - given that you do not program (in C) yet compile images begs the question why then not use Image Generator?

Normally when you want to build your own, you use the build system from the project. Later I discovered the Image Generator, but its documentation is confusing. I get the impression that this is a building system, but that the first part is already compiled?

Anyway if you got the build system running -- and that requires no C knowledge -- you don't investigate further smile.

<hijack>
@hvdkamer - Image Generator runs in a few seconds, building images from the ANDing of a pre-defined device profile and command line includes / excludes. The download contains all the kernel and package .ipks that were successfully compiled by BuildBot for CC and trunk.

It really could not be easier to create an image under 4MB and include Luci (not required here).
</hijack>

As an aside, PHP has too big a footprint to run on minimal openWrt devices. Lua, with many similar capabilities, can run on routers with as little as 4mb flash and 32mb ram (16mb ram can work for very limited applications).

lizby wrote:

As an aside, PHP has too big a footprint to run on minimal openWrt devices. Lua, with many similar capabilities, can run on routers with as little as 4mb flash and 32mb ram (16mb ram can work for very limited applications).

Today no
I may work, but ..

I think in the Breaker Barrier is some announce of the size.
And they use LuCI a UCI with LUA system.
In size this around 100MiB or so

JTAG is very hard, for a beginner.
This not worth to hassle with

at first sorry about the delay in response

after a long search and after unlock the screws and looking into Main board
here are some old router i want to try and learn on them

look at wikidevi because i can post links

Huawei_HG532e
Huawei_HG531_v1


ZTE ZXHN H118N (HW ver 2.3)
Main board: ZXV10 H108La / ZXHN H118Na
CPU: Realtek RTL8676S @450MHz
Flash: Winbond W25Q128FVSG (16MB)
RAM: RTL8676S (int. SDRAM 32MB)
WLAN: Realtek RTL8192ER 2T2R

is any of this routers supported by openwrt
or can it be supported i have searched and found nothing

so could any one please tell me what is The standard in routers to be supported by openwrt
is it the cpu or the RAM size or the Flash size

i don't really know much
i have tried to download
chaos_calmer/15.05.1
but i don't know how to build firmware or which one to download
i need some explanations from my point of view
i mean android has sdk and c# visual studio
php has apache server and you could use notepad for writing the code
there is lanuge and a tool to write the code and compiler and somthing to run the code on to try it

you get the idea

choose any router of the above and tell what to do
as i said something simple like changing the logo and then i would know what i have
to learn or to know in order to modify a firmware

but the point of buying a new one to install openwrt on it
i would still no nothing all i did is download the bin file and upload it

so call it a project or something just tell step by step what to do to change the logo pic
that is all i want know

i am running windows and i am installing ubuntu now

and of course thank you all very much for your time and help

The Table of Hardware is a good place to look for supported models.
https://wiki.openwrt.org/toh/start
Note that quite a few unsupported models are in the table.  Look at the current release column, if it is blank or "?", the model is not supported. (e.g Huawei HG532).

General requirements are
CPU: Atheros or Ralink (now known as MediaTek) are generally good.  Realtek is not well supported.
RAM: 32 MB or more
Flash: 4 MB or more, 8MB is much better than 4.

You can run the x86 builds of OpenWrt on practically any old PC hardware that has bootable USB, network and wifi.  The software development will be the same as on a router.