Copy file to SD card from internal flash.

Hi,

At first I have to say that I know nothing about Linux :frowning:
But I am looking for solution how to copy one file from internal Lowrnace HDS flash memory.
Lowrance HDS is Linux based device.

Here is the link for firmware update files for this unit.

At the end of main firmware file there is shell script. (attched to this post)

In this script we can find path to config.ini file which is located in internal NAND flash chip of HDS device.

And my question is...

Is it possible to add some commands to the script to copy config.ini from internal flash into SD card?

I want to edit config.ini and copy it back to flash.

Please help.

Jakub

It's nice they bothered to document a bit about the environment in there, that helps.

It MIGHT be mounting the card already, I'm not sure. What directories/files are in the SD card right now? Is that where it holds charts?

Firmware 2.5 for this unit contains (in root dir on SD):
file1: hds-2.5.31.56-3-56.13-3-standard-1.upd
file 2: update.conf

and directory "MAPS"

Latest firmware (4.0) files:

HDS-4.0.36.56-Standard-3.upd
update.conf

Hmm, getting closer. What filesystem is on the SD card?

FAT or FAT32. It does not matter for unit.

Dangit, it's not using the card in this script at all. I don't know what device it would be.

I should put a disclaimer in this post.

I can't guarantee I won't brick your fishfinder. Messing with embedded Linux isn't the same as desktop Linux, and embedded hardware is always a little hairy.

Now then... I don't know enough about your system to do what you want, but this script does have clear methods for sending messages to the screen if your device supports them. So my plan is to print a bunch of debugging info for you to read, then loop forever so that updates don't actually get installed. To kill this loop you may have to hard-power-off your device. Since many things in this script already demanded that I presume that's not a problem.

I've highlighted in red the code I'd like you to insert below some existing code.

splashy boot || true
# Some time (about 1 second) is needed to set up the splashy socket.  (Racy!)
sleep 1

# SECTION CORONA688 ADDED.  Prints stuff to screen, then hangs.
splashy_update "print 2011 unix.com fishing team"
sleep 10
splashy_update "print Dirs in /:  $(cd / ; ls)"
sleep 10
splashy_update "print Obvious disks: $(cd /dev ; ls [sh]d* || true)"
sleep 10
splashy_update "print block devs: $(cd /sys/class/block ; ls)"
sleep 10
splashy_update "print Mounted FSes: $(while read A B C D
do
        echo $A,$B,$C
done < /proc/mounts)"

sleep 30
splashy_update "print Goodbye."
while true ; do sleep 42d || true ; done
# END SECTION CORONA688 ADDED.

Come to think of it, I'll attach a file, since you shouldn't edit the file in Windows.

Here's the updated script.

There is no worry if I will brick it.
I have full flash copy made with my Wellon VP-990 programmer.
So, I can restore unit.

Can you also download full firmware from link in my first post.
Update.sh is located at the end of firmware file.
There are some values I have no idea what they tells about.
Can you take a look, please.

It looks like this:

Ps. There is no problem with calculating new SHA1 checksum and placing it in bin file.

That's a tape archive! :eek:

Specifically ustar, the modern kind. See tar (file format)

Each file record begins with a header containing, among other things, a filename and 'ustar'. The literal contents of the file follow immediately after, padded to a certain block size.

This is good news. If you can figure out where the file begins and ends, you can dump it and extract it with ordinary tools, and build a new one from scratch. (It'd be best to do so on a UNIX system though, because it contains important file permissions, something a Windows system would botch mercilessly.)

You might also be able to append things without altering the previous content; tar, being originally built for tapes, plays well with that.

Attached are config.ini files dumped from HDS-5, HDS-7 and HDS-10 unit.
I have no tools to "unpack" them :frowning:

I don't suppose you have access to this thing's serial port output? The script shows how to use it, and squirting the file out the serial port may be mounds easier than trying to find, mount, write, unmount, and sync a flash disk upside down and blindfolded.

---------- Post updated at 04:00 PM ---------- Previous update was at 03:59 PM ----------

My system recognizes those as disk images, I may be able to get files out of them. Give me a bit.

:slight_smile:

Here is full NAND flash dump:
www pouchx com/PRV/HDS/K9G8G08U0M-HDS-10-full-NAND_dump.rar

Config.ini at 0x837D0C0 offset.

Here is how HDS reads config.ini values.

My mission is to change AMER to ROW.
It can be represented by values as below:
0 - AMER
1 - EMEA
2 - ROW

[General]
Brand=0 
INIVersion=2.0 
ScreenType=2

[ApplicationDefaults] 
DefaultCharProvider=Navico 
DefaultDateFormat=MM/dd/yyyy 
DefaultTimeFormat=12hr 
DefaultTimeZone=-06:00 
DefaultUnits=Imperial 
DefaulVideoFormat=N/A

[Mapping]
HaveBackground=True 
HaveLakeInsight=False 
HaveNauticInsight=False 
HaveSonarOnly=False 
HaveUSInsight=False 
HaveWorldBackground=False

[Product]
Description=HDS-7 with US Background 
FinalAssyPartNum=003-8086-00 
ProductId=HDS7 
ProductRegion=AMER

Your attachments don't seem to be full-sized jffs2 filesystems. Trying to read them mostly just failed, and forcing it to mount anyway locked up my system. Hopefully the dump will be more useful...

Full NAND dump link is posted above.
It is 1GB chip.

#   1GB NAND has 256k ERASESIZE and 2k PAGESIZE OR 256k ERASESIZE and 4k PAGESIZE 

Since you can dump/restore, you might be able to get this just by hex-editing. Change "AMER" to "ROW " . Note the space on the end, which makes the filesize not change. A newline would also work.

I was thinking about this before...but...as you can see, there is no place to replace ROW with AMER. (taken from full nand dump file)
By the way. Changing ROW/AMER in config.ini will change unit to RestOfWorld version permanently.
Changing it in firmware, will change unit till next firmware update.

PS. Config.ini looks always the same. I made dumps with firmware 2.5, 3.0, 3.5, 4.0.

I don't think that is the config file, I think you landed inside an executable.

I'll take a closer look at the big dump when I get home.

1 Like

I'm sure everything is in config.ini.
Some time ago I had HDS5 factory ROW version.
I just copied 12kb config.ini from this unit and pasted it into HDS5-AMER version dump.
After that HDS5-AMER started as ROW version.

---------- Post updated at 06:12 PM ---------- Previous update was at 06:01 PM ----------

Anyway. Thank you very much for your help.
You are my only hope to solve my problem.

Maybe this will help a little:
Memory Technology Device (MTD) Subsystem for Linux.

Linux is magic for me, Im electronic engineer :o

Ps. It is 1.00am here in Poland... I have to go to sleep :frowning:

It'll take ages for me to download that rom dump. Sweet dreams :stuck_out_tongue:

---------- Post updated 09-23-11 at 10:28 AM ---------- Previous update was 09-22-11 at 05:21 PM ----------

is that 256kiloBYTE pagesize or 256kiloBIT page size? The ROM is not a multiple of either in size. (4K doesn't work either.) It's not a gigabyte in size, not even a "drivemaker's gigabyte". Instead it's almost exactly 0x42000000 bytes long, with 2,200 bytes of change ( total 0x42000898 ).

I don't understand why they'd have data areas in a ROM chip that're smaller than the chip's page size. Is there any physical structure to the data layout? Some sort of special hardware data area?

I'm unable to mount this image as a MTD device yet. I'd need 44 gigabytes of RAM to emulate a 1GB MTD. Instead I'm seeing if I can find the offsets of partitions inside it and rip them out.

Have you downloaded "big" dump?