Announcement

Collapse
No announcement yet.

RockChip ROM Building Tips and Tricks by Finless

Collapse
This is a sticky topic.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by blinkydamo View Post
    Thank you very much.

    I am not looking at releasing the rom, I am just looking at how its done and how to make them. If I get to a point where I think I can make a rom of my own then I will start from scratch.

    I would never tweak someone else's rom and call it my own, thats just wrong.

    Cheers blinky.

    Sent from my HTC Desire HD using Tapatalk
    Perfect.... I love a man with honor!

    Making your own personal ROM is OK. Have at 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


    • #17
      Originally posted by Finless View Post
      Do a google search for AFPTool. It is a standard RK29 tool. Make sure you get the one for RK29 and not RK28 as they are different. This tool will not only take all the .img's out of update.img but it will also make a update.img.

      If you cant find the tool let me know and I will upload the kit.

      Bob
      Could you please upload the kit?

      Comment


      • #18
        You can download it from this link.

        https://docs.google.com/file/d/0B8hU...mODdiZTQ1/edit

        This will unpack the image file into the seperate images. It worked for me.

        Good luck,

        Blinky

        Sent from my AN8G2 using Tapatalk

        Comment


        • #19
          Thanks Blinky!

          Thats the one. Even setup to run in Windows

          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


          • #20
            Yeah worked a treat, just got to figure out the linux side now.

            Is there a site you know of that supplies info on how to root a stock image file. Would like to try making my own rom from scratch before trying the harder stuff.

            I can strip the image into the individual files and can mount the system.img, past that its all new to me. Also i am a linux noob.

            Cheers in advance,

            Blinky

            Sent from my AN8G2 using Tapatalk

            Comment


            • #21
              Thanks

              Comment


              • #22
                Originally posted by blinkydamo View Post
                Yeah worked a treat, just got to figure out the linux side now.

                Is there a site you know of that supplies info on how to root a stock image file. Would like to try making my own rom from scratch before trying the harder stuff.

                I can strip the image into the individual files and can mount the system.img, past that its all new to me. Also i am a linux noob.

                Cheers in advance,

                Blinky

                Sent from my AN8G2 using Tapatalk
                No sorry there is NO ONE SITE I know that explains how to do this style of ROM. This is one reason I started this site
                The information to do a ROM of this style is spread all over the place! It took me weeks to learn it all.

                But Blinky.... Please.... Feel free to ask and I will teach you how to do it! I love someone that is willing to do it on their own! So trust me I will help you.

                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


                • #23
                  Originally posted by Finless View Post
                  OK so I know many want to learn.

                  So why no questions?
                  Please feel free to ask! I wont hold anything back.

                  Bob
                  Sure, I have a few questions

                  Are the offset values in the RKUpdate flash utility the default values, or did you have to set them to a value? At what point if any do you have to alter these?

                  My biggest curiosity is the "parameter" file with KERNEL_IMG. What sets these values, is it simiar to grub.conf in linux?

                  I'd eventually like to learn to build ICS on my polaroid tablet, I assume this is going to require a new kernel(3.01+), so the relevant portions of the older 2.6 rockchip gingerbread kernel will need to be ported to the newer kernel?

                  http://www.odys.de/downloads/softwar...SourceCode.zip

                  Will probably need a list of modules to build in to the kernel, like the realtek wifi?

                  Aside from getting the source from android, building it, and customizing the kernel for rk29xx what other action items need to happen to get it integrated into the rockchip flash utility?

                  Also, this thread is starting to get pretty long with multiple lessons, perhaps one lesson per thread and making this thread the parent topic would make it easier to find the relevant information that you're trying to find?

                  Thanks,

                  Eric

                  Comment


                  • #24
                    Question about boot.img

                    Hello,

                    I just recently purchased an Arnova 10 G2 Philly Inq edition for hacking on and I'm learning how to get up to speed with making my own roms and I'm able to unpack/modify/repack system.img files, but have run into issues with doing that for the boot.img file. I was wondering if you could give me any tips.

                    For example, I can take a working boot.img file and do the following (notice no modifications to files within, just a simple unpack/repack) and it bricks the tablet (i can quickly recover from bricks using rkflashtool under linux):

                    rkunpack boot.img
                    mkdir myboot
                    cd myboot
                    sudo gunzip < ../boot.img-raw | sudo cpio -i --make-directories
                    cd ..
                    mkcramfs myboot myboot-temp.img
                    rkcrc myboot-temp.img customboot.img

                    Now when I flash this:

                    sudo rkflashtool w 0x00008000 0x00002000 < customboot.img

                    The device is bricked (doesn't start up, screen stays blank).

                    Any ideas here? I would really appreciate some help -- I have a feeling this is second nature to you!

                    NOTE: to unbrick, I run the exact same rkflashtool command, but with a known working/originally unpacked boot.img (like the one in your rom, or the stock arnova one).

                    thanks,
                    -Neill.

                    Comment


                    • #25
                      The stock parameter file was very limited on available memory for installing apps. Like 255mb. Yes I modified the stock parameter file to give more user memory space. I took it up to 1 gig.

                      The parameter file is setup with each value being defined as: size@offset

                      For instance lets look the stock parameter file for the Arnova 10 G2:
                      mtdparts=rk29xxnand:0x00002000@0x00002000(misc),0x 00004000@0x00004000(kernel),0x00002000@0x00008000( boot),0x00004000@0x0000A000(recovery),0x00080000@0 x0000E000(system),0x00082000@0x0008E000(backup),0x 0003a000@0x00110000(cache),0x00100000@0x0014a000(u serdata),0x00002000@0x0024a000(kpanic),-@0x0024c000(user)

                      So from the start we have MISC which has a size of 2000 (hex) blocks. It's STARTS at block 2000 (not 0).
                      Now when we go to the kernel which is next in the list look at it's offset. MISC starts at 2000 and it's size is 2000. 2000+2000=4000 so that is where kernels offset starts. Now kernel is 4000 is size. So we now take the kernel offset of 4000 and add kernels size of 4000 = 8000. So the next one in the list is boot so it will start at 8000. And so on down the list.

                      The size is just made to hold the actual .img file size for:
                      boot.img
                      kernel.img
                      misc.img
                      revocery.img
                      system.img
                      backup.img which we really do not use on these ROMs but for some reason it needs to be there.
                      Yes they are larger than the actual .img file! Some speculate this is wasting memory so you could trim these down if you know you .img file size. However my testing shows the space can get used anyway (like leaving room for system to expand for rooted apps etc).

                      The other items in the parameter file set space up in memory for use by
                      cache system
                      kpanic (never mess with this)
                      userdata
                      and finally any remaining ram is "user" rame for flash storage (or sd card if you do not have one).

                      So in my parameter file to give more space I had to do to things
                      1) increase the space for userdata where apps get installed
                      2) Increase the system.img EXT4 file size for more space in /system for rooted apps and stuff (system apps).

                      To do this I had to move system deffinition to the end. The tablet would not boot otherwise.

                      So now that you know what you know
                      Here is the parameter file from my ROM.

                      mtdparts=rk29xxnand:0x00002000@0x00002000(misc),0x 00004000@0x00004000(kernel),0x00002000@0x00008000( boot),0x00004000@0x0000A000(recovery),0x00082000@0 x0000E000(backup),0x0003a000@0x00090000(cache),0x0 0200000@0x000ca000(userdata),0x00002000@0x002ca000 (kpanic),0x00080000@0x002cc000(system),-@0x0034c000(user)

                      As you can see the userdata size is now much larger (1gig) and system is moved to the end but before the left over user memory (flash).

                      Let me know if you have questions.

                      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


                      • #26
                        He Neill, Hope to see you get up to speed and join the team

                        So you said:

                        rkunpack boot.img
                        mkdir myboot
                        cd myboot
                        sudo gunzip < ../boot.img-raw | sudo cpio -i --make-directories
                        mkcramfs myboot myboot-temp.img
                        rkcrc myboot-temp.img customboot.img
                        OK rkunpck will unpack boot.img. but it should make the files and directories for you? I do not use rkunpack myself.

                        Understand boot.img is not a cramfs file system! The older rk28 tablets were and some others but for rk29 they changed that. So your problem is you should not be copying files into a cramfs file system to make boot.img.

                        Boot.img is nothing more the a gzip file with a header and footer (rkcrc)! Unless you strip off the header, gzip will complain it is not a valid gzip file. So I use DD to do that then unzip the file. Again rkunpack should do all this for you as well but let me explain my way:
                        Also see post #11 in this very thread.
                        http://www.freaktab.com/showthread.p...ull=1#post3541

                        You need to strip off the 8 by header. I use DD command.
                        dd if=boot.img of=bootimg.gz skip=8 bs=1 count=20000000

                        So the above command will make a .gz file (which boot.img is) by removing the 8 byte Android header. Now watch out for count. I make it larger than the actual file size. DD will hit the end of the file and stop anyway. But if you make count too small you wont get a full file.
                        Now unzip it. gz will complain of trailing garbage. That’s the footer. Don't worry about it. You now have boot.img all apart.

                        To make boot.img just gzip it back up again. However! There is something boot.img does not like inside of it. Touched dates on files!!!! You need to reset them. So here is how I make boot.img

                        I do this to reset the dates
                        sudo find . -exec touch -d "1970-01-01 01:00" {} \;

                        Then just zip it all up
                        sudo find . ! -name "."|sort|cpio -oa -H newc|gzip -n >../newboot.gz

                        Finally just add the CRC using rkcrc. NOTE: you need to have the rkcrc that supports the -k parameter. Some other versions out there only supported the -p. If you don’t have that version then once the crc is applied open the file in a hex editor and change the first for bytes from PARM to KRNL.
                        Anyway add the crc
                        ./rkcrc -k newboot.gz newboot.img

                        Hope this helps!

                        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


                        • #27
                          Originally posted by Finless View Post
                          He Neill, Hope to see you get up to speed and join the team

                          So you said:



                          OK rkunpck will unpack boot.img. but it should make the files and directories for you? I do not use rkunpack myself.

                          Understand boot.img is not a cramfs file system! The older rk28 tablets were and some others but for rk29 they changed that. So your problem is you should not be copying files into a cramfs file system to make boot.img.

                          Boot.img is nothing more the a gzip file with a header and footer (rkcrc)! Unless you strip off the header, gzip will complain it is not a valid gzip file. So I use DD to do that then unzip the file. Again rkunpack should do all this for you as well but let me explain my way:
                          Also see post #11 in this very thread.
                          http://www.freaktab.com/showthread.p...ull=1#post3541

                          You need to strip off the 8 by header. I use DD command.
                          dd if=boot.img of=bootimg.gz skip=8 bs=1 count=20000000

                          So the above command will make a .gz file (which boot.img is) by removing the 8 byte Android header. Now watch out for count. I make it larger than the actual file size. DD will hit the end of the file and stop anyway. But if you make count too small you wont get a full file.
                          Now unzip it. gz will complain of trailing garbage. That’s the footer. Don't worry about it. You now have boot.img all apart.

                          To make boot.img just gzip it back up again. However! There is something boot.img does not like inside of it. Touched dates on files!!!! You need to reset them. So here is how I make boot.img

                          I do this to reset the dates
                          sudo find . -exec touch -d "1970-01-01 01:00" {} \;

                          Then just zip it all up
                          sudo find . ! -name "."|sort|cpio -oa -H newc|gzip -n >../newboot.gz

                          Finally just add the CRC using rkcrc. NOTE: you need to have the rkcrc that supports the -k parameter. Some other versions out there only supported the -p. If you don’t have that version then once the crc is applied open the file in a hex editor and change the first for bytes from PARM to KRNL.
                          Anyway add the crc
                          ./rkcrc -k newboot.gz newboot.img

                          Hope this helps!

                          Bob
                          Wow, thanks, that was it! It properly addressed the gaps I was missing, and I'm providing my own instructions based on yours (assuming you have a working boot.img file already):

                          Code:
                          dd if=boot.img of=bootimg.gz skip=8 bs=1 count=20000000
                          mkdir myboot
                          cd myboot/
                          sudo gunzip < ../bootimg.gz | sudo cpio -i --make-directories
                          
                           .. DO CUSTOM EDITS HERE ...
                          
                          sudo find . -exec touch -d "1970-01-01 01:00" {} \;
                          sudo find . ! -name "." | sort | sudo cpio -oa -H newc | sudo gzip -n >../customboot.gz
                          cd ../
                          rkcrc -k customboot.gz customboot.img
                          
                          <<BOOT TABLET INTO FLASH MODE>>
                          
                          # write the new boot image
                          sudo rkflashtool w 0x00008000 0x00002000 < customboot.img
                          
                          # optionally reboot now
                          sudo rkflashtool b
                          You may have noticed that I modified one of the lines, as i was trying to avoid this warning:

                          Code:
                          $ sudo find . ! -name "."|sort|cpio -oa -H newc|gzip -n >../customboot.gz
                          cpio: ./default.prop: Cannot utime: Operation not permitted
                          cpio: ./init: Cannot open: Permission denied
                          cpio: ./init_battery.sh: Cannot open: Permission denied
                          cpio: ./init.goldfish.rc: Cannot open: Permission denied
                          cpio: ./initlogo.rle: Cannot utime: Operation not permitted
                          cpio: ./init.rc: Cannot open: Permission denied
                          cpio: ./init.rk29board.rc: Cannot open: Permission denied
                          cpio: ./rk29xxnand_ko.ko: Cannot utime: Operation not permitted
                          cpio: ./sbin/adbd: Cannot stat: Permission denied
                          cpio: ./sbin/sh: Cannot stat: Permission denied
                          cpio: ./sbin/ueventd: Cannot stat: Permission denied
                          cpio: ./ueventd.goldfish.rc: Cannot utime: Operation not permitted
                          cpio: ./ueventd.rc: Cannot utime: Operation not permitted
                          cpio: ./ueventd.rk29board.rc: Cannot utime: Operation not permitted
                          If I was running as root, all of the sudo commands could be removed, but since I wasn't, I had to add sudo in the appropriate places in that command.

                          Also, I got the following warning on this command:

                          Code:
                          sudo gunzip < ../bootimg.gz | sudo cpio -i --make-directories
                          
                          gzip: stdin: decompression OK, trailing garbage ignored
                          And I just wanted to note that while it's a warning, the resulting boot image is just fine!

                          Thanks again, Bob!

                          -Neill.

                          Comment


                          • #28
                            Your welcome Niell... Cant wait to see what you cook up

                            Yes as I said the warning from gzip is because of the footer (crc added at the end by rkcrc). It is just ignored.

                            Have fun,
                            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


                            • #29
                              Originally posted by Finless View Post
                              Your welcome Niell... Cant wait to see what you cook up
                              Please don't hold your breath -- SO many more questions! So at this point I'm able to build custom boot and system images, roll them into an update image and flash it properly. Things I'm still trying to understand are:

                              1) generating kernel.img (I'm very familar with compiling Linux kernels), but I haven't located the code for this board yet (driver combinations, etc). Any info or pointers there?

                              2) locating the android source that builds the default apks. I've got the android stock code and am familiar with things like compiling cyanogenmod for my HTC phone, but have not figured out how to target rockchip devices. help?

                              3) I'm also looking into your memory location modifications for re-arranging the parameter locations. I understand what's written where and what size it is, but haven't put it all together of how you know which ones can be resized for more usable space, etc. is that documented somewhere, or did you find that experimentally?

                              I realize I asked a lot of questions that are all over the place. If there's a better place to ask, just let me know! :-)

                              thanks,
                              -Neill.

                              Comment


                              • #30
                                Hehehhee..... many of us are looking for the source for kernels. We would love to have them!

                                kernel.img is the same as boot.img format but on extraction all you will have is kernel.bin. Not much use really as it is a compiled kernel.

                                As for APK's not sure about being directed at RK29? APKs (general apps) should not be hardware specific unless they are ROM specific like some of the ROM tools, or apps directed at specific hardware. Thats linux which is the core of Android.

                                For taking apart APKs and modding them might I suggest this youtube video:
                                http://www.youtube.com/watch?v=017pM...j2TYIBi3X8vexF

                                NOW WARNING! In some of our tablets the "system" apps are odex'ed. That is they consist of a .apk and a .odex file. So the APK tools out there wont work with this. You have to learn how to de-odex those APKs to make changes to them.

                                As for the parameter file. They all can be changed depending on what you want to do. As I said in my post above the parameter file specifies the area in "nand memory" to be reserved for loading a .img, or just making memory space for cache, user, etc. Think of it like a formatting file (or for a hard disk the MBR) It tells init how to setup memory (or the hard disk) to put things in and in what order.

                                Hope this helps,
                                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

                                Working...
                                X