Editing the read-only parts of an image

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Devilfish
    Administrator
    • Feb 2008
    • 7872

    #1

    Editing the read-only parts of an image

    Enigma images are created in such a way that there is a read-only section of the image and read/write section. The /var folder and /tmp folder is the old folders in an image that you can edit. If, for any reason, you want to edit the read-only folders, i.e. /bin, /etc, /lib, /share, etc. this is what you'll need to do.

    First of all, you'll need a linux platform to make your changes. This could be a PC with a linux OS, i.e. Ubuntu, or you could have a program called VMWare which is a virtual machine that allows you to run a different OS from within an existing OS. It's up to you which one you choose and I will not go into setting it up in this thread.

    Telnet to the dreambox...
    username: root
    password: dreambox

    Follow these commands...

    Code:
     mkdir /var/tmp/root
    Code:
     mount -t squashfs -o ro /dev/mtdblock/5 /var/tmp/root
    Code:
     cd /var/tmp
    Code:
     tar -cf root.tar root
    FTP the root.tar to your linux desktop and open a terminal.
    Code:
    cd Desktop
    Code:
     tar -xf root.tar
    Leave the terminal window open.

    Treat the root folder on the desktop as the box itself but don't add or change anything in /var because that is a different location.

    When you have finished go back to the terminal window and...

    Code:
     ./mksquashfs root mtd5.img -be
    Then ftp the mtd5.img back to the box. You will need a copy of mksquashfs on the Desktop to be able to perform this command.

    Telnet back to the box and...

    Code:
     cd /tmp && eraseall /dev/mtd/5 && cp mtd5.img /dev/mtd/5 && reboot
    Done.

    To check what mtd# ...
    Code:
    more /proc/mtd
    ...but most squashfs are mtd5.

    Njoy!
    Last edited by Devilfish; 27 December, 2008, 05:02.
  • mattwills71187
    Newbie
    • Aug 2008
    • 4

    #2
    is there anyway to do this from a Pc running on windows

    Comment

    • beady
      Junior Member
      • Jul 2008
      • 27

      #3
      is there anyway to do this from a Pc running on windows
      No, but you can install a virtual linux machine, using e.g. vmware, and do it from there. It's fairly easy to set up, and there's plenty of guides on the interweb.

      Comment

      • ronlkh
        Member
        • May 2008
        • 74

        #4
        can anyone please tell me if this method works? I have tested so many times but not working. I have done and follow devilfish's instruction. I am able to produce mtd5.img but when I flash back to the box, the box dont work at all. Can someone please advise me?

        Thanks

        Comment

        • DavC
          Top Poster
          • May 2008
          • 117

          #5
          will this method work for neutrino on the dbox as well?

          Comment

          • mrdude
            V.I.P. Member
            • Jul 2008
            • 110

            #6
            Originally posted by ronlkh
            can anyone please tell me if this method works? I have tested so many times but not working. I have done and follow devilfish's instruction. I am able to produce mtd5.img but when I flash back to the box, the box dont work at all. Can someone please advise me?

            Thanks
            Yes of course it works - This is the exact method I used to make the moddified jade image I posted in here.
            Suck my plums

            Comment

            • ronlkh
              Member
              • May 2008
              • 74

              #7
              must I umount the root and delete the root.tar before I flash the new mtd5.img?

              Thanks

              Comment

              • ronlkh
                Member
                • May 2008
                • 74

                #8
                What I am running is vmware + ubuntu 8.04.

                First I telnet to the dm500 from ubuntu terminal
                then I make directory
                root@dm500 ~ #mkdir /var/tmp/root
                root@dm500 ~ #mount -t squashfs -o ro /dev/mtdblock/5 /var/tmp/root
                root@dm500 ~#cd /var/tmp
                root@dm500 /tmp #tar -cf root.tar root
                root@dm500 /tmp #
                then I open another terminal to ftp to dm500
                root@ubuntu8041:/home/user/Desktop# ftp 192.168.0.112
                Connected to 192.168.0.112.
                220 Welcome to the PLi dreambox FTP server
                Name (192.168.0.112:user): root
                331 Please specify the password.
                Password:
                230 Login successful.
                Remote system type is UNIX.
                Using binary mode to transfer files.
                ftp> cd /tmp
                250 Directory successfully changed.
                ftp> get root.tar
                ftp>bye
                root@ubuntu8041:/home/user/Desktop# tar -xf root.tar
                root@ubuntu8041:/home/user/Desktop# ./mksquashfs root mtd5.img
                I mksquashfs back the original root and a new mtd5.img is created.
                then I ftp back to dm500
                root@ubuntu8041:/home/user/Desktop# ftp 192.168.0.112
                Connected to 192.168.0.112.
                220 Welcome to the PLi dreambox FTP server
                Name (192.168.0.112:user): root
                331 Please specify the password.
                Password:
                230 Login successful.
                Remote system type is UNIX.
                Using binary mode to transfer files.
                ftp> cd /tmp
                250 Directory successfully changed.
                ftp> put mtd5.img
                ftp>bye
                exit back to Desktop and telnet back to the box
                i change the directory to /tmp
                root@ubuntu8041:/home/user/Desktop# telnet 192.168.0.112
                Trying 192.168.0.112...
                Connected to 192.168.0.112.
                Escape character is '^]'.

                PLi dm500 Jade 20080718 (based on 1.09)
                welcome on your dreambox! - Kernel 2.6.9 (13:08:41).
                dm500 login: root
                Password:


                BusyBox v1.01 (2008.07.11-10:44+0000) Built-in shell (ash)
                Enter 'help' for a list of built-in commands.

                root@dm500 ~ # cd /tmp && eraseall /dev/mtd/5 && cp mtd5.img /dev/mtd/5 && reboot

                after image flashed dm500 reboot but dm500 is dead

                I did not umount the root directory in the /var/tmp nor I have deleted the root.tar

                Have I done anything wrong?

                Comment

                • Devilfish
                  Administrator
                  • Feb 2008
                  • 7872

                  #9
                  On a working image, do a 'more /proc/mtd' in telnet and see what it says.

                  Comment

                  • ronlkh
                    Member
                    • May 2008
                    • 74

                    #10
                    Hi Devilfish,
                    What I got is :-

                    root@dm500 ~ # more /proc/mtd
                    dev: size erasesize name
                    mtd0: 00600000 00020000 "DreamBOX cramfs+squashfs"
                    mtd1: 001c0000 00020000 "DreamBOX jffs2"
                    mtd2: 00040000 00020000 "DreamBOX OpenBIOS"
                    mtd3: 007c0000 00020000 "DreamBOX (w/o bootloader)"
                    mtd4: 00800000 00020000 "DreamBOX (w/ bootloader)"
                    mtd5: 004e0000 00020000 "DreamBOX SquashedFS"
                    mtd6: 00120000 00020000 "DreamBOX Cramfs"

                    thanks

                    Comment

                    • Devilfish
                      Administrator
                      • Feb 2008
                      • 7872

                      #11
                      That looks right, was just checking that the squashfs part was indeed mtd5. Not sure what else to suggest. Maybe try a totally different image.

                      Comment

                      • unai_goiko
                        Newbie
                        • Sep 2008
                        • 1

                        #12
                        Hello there! I've just found this forum and have to say that i'm impress with it

                        Continuing with the thread, I'm having the same problem as ronlkh here. I followed the steps explained by Devilfish except from the part of using a mksquashfs binnary copied on the Desktop. I used the mksquashfs binnary from ubuntu instead. Then, after rebooting, the dreambox does not respond and i get a black screen...

                        I've read that squashfs-lzm is used for building most of the dreambox images, shouldn't will be using that program? Thanks in advance!

                        Comment

                        • ajeeb
                          Newbie
                          • Jan 2009
                          • 12

                          #13
                          hi,
                          this is gr8 topic tested with gemini4.6 not work (Black screen after reboot)
                          I do exactly same steps said Devilfish

                          BR

                          Comment

                          • Devilfish
                            Administrator
                            • Feb 2008
                            • 7872

                            #14
                            I followed these steps about a month ago to edit /var_init on an image so that certain files stayed there after a factory reset and it worked 100%.

                            Maybe the SquashedFS partition is not mtd5 on a Gemini image, I'm not sure, but I imagine it would be the same.

                            Comment

                            • ajeeb
                              Newbie
                              • Jan 2009
                              • 12

                              #15
                              hi I get this
                              root@dreambox:~> more /proc/mtd
                              dev: size erasesize name
                              mtd0: 00500000 00020000 "DreamBOX cramfs+squashfs"
                              mtd1: 002c0000 00020000 "DreamBOX jffs2"
                              mtd2: 00040000 00020000 "DreamBOX OpenBIOS"
                              mtd3: 007c0000 00020000 "DreamBOX (w/o bootloader)"
                              mtd4: 00800000 00020000 "DreamBOX (w/ bootloader)"
                              mtd5: 003e0000 00020000 "DreamBOX SquashedFS"
                              mtd6: 00120000 00020000 "DreamBOX Cramfs"

                              I tried only to change a font in /share !!!

                              thanks

                              Comment

                              Working...