Announcement

Collapse
No announcement yet.

some important tools for RK ROM Devs

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • some important tools for RK ROM Devs

    I've been meaning to post this for a while.

    As so far I've only worked rk chipsets this is rk dominated but thought I'd post this. It's a basic start, each of these tools could probably have a post or even a thread of it's own. I'll try and revisit this and extend the commentary on each tool and add more as appropriate.

    I hope it's of some use, you never know it may stop me asking Bob the same question repeatedly as I've forgotten (it's a bugger getting old).


    rkunpack use this to unpack backup.img files. A component of rkutils.

    Usage
    rkunpack backupfile

    link to post with download of rkutils


    unpack_all.sh use this to unpack an update.img file. A component of rkutils.

    Usage
    unpack_all.sh update.img destinationfolder


    rkcrc add an rk cyclic redundancy check to the beginning of a file. A part of rkutils.

    usage
    rkcrc -k sourcefile destfile


    split_bootimg.pl Splits an image into kernel and one or more ramdisks. Needed for some Boot and recovery img files

    usage
    split_bootimg.pl boot.img

    download here



    rkflashtool flash, read, write or reboot your tab, units are blocks of 512

    Usage
    rkflashtool r offset length >destfile
    rkflashtool w offset length <sourcefile
    rkflashtool b

    examples (read a kernel, write a kernel and reboot)
    rkflashtool r 0x4000 0x4000 >kernel.img
    rkflashtool w 0x4000 0x4000 <kernel.img
    rkflashtool b

    NB while these are the same values used in the parameter file the order is switched

    See this thread on XDA-Developers for the source and some good info on using it.

    http://forum.xda-developers.com/showthread.php?t=1286305

    Oh and lot's of linux, shell scipting, a bit of python, perl and java would come in handy.

    I hope it's of some use, you never know it may stop me asking Bob the same question repeatedly as I've forgotten (it's a bugger getting old).
    900Supersport

    900supersports FreakTab rkROMkitchen

    900supersports guide to working-RK-ROMs

    Under Construction 900supersports guide to working MediaTek ROMS

    Struggling for time at the moment, but will try and drop by when I can.

    If you would like to support my ROM development then please visit my Google site donate page where you can make a paypal donation

    freaktab developer

    Proof that you're never to old to learn. Sometimes too old to remember though.

  • #2
    Compiling the tools

    I'm just setting up a new laptop with 64 bit ubuntu so have had to download and re-compile these tools to work and thought I would post how I did it. I'm no expert when it comes to compiling c code but manage.

    1st up rkflashtool I downloaded the V2 source from xda-devopers and modified the source for rk3066 and 3188, any text editor will do, look through for the lines below

    Code:
        if (!(h = libusb_open_device_with_vid_pid(c, 0x2207, 0x290a)))
            if (!(h = libusb_open_device_with_vid_pid(c, 0x2207, 0x281a)))
                fatal("cannot open device\n");
    and change as follows

    Code:
        if (!(h = libusb_open_device_with_vid_pid(c, 0x2207, 0x300a)))
            if (!(h = libusb_open_device_with_vid_pid(c, 0x2207, 0x310b)))
                fatal("cannot open device\n");
    Save and we are ready for compile. Following the instructions from the first post on XDA we need to cd to the folder and enter

    Code:
    sudo apt-get install libusb-1.0-0-dev
    gcc -o rkflashtool rkflashtool.c -lusb-1.0 -O2 -W -Wall -s
    The first line gets and installs libusb-1.0.0-dev this is the usb library the code is built against. the second line compiles to the .c to an executable. For more info check the man page on gcc. I then copied the binary to an rktools folder, I like to keep the tools all in one place :-).

    Now onto rktools. Again download and unzip. Inspecting the contents of the unzipped folder I see some .c and .h files and also a Makefile. Opening the Makefile with an editor

    Code:
    CC=gcc
    CFLAGS := -g -O2 -DUSE_OPENSSL
    LDLIBS := -lcrypto
    
    
    TARGETS = afptool img_maker img_unpack rkkernel rkcrc
    SOURCES = afptool.c img_maker.c img_unpack.c rkkernel.c
    OBJECTS = afptool img_maker img_unpack rkkernel rkcrc
    PREFIX=/usr/local/bin
    
    
    all: $(TARGETS)
    	
    afptool:
    	$(CC) $(CFLAGS) -o afptool afptool.c $(LDLIBS)
    	
    img_maker:
    	$(CC) $(CFLAGS) -o img_maker img_maker.c $(LDLIBS)
    
    
    img_unpack:
    	$(CC) $(CFLAGS) -o img_unpack img_unpack.c $(LDLIBS)
    	
    rkkernel:
    	$(CC) $(CFLAGS) -o rkkernel rkkernel.c $(LDLIBS)
    	
    rkcrc:
    	$(CC) $(CFLAGS) -o rkcrc rkcrc.c $(LDLIBS)
    	
    clean: 
    	rm -rf $(OBJECTS) 
    	
    install:
    	install -m 0755 afptool $(PREFIX)/afptool
    	install -m 0755 img_maker $(PREFIX)/img_maker
    	install -m 0755 img_unpack $(PREFIX)/img_unpack
    	install -m 0755 rkkernel $(PREFIX)/rkkernel
    	install -m 0755 rkcrc $(PREFIX)/rkcrc
    This is a set of instructions to automatically make the binaries and by the looks of things install them to usr/local/bin. I prefer to have the tools in a central folder and create symlinks in usr/lib/bin. To facilitate this I have deleted the install section.

    To build the tools cd to the folder and enter

    Code:
    make
    this should make the binaries according to the make file. You may get some warnings but there should be no errors. If you do get errors it's likely you are missing libraries. A search on google will normally turn up details of the required packages. these can be installed either using apt-get or the Ubuntu Software Centre.

    Finally onto rkutils. Again download and unzip. This time I see no Makefile so I copied and edited the makefile from above. My Makefile is as follows.

    Code:
    CC=gcc
    CFLAGS := -g -O2 -DUSE_OPENSSL
    LDLIBS := -lcrypto
    
    
    TARGETS = rkafpack rkcrc rkdump rkflash rkunpack
    SOURCES = rkafpack.c rkcrc.c rkdump.c rkflash.c rkunpack.c
    OBJECTS = rkafpack rkcrc rkdump rkflash rkunpack
    
    
    
    
    all: $(TARGETS)
    	
    rkafpack:
    	$(CC) $(CFLAGS) -o rkafpack rkafpack.c $(LDLIBS)
    	
    rkcrc:
    	$(CC) $(CFLAGS) -o rkcrc rkcrc.c $(LDLIBS)
    
    
    rkdump:
    	$(CC) $(CFLAGS) -o rkdump rkdump.c $(LDLIBS)
    	
    rkflash:
    	$(CC) $(CFLAGS) -o rkflash rkflash.c $(LDLIBS)
    	
    rkunpack:
    	$(CC) $(CFLAGS) -o rkunpack rkunpack.c $(LDLIBS)
    	
    clean: 
    	rm -rf $(OBJECTS)
    Make this and copy as above.

    Hope this is of some use.
    900Supersport

    900supersports FreakTab rkROMkitchen

    900supersports guide to working-RK-ROMs

    Under Construction 900supersports guide to working MediaTek ROMS

    Struggling for time at the moment, but will try and drop by when I can.

    If you would like to support my ROM development then please visit my Google site donate page where you can make a paypal donation

    freaktab developer

    Proof that you're never to old to learn. Sometimes too old to remember though.

    Comment


    • #3
      Hi 900Supersport,

      Wondering if I could pick your brain a little please.

      I am in the process of setting up the kitchen but am stumbling into problem and I don't understand what they mean. I am running Ubuntu 64Bit on a VMware install.

      During the compiling of the rkflashtool after I have edited the .c file as you state I receive the following error:
      Code:
      blinky@ubuntu:~$ sudo apt-get install libusb-1.0-0-dev
      [sudo] password for blinky: 
      Reading package lists... Done
      Building dependency tree       
      Reading state information... Done
      libusb-1.0-0-dev is already the newest version.
      0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
      
      blinky@ubuntu:~/Downloads$ gcc -o rkflashtool rkflashtool.c -lusb-1.0 -O2 -W -Wall -s
      rkflashtool.c: In function ‘main’:
      rkflashtool.c:161:18: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
      rkflashtool.c:171:17: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
      After that could you clear up what you mean may you have removed the install commands in the rktools makefile, did you install these, if so how? Or can I leave the makefile as it is?

      After this part I tried the rk-tools and received this error:
      Code:
      blinky@ubuntu:~/Downloads/rk-tools-master$ make
      gcc -g -O2 -DUSE_OPENSSL -o afptool afptool.c -lcrypto
      /usr/bin/ld: cannot find -lcrypto
      collect2: error: ld returned 1 exit status
      make: *** [afptool] Error 1
      Again I have no idea what this means.

      Now I am not completely at a loss as I have managed to unpack the image for my Hudl into the separate images and then transfer them onto the virtual machine and have even been able to access the images using your kitchen

      I do have some questions regarding the kitchen but figure it would be better if I get everything setup before venturing down that path.

      I fully understand if you don't have the time to answer the questions and I will admit I have very little knowledge of linux, but I have a hankering for getting a complete custom rom with custom kernel up and running on the Hudl. It's not a bad piece of kit and could be made to run really well if someone puts some time into it.

      If you could shed some light and are willing to guide me a little I would be grateful,

      Cheers in advance,

      Blinky

      Comment


      • #4
        I'll try and answer these questions later tonight, may have to go out and do family stuff though.

        In brief I think you have rkflashtool ok as just warnings.

        lcrpto will need installing, time for google.

        I removed the instal lines from the make file so I can control the final location.

        As far as my kitchen goes rkflashtool is nice to have.

        rkcrc and rkunpack are required. I've just implemented both of these in python and will be updating the kitchen shortly to use these to reduce the need for compilation.

        Sent from my XT890 using Tapatalk
        900Supersport

        900supersports FreakTab rkROMkitchen

        900supersports guide to working-RK-ROMs

        Under Construction 900supersports guide to working MediaTek ROMS

        Struggling for time at the moment, but will try and drop by when I can.

        If you would like to support my ROM development then please visit my Google site donate page where you can make a paypal donation

        freaktab developer

        Proof that you're never to old to learn. Sometimes too old to remember though.

        Comment


        • #5
          for the lcrypto error try installing GNOME crypto services from the ubuntu Software Centre
          900Supersport

          900supersports FreakTab rkROMkitchen

          900supersports guide to working-RK-ROMs

          Under Construction 900supersports guide to working MediaTek ROMS

          Struggling for time at the moment, but will try and drop by when I can.

          If you would like to support my ROM development then please visit my Google site donate page where you can make a paypal donation

          freaktab developer

          Proof that you're never to old to learn. Sometimes too old to remember though.

          Comment


          • #6
            Cheers, will have a look into the crypto tomorrow night, just finished work and got uni tomorrow.

            Will have a look and see if it solves the problem.

            Cheers

            Blinky

            Comment


            • #7
              hey 900supersport - quick one

              Originally posted by 900supersport View Post
              for the lcrypto error try installing GNOME crypto services from the ubuntu Software Centre
              I am having software issues with my PipoM9Ppro. I have used RileyRoms (1.3 - 2.1) and I still have issues where the RockChip MultiWindow just turns on itself. Plus I just dont like it or want to use it.
              Can I and How Can I rmove this RK system app saftely?

              Thanks
              PipoM9Pro
              People who think they know everything are a great annoyance to those of us who do.

              Comment


              • #8
                Have you tried editing build prop, change the following to false and see if that sorts the issue.

                ro.rk.multi_window=true
                900Supersport

                900supersports FreakTab rkROMkitchen

                900supersports guide to working-RK-ROMs

                Under Construction 900supersports guide to working MediaTek ROMS

                Struggling for time at the moment, but will try and drop by when I can.

                If you would like to support my ROM development then please visit my Google site donate page where you can make a paypal donation

                freaktab developer

                Proof that you're never to old to learn. Sometimes too old to remember though.

                Comment


                • #9
                  thanks supersport 900, just changed it---rebooted...hope it works... appreciate it man....how's the ducati going....(love bikes)

                  Dispatcher: QuadCore M9Pro Powered by a FreakTab Custom ROM
                  People who think they know everything are a great annoyance to those of us who do.

                  Comment


                  • #10
                    The Ducati goes well thanks, though not ideal for winter.
                    900Supersport

                    900supersports FreakTab rkROMkitchen

                    900supersports guide to working-RK-ROMs

                    Under Construction 900supersports guide to working MediaTek ROMS

                    Struggling for time at the moment, but will try and drop by when I can.

                    If you would like to support my ROM development then please visit my Google site donate page where you can make a paypal donation

                    freaktab developer

                    Proof that you're never to old to learn. Sometimes too old to remember though.

                    Comment


                    • #11
                      not in the build prop

                      Originally posted by 900supersport View Post
                      Have you tried editing build prop, change the following to false and see if that sorts the issue.

                      ro.rk.multi_window=true
                      Hey SuperSport900.
                      I have looked high and low many times in the build prop and that line rk.multi_window=true
                      Does not exist in my build prop (Pipo M9 PRo with Finless 1.4 latest ROM).

                      Any thoughts!
                      People who think they know everything are a great annoyance to those of us who do.

                      Comment


                      • #12
                        Originally posted by PipoM9Pro View Post
                        Hey SuperSport900.
                        I have looked high and low many times in the build prop and that line rk.multi_window=true
                        Does not exist in my build prop (Pipo M9 PRo with Finless 1.4 latest ROM).

                        Any thoughts!
                        I did add that line in build.prop for my 1.4 ROM so your missing it.

                        Bob
                        "Pzebacz im, bo nie wiedzą, co czynią"
                        "Прости им, они не ведают, что творят"
                        "Perdona loro perché non sanno quello che fanno"
                        "Vergib ihnen, denn sie wissen nicht, was sie tun"
                        "Vergeef hen want ze weten niet wat ze doen"
                        "Pardonne-leur car ils ne savent pas ce qu'ils font"
                        "Perdónalos porque no saben que lo que hacen"
                        "Oprosti im, jer ne znaju što čine"
                        "Forgive them as they know not what they do"





                        Comment


                        • #13
                          Originally posted by 900supersport View Post
                          I'll try and answer these questions later tonight, may have to go out and do family stuff though.

                          In brief I think you have rkflashtool ok as just warnings.

                          lcrpto will need installing, time for google.

                          I removed the instal lines from the make file so I can control the final location.

                          As far as my kitchen goes rkflashtool is nice to have.

                          rkcrc and rkunpack are required. I've just implemented both of these in python and will be updating the kitchen shortly to use these to reduce the need for compilation.

                          Sent from my XT890 using Tapatalk

                          apt-get install libssl-dev
                          should resolve the -lcrypto error.

                          Comment


                          • #14
                            how can i use these commands

                            Originally posted by 900supersport View Post
                            I've been meaning to post this for a while.

                            As so far I've only worked rk chipsets this is rk dominated but thought I'd post this. It's a basic start, each of these tools could probably have a post or even a thread of it's own. I'll try and revisit this and extend the commentary on each tool and add more as appropriate.

                            I hope it's of some use, you never know it may stop me asking Bob the same question repeatedly as I've forgotten (it's a bugger getting old).


                            rkunpack use this to unpack backup.img files. A component of rkutils.

                            Usage
                            rkunpack backupfile

                            link to post with download of rkutils


                            unpack_all.sh use this to unpack an update.img file. A component of rkutils.

                            Usage
                            unpack_all.sh update.img destinationfolder


                            rkcrc add an rk cyclic redundancy check to the beginning of a file. A part of rkutils.

                            usage
                            rkcrc -k sourcefile destfile


                            split_bootimg.pl Splits an image into kernel and one or more ramdisks. Needed for some Boot and recovery img files

                            usage
                            split_bootimg.pl boot.img

                            download here



                            rkflashtool flash, read, write or reboot your tab, units are blocks of 512

                            Usage
                            rkflashtool r offset length >destfile
                            rkflashtool w offset length <sourcefile
                            rkflashtool b

                            examples (read a kernel, write a kernel and reboot)
                            rkflashtool r 0x4000 0x4000 >kernel.img
                            rkflashtool w 0x4000 0x4000 <kernel.img
                            rkflashtool b

                            NB while these are the same values used in the parameter file the order is switched

                            See this thread on XDA-Developers for the source and some good info on using it.

                            http://forum.xda-developers.com/showthread.php?t=1286305

                            Oh and lot's of linux, shell scipting, a bit of python, perl and java would come in handy.

                            I hope it's of some use, you never know it may stop me asking Bob the same question repeatedly as I've forgotten (it's a bugger getting old).
                            Sir.
                            How can I use these commands on window 7 ? can i backup rom when my tablet is hang on logo and not working and could restore backup firmware again ?

                            Comment


                            • #15
                              Unless otherwise indicated these tools are Linux specific. If the tablet is hung at the boot logo i don't think you will be able to extract a backup.
                              900Supersport

                              900supersports FreakTab rkROMkitchen

                              900supersports guide to working-RK-ROMs

                              Under Construction 900supersports guide to working MediaTek ROMS

                              Struggling for time at the moment, but will try and drop by when I can.

                              If you would like to support my ROM development then please visit my Google site donate page where you can make a paypal donation

                              freaktab developer

                              Proof that you're never to old to learn. Sometimes too old to remember though.

                              Comment

                              Working...
                              X