Re-organized the forum to more cleanly delineate the development section, as the end user support side appears to have taken a life of its own!

Author Topic: Web Interface Checksum  (Read 15299 times)

April 25, 2011, 10:02:28 am
Ah, I missed the attachment.

You would use the bootloader to load the new webui into the correct location in flash. Which is the way I do it. I have not tried doing an upgrade through the web interface. It goes a little something like this...

ft 8 webui 0x7f200000 0x7f200000 -nofooter

or fx if you want to use xmodem.

The camera program (which is a part of the romfs) copies the web ui files out of flash (after checking if the image is valid) and into the home directory, which is a ram disk. So when your webui is bad, it does not get copied out of flash, and you end up with an empty home directory. A bad romfs, on the other hand, not only would you probably have an empty home directory (if you had one at all), you would also probably not even get a 404 page, since the camera binary would probably be screwed, and with it, the web server.

« Last Edit: April 25, 2011, 10:09:15 am by Nocturnal »

April 27, 2011, 02:54:12 am
I tried to check changed and packed webui. I put hello.htm in the webui folder and repacked it with foscam_pkgmgr. I tried to upload the packed by foscam_pkgmgr WebUI to the camera via the IPCam Tool I couldn't. IPCam tool rised the Error that file is bad. After that I tried to upload it through bootloader
fx 8 webui 0x7f200000 0x7f200000 -nofooter
bin was uploaded but when I reboot the camera I got 404 error in browser. I uploaded good webui.bin from official firmware.

Then I mounted romfs.img put hello.htm in /home directory and packed the rom with genromfs. I used boot loader to upload the rom. So everithing was OK. But in browser I get 404 when I typed http://ip_cam/hello.htm. Also in COM port log I found that cam is trying to obtain hello.htm and favicon but no way. Files are missing.

What am I doing wrong. How can I access /home directory via browser. And how can I put some files there to be able to get them later in browser?


April 27, 2011, 04:29:16 am
I suspect foscam_pkgmgr may not be generating valid images, but I can't say for certain, since it doesn't work properly on either of the machines I have tested it on thus far.

You cannot put files in /home in the romfs image (or /usr /swap /var/run /etc /flash /home or /tmp), when they are mounted as ram disk by /bin/init any files inside them become inaccessible.

You need to either put hello.htm is a valid webui image, or put it in the romfs, and update /bin/init to copy it into /home after is has mounted it as a ram disk.

April 27, 2011, 09:45:47 am
Ok Guys I found a mistake un my script regarding size calculation (I take only data wihout header and the size INCLUDE header - I've updated the wiki according to).

You can find the script below :

Fixed size for webui
Fixed escape for var and white space for path

April 27, 2011, 10:01:43 am
:-) I was just about to mention the size issue (finally got your script running on a machine, had awk but not gawk). Your new script is now generating identical images to my own build process. Quite a speed differential though.

April 27, 2011, 10:20:15 am
Yeah bash is pretty ugly for this kind of use but for people who don't really how to compile c sources... it could help...

If you make md5sum for file you will see difference because file are not concatened in the same order.

(in fact I made this script before finding this forum so... If I knew I'll use your c sources instead)

April 27, 2011, 10:25:58 am
Actually, it is concatenating them in the same order as fostar is.

~/WebUI$ md5sum new.webui.img
f8d8b6052a3311d311d6ba9f1e2dc709  new.webui.img
~/WebUI$ md5sum test.bin
f8d8b6052a3311d311d6ba9f1e2dc709  test.bin

Assuming they have access to a system with gawk installed, or know howto install packages themselves. It would never have occurred to me to do it with a shell script. I'll have to add it to my mental toolkit. Never know when a new method might come in handy somewhere else.

April 27, 2011, 10:30:37 am
Just to notive that I've an issue with your C code

Bad Adress, I change :

-FILE *file = fopen(argv[1], "rb");
+FILE *file = fopen(argv[1], "r");

And it works... That's why I dislike C code :)

  • *****
April 27, 2011, 10:36:05 am
Where is the repository for the C code?

April 27, 2011, 10:41:20 am
Bad address is the error you get when you run it without specifying an in file and an outfile. Normally I would have written it to detect errors, and give appropriately meaningful messages, but I wrote it for me, not other people.

'b' stands for binary, and is either valid or not, depending on what source you look at for fopen.

April 27, 2011, 10:48:58 am
Can't reproduce... weird... strace give me bad adress on OPEN (and I provide a file...)

Does'nt matter it works now.

April 27, 2011, 10:52:29 am
 :D And that is why modern software is full of bugs.

May 03, 2011, 07:28:49 am
Hi Guys!
I am a webdeveloper so I am only interested in changing the ugly WebUI of the cam and enhancing it with nicer design and javascript functionalities.
With that in mind (and a FOSCAM FI8918W at hand)I would like to delete all the unnecessary Chinese etc. language files, the ocx file and upload my new interface onto the cam.
My questions:
1. Could anyone confirm that this cam has 2M flash memory? I couldn't find this technical detail anywhere and would like to know how much space I could use for a webUI.
2. Can I simply upload a brand new interface with foscam_pkmgr without bricking the camera, or there are some rules?
3. If I have packed the new webUI, can I simply upload it with the IP Camera Tool?
Sorry if I am asking obvious questions.
Thank you.


May 03, 2011, 11:43:45 am
Ok Guys I found a mistake un my script regarding size calculation (I take only data wihout header and the size INCLUDE header - I've updated the wiki according to).

You can find the script below :

Fixed size for webui
Fixed escape for var and white space for path
Ok. I went ahead and have tried to repack a webUI with this updated script, but when I try to upgrade the firmware it gives me an error that the .bin file is bad on my cam. Could anyone do a successful upgrade with this? If yes, please share how you did it. Thx

May 03, 2011, 12:13:14 pm
Try to unpack/repack the default webui firmware to see if it upload fine.

The only difference is the file/folder order, maybe there is a rule to respect regarding the arragement.

Let me known... I've no time left to test it by myself.