Strange File System Problems


odessa

Still Fresh
Joined
Oct 21, 2006
Messages
15
Hi!
Can someone please explain to me how the filesystem on gp2x works?
As I understand the whole linux distro is on nand, what is in nand.img?
I want to copy some files permanently to root, for example I have my .sh script in /root but it becomes size zero every time I reboot. There is also a .o module I have that I put in lib/modules but after reboot it changes size and is not a correct executable anymore. Similar things happen with SD card, I copy something over using ftp and on reboot it's like I haven't copied anything over. I tried using sync but same result.
Why do I get resets on hardware reboot? Anyone?

Thank you.
 
Well, still no luck. I thought maybe stuff in /usr/gp2x won't get butchered but it did. My sh scripts are all size zero after some reboots and are fine after others. It seems like there's something that 'updates' linux core and trashes stuff that I copy over (I'd figure it would be completely gone though, not just size 0).
 
Well, still no luck. I thought maybe stuff in /usr/gp2x won't get butchered but it did. My sh scripts are all size zero after some reboots and are fine after others. It seems like there's something that 'updates' linux core and trashes stuff that I copy over (I'd figure it would be completely gone though, not just size 0).

I believe that every time the gp2x boots, it extracts that nand.img file and turns it into the file system that you see. If you want to copy scripts to your gp2x, connect it to your computer via usb, and enable the usb link. (settings->usb->nand memory) Make sure you use the nand memory instead of the SD card. then just put the file in the root directory there. Putting a .gpu extension on your files enables you to get at them through the utlity menu, while a .gpe extension will allow us to see them through the game menu. I use .gpu personally.
 
Last edited by a moderator:
Well, still no luck. I thought maybe stuff in /usr/gp2x won't get butchered but it did. My sh scripts are all size zero after some reboots and are fine after others. It seems like there's something that 'updates' linux core and trashes stuff that I copy over (I'd figure it would be completely gone though, not just size 0).

I believe that every time the gp2x boots, it extracts that nand.img file and turns it into the file system that you see. If you want to copy scripts to your gp2x, connect it to your computer via usb, and enable the usb link. (settings->usb->nand memory) Make sure you use the nand memory instead of the SD card. then just put the file in the root directory there. Putting a .gpu extension on your files enables you to get at them through the utlity menu, while a .gpe extension will allow us to see them through the game menu. I use .gpu personally.

I'm way past the usb link, I tried samba share, ftp, telnet. I tried copying to /, to /root, to /usr/gp2x, to lib, anywhere, it all screws up at one point. Any new files that I put up anywhere in / have problems.
 
Last edited by a moderator:
So what you are saying is that when you connect to the GP2X NAND through USB, and place a file in the root directory, it vanishes after you reboot the GP2X? You shouldn't even be able to access the linux root directory, or any of the Linux directories for that matter, through the usb connection to a PC. Sounds like you have USB networking turned on. Do you have a BoB, or do you use the USB cable to telnet into the GP2X?
 
So what you are saying is that when you connect to the GP2X NAND through USB, and place a file in the root directory, it vanishes after you reboot the GP2X? You shouldn't even be able to access the linux root directory, or any of the Linux directories for that matter, through the usb connection to a PC. Sounds like you have USB networking turned on. Do you have a BoB, or do you use the USB cable to telnet into the GP2X?

Forget straight usb connection for now, I am using gp2x as a linux box. I use usb network to telnet/samba/ftp.
The problem is that when I'm adding kernel modules or even small bash scripts they disappear (zero length) after reboot. Sometimes they stay sometimes they don't. I tried to change modules configuration, so I edited the file and added smbfs to the end, after reboot most of the config file disappeared and smbfs was not even there. This is a pain, I can't figure out what's happening. Doesn't look like it's a sync issue.
 
Last edited by a moderator:
Alright i understand what your getting at now. Like I said before, i believe that nand.img file is decompressed on startup, and that where the Linux file structure comes from. So everything you see Linux wise, like /etc, and /bin all disappear when you shut off the GP2X. Try putting the file in /mnt/nand instead. i think thats the directory, checkout /mnt and see whats up. That should write the file directly to the nand, and it should be there when you reboot.
 
Alright i understand what your getting at now. Like I said before, i believe that nand.img file is decompressed on startup, and that where the Linux file structure comes from. So everything you see Linux wise, like /etc, and /bin all disappear when you shut off the GP2X. Try putting the file in /mnt/nand instead. i think thats the directory, checkout /mnt and see whats up. That should write the file directly to the nand, and it should be there when you reboot.

Thanks again for the reply.
I don't quite get how the whole image works. My nand.img was 29Mb, then 30Mb, so it seems like it's changing. I was hoping that it's repacking on shutdown or something along those lines. I can't find a windows tool to look inside the linux .img file or I'd stick everything I need straight in there.
Thank you.
 
Last edited by a moderator:
Back
Top