Programing for new device

It's your choice as to how to proceed. You've been told quite clearly that

  • You can't "edit" a binary image
  • You would need to build from source
  • The processor in your device is unsupported
  • The driver code for some of the devices is of poor quality
  • Your device is woefully under-spec-ed for current requirements for minimal operation

Unless you're willing to learn how to build Linux kernel, have the skills to deal with the manufacturer's data sheets and specifications, the skills to debug the results, and the skills to modify Linux kernel source and drivers, you are unlikely to ever get OpenWRT running on your device.

There is no need to repeat the questions -- you have been given the answers.

1 Like

@jeff
i am no repeating the question
you just said you can't
i just searched and found tools like binwolk that extract bin file
so i didn't take your "answer" to be correct
and i "repeated" it so someone with more experience would answer
and i am a programer too of course i am not like you ,your professional i am someone who insult people you know visual studio php ,c#,c,c++ ,js,perl and some linux experience and many other
so you can just ignore my repeated question and just answer the profinal one
and leave that to the beginner like me okay

@lleachii
if i insult you be say visual studio and it's an insult
then telling me that i'm a stuipe is not an insult
the wrong is not yours it's the forum admins who allow it

and i didn't get how to install openwrt because no one seem to care they just want an easy question
like i have openwrt installed and i need to install vpn on it !!!!!!
not because i am a stupid

and you know what your provoking son of a bitch and i know that you like it
otherwise you won't post again
go to doctors get help you're one of those people who love being insulted
i can go on all day and insult you but i won't feed your need of feeling filthy and dirty

to the forum admins who hide me post
you hide my post and allow his
if that is your logic can you just delete the topic and my username

:rofl:

if (extracting == editing)
  puts("The answer of @jeff isn´t correct");
else
  puts("@jeff answered your question correct");

month=12;
if (familiar_with_mips_asm)
  do {
    coding_and_debugging_day_and_night();
  } while (month--);

Your answer(s):

https://git.openwrt.org/?p=openwrt/openwrt.git

3 Likes

The only rainbow here is that mips_asm is easier than x86_asm

https://courses.cs.washington.edu/courses/cse378/03wi/lectures/mips-asm-examples.html

And you will need some disassembly tools too.

1 Like

Taking a more practical approach

Contact the manufacturer of the router and explain to them you would like to do your own research and development on their device and would they be willing to provide you with any of the source code.

They may ask you to sign a non-disclosure agreement.

They may charge you a small fee to dig up the old code.

This would be a lot more practical than ending up with 100,000 lines of assembly code in mips and trying to make any sense of it in this life time.

1 Like

@juppin
good one

but MIPS !!
i don't think so

@mbo2o
i did extract the bin files using binwalk
but i am still trying to understand the code there is a lot of files some of them is c and js and xml
and some of them i don't know they written with what no extinon
anyway i will try to edit it just to unlock the things that is locked and rebuild it and try

as for openwrt i may try install on pc just out of curiosity to see that code and to understand why i can't install it on any devices
because i am still don't get it
it's linux system that install on a lot of router and pc
why i can't get the minimum one of it not that entire features like debian for ex if you try to download it you will find many copies one that basice and the other has more features
like ubuntu server and desktop
you get it
i just looking to code any copy of it and replace that firmware
any copy that has basic features lily ,adsl, lan and wan ,nat ,dmz simple

and thank you bill,juppi

@harvey_84 extracting bin files, or say, all rootfs tree and kernel is the one of very first step in digging on the unsupported device. Second step would be reassembling all this extraced in to new(modified) firmware file and make this file acceptable/flashable/bootable by the router's bootloader/firmware. Try to do this second step. Connect UARTtoTTL adapter to your board serial console pins and share here bootlog from your device. Take clear photos of your device PCB, read full flash dump by SPI flash programmer and share it.

1 Like

unfortunately it's mostly shell code
look at the first line of the file, it's
#!/bin/sh
shell code and c (from old days) are similar

we don't need extensions

ls /bin/busybox  -l
-rwxr-xr-x    1 root     root        393257 Jul 15 14:30 /bin/busybox

The x is the magic.
please read a beginner unix/linux book about this.

You can,t install a repository, only clone, fetch.
Please read here about git
https://git-scm.com/

From a beginner POV yes.
It's a linux system, but tailored on a SoC aka system on chip and there are lots of them.
In every color, size of shape, to explain this in simple words.
And every device has his very own restrictions

But here you must bite the bullet

RTL8676S is an RTL8676 with embedded SDRAM and some outdated Lexra
LX5280 cpu core
Read here about the LEXRA case
https://www.linux-mips.org/wiki/Lexra
And for the entire Realtek LEXRA suport read here
https://forum.openwrt.org/viewtopic.php?id=46606

unless you have a RTL8197F which is a true MIPS compliant, I would not do such a work

I advise you please use a well supported device and play with openwrt.
Don't use this kind old and outdated devices for a beginner

2 Likes

Yes, most of us here "get it" -- perhaps you need to better understand that the kernel and drivers need to be configured, compiled, and built for each specific architecture and device. You can't run x86_64 code natively on an ARM, MIPS, or even 32-bit-only x86 CPU/SoC. While the "PC" architecture has been somewhat standardized for Intel and Intel-compatible chips and drivers, when they exist, can be loaded based on probing the hardware, that is not how embedded devices work. For that matter, the forgoing applies to just about anything except an Intel-compatible PC.

1 Like

@ElektromAn ,@mbo2o ,@xssa
first
thank you all for your time and help
after a lot of reading and searching
i did understand how it work
and you will right mbo2o about

and long story short now i am at the other part
where i connected uart ttl
and ready to flash the img file
i did make img from source code it's long story and it was c and shall and config and a lot of make file
after connecting the gnd and tx and rx
i am using minicom
i get the boot info cpu ,ram etc
after that i am stuck
i don't know how to flash that img into the router
the web interface locked
telnet time out
even when i connected the uart it didn't accept the user and pass
but i pressed 1 to go into boot console
and i found a lot of Command i don't know anything about it
bootline
and
sys info and things like that
my question now is how to flash it
or is there a manual to read about that Command or how to get root access or any that's helpful
and thank you very much

@harvey_84 Good start. On what device are you digging? You can share here UART console bootlog and internal PCB photos in good quality. This will give some information and may be somebody would help you.

If you can use initramfs on your device (see in target images), please do
So you can check with the original firmware

You are in the bootloader.
This is mostly uboot (or breed) sometimes a patched version.

If this is uboot, you can enter "help" or
"printenv", this output is needed.
If you post some output here please use "preformatted text" as output.
Look for the </> sign at the top of the edit bar.
With this no reformatting is done in this forum.

I won't flash the device unless I really have to.
Anway normally to flash via serial you need to setup some TFTP Server.

Think of it as a ram disk so you can test without making changes to your flash

Of course you will need to download it everytime you reboot

@ElektromAn
here is the list of command available

?                                   Print out help messages.                  
help                                Print out help messages.                  
go                                  Booting the linux kernel.                 
decomp                              Decompress kernel image to ram.           
memrl <addr>                        Read a word from addr.                    
memwl <addr> <value>                Write a word to addr.                     
dump <addr> <len>                   Dump memory content.                      
jump <addr>                         Jump to addr.                             
flash <dst> <src> <len>             Write to flash from src to dst.           
erase_write <dst> <src> <len>       Write to flash from src to dst.           
imageflash                          Write bin/w image to flash.               
xmdm <addr> <len>                   Xmodem receive to addr.                   
miir <phyaddr> <reg>                Read ethernet phy reg.                    
miiw <phyaddr> <reg> <value>        Write ethernet phy reg.                   
webser                              webser                                    
cpufreq <freq num> / <m> <n>        Set CPU Freq <156~450>(freq has to be multiple of 6)
ipaddr <ip addr>                    Change modem's IP.                        
bldr>

and i tried to flash the new bin with imageflash
using tftp and sending file
but at the end i get format error and i am sure that the firmware working fine but i don't know what's wrong ,how to flash it
what is the phyaddr and and and Xmodem any idea
and thank you

In short, because it's makes no sense to me, see at the end.

Some networkcard as seenfrom a programmers POV

MAC -> MII -> PHY --> magnetics -> plug

MII is a "generic" interface which makes possible to use copper or fiber as medium. The PHY can translate this.
Now you have some device with a build in switch, see here

This is only one possible solutions

You can't be shure until you booted your device :wink:

Form kernel image format uboot or zImage is common.
But some vendor may add some magic bytes at the beginning.

AGAIN.
As I said Lexra cpu core as old and not MIPS compatible,
OpenWrt will not support these.