Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

900supersports guide to working MediaTek ROMs

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

    900supersports guide to working MediaTek ROMs

    I've been asked to post a thread on reworking MediaTek ROMs so here goes.

    I'm basing this on my experience with Cube's Talk 9x U65GT and my thl T11 phone, these are both Octa core SOCs being MT8392 and MT8592.

    Firstly a quick overview of the files that go towards making the ROM.
    boot.img this image contains the kernel and a compressed file system/RAM disk. We'll use a Perl script under Linux to unpack and repack the image. In between we will make some simple changes to init.rc
    system.img this is the file system you will see on the android device mounted at /system. It is a sparse image, we will use simg2ing under Linux to extract the sparse image to a file that can be mounted as an ext4 file system. After making some changes we will repack this as a sparse image.
    recovery.img like boot.img recovery.img contains a kernel and a compressed file system/Ram disk. We will use mtk droid root tools under windows (sorry) to make a CWM Recovery from the source files.
    EBR1 and EBR2 these are Extended Boot Records and control how the memory of the device is allocated. We will cover making some changes to these files as well as using a python script to edit them for us. These files must be worked as a pair.
    logo.bin this file contains a number of graphics including the first two displayed during the boot sequence prior to the boot animation. We will use a logobuilder under windows to unpack the images, edit them using mspaint or other tool and then repack.
    It will take me a number of days and posts to cover this so initially I'll keep the thread locked and open it up once I've covered the above, in the mean time stay tuned.

    Credits

    I assembled my toolkit for working MTK ROMs some time ago, to the best of my recolection the following credits are due

    DjoDjo for http://web.djodjo.org/?a=download:an...inux:ext4tools make_ext4fs, simg2img, img2simg, simg_dump.py, mkuserimg.sh, ext4fixup

    Bruno Martins https://github.com/bgcngm/mtk-tools unpack-MT65xx.pl, repack-MT65xx

    rua1 MTKDroidRootTools http://forum.xda-developers.com/show....php?t=2160490

    Ghost45 and keanu_ritz for background on EBR files, see http://forum.xda-developers.com/show....php?t=2455850 and http://forum.xda-developers.com/show....php?t=2771318 respectively

    rrileypm for pointing me at https://sites.google.com/site/kadanu...logobuilder-en and zvoddy33 for reminding me in this post http://www.freaktab.com/showthread.p...l=1#post224062

    Abdul_pt for some early advice and pointers on MediaTek SOCs all the devs here at Freaktab who are always ready to help and share information

    Brian


    Why Linux?
    Two reasons really: I prefer Linux especially as compared to windows 8, in addition android is based on Linux, any effort put into Linux will help with android.
    Last edited by 900supersport; 09-18-2014, 09:54.
    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
    Some Preparation

    Download the tools from the following sites and place them in a folder mtktools in your home folder

    DjoDjo http://web.djodjo.org/?a=download:an...inux:ext4tools

    Bruno Martins https://github.com/bgcngm/mtk-tools

    Code blocks as below contain instructions entered in a terminal window, here I make a directory (folder), choose it as the current directory and finally use ls to list the contents of the directory. I'll leave it to you to copy the required files either from the command line or using a file manager such as nautilus. We'll make extensive use of the terminal while in Linux. One of the first apks I tend to install after flashing a new ROM is a terminal emulator as I use it to review and alter the file system.

    Code:
    [email protected]:~$ mkdir mtktools
    [email protected]:~$ cd mtktools/
    
    ...
    [email protected]:~/mtktools$ ls
    ext4fixup  make_ext4fs  mkuserimg.sh  repack-MT65xx.pl  simg_dump.py
    img2simg   mkbootimg    nbimg         simg2img          unpack-MT65xx.pl
    [email protected]:~/mtktools$
    Now we need to create some symlinks to make life easier for us, we will do something similar when we are editing system.img.

    The example below creates a symlink /usr/local/bin/simg2img pointing at /home/brian/mtktools/simg2img. Note brian is my username. Sudo is used as root priveleges are required to write to /usr/local/bin/. We create our symlinks in /usr/local/bin as they can then be used without specifying the path

    Code:
    [email protected]:~$ sudo ln -s /home/brian/mtktools/simg2img /usr/local/bin/simg2img
    [sudo] password for brian: 
    [email protected]:~$ simg2img
    Usage: simg2img <sparse_image_files> <raw_image_file>
    [email protected]:~$
    likewise create the remainder of the symlinks
    sudo ln -s /home/brian/mtktools/ext4fixup /usr/local/bin/ext4fixup
    sudo ln -s /home/brian/mtktools/img2simg /usr/local/bin/img2simg
    sudo ln -s /home/brian/mtktools/make_ext4fs /usr/local/bin/make_ext4fs
    sudo ln -s /home/brian/mtktools/mkbootimg /usr/local/bin/mkbootimg
    sudo ln -s /home/brian/mtktools/mkuserimg.sh /usr/local/bin/mkuserimg.sh
    sudo ln -s /home/brian/mtktools/repack-MT65xx.pl /usr/local/bin/repack-MT65xx.pl
    sudo ln -s /home/brian/mtktools/unpack-MT65xx.pl /usr/local/bin/unpack-MT65xx.pl

    All that remains is to create ourselves a folder to work in and get a ROM to work.

    To make life easy lets create these folders now and populate the sourceROM folder

    Code:
    [email protected]:~/mtktools$ cd ~
    [email protected]:~$ mkdir 900ssWorking
    [email protected]:~$ mkdir sourceROM
    ...
    [email protected]:~$ ls -l sourceROM/
    total 785960
    -rw-r--r-- 1 brian brian    162763 Sep  2 14:44 APDB_MT6592_S01_KK1.MP1_
    -rw-r--r-- 1 brian brian   5881856 Sep 10 21:15 boot.img
    -rw-r--r-- 1 brian brian   5562291 Sep  2 14:44 BPLGUInfoCustomAppSrcP_MT6592_S00_MOLY_WR8_W1315_MD_WG_MP_V39_P1_1_wg_n
    -rw-r--r-- 1 brian brian   4765437 Sep  2 14:44 BPLGUInfoCustomAppSrcP_MT6592_S00_MOLY_WR8_W1328_MD_TG_MP_V18_1_tg_n
    -rw-r--r-- 1 brian brian   6348948 Sep  2 14:43 cache.img
    -rw-r--r-- 1 brian brian       287 Sep 10 18:31 Checksum.ini
    -rw-r--r-- 1 brian brian        10 Sep  2 14:43 custom_build_verno
    -rw-r--r-- 1 brian brian       512 Jul  8 19:33 EBR1
    -rw-r--r-- 1 brian brian       512 Jul  8 19:31 EBR2
    -rw-r--r-- 1 brian brian    238928 Sep  2 14:43 lk.bin
    -rw-r--r-- 1 brian brian    715165 Sep 10 18:28 logo.bin
    -rw-r--r-- 1 brian brian       512 Sep  2 14:43 MBR
    -rw-r--r-- 1 brian brian      7683 Sep  2 14:43 MT6592_Android_scatter.txt
    -rw-r--r-- 1 brian brian    119444 Sep  2 14:43 preloader_htt92_tb_tdw_kk.bin
    -rw-r--r-- 1 brian brian   6242304 Sep  2 14:43 recovery.img
    -rw-r--r-- 1 brian brian    135168 Sep  2 14:43 secro.img
    -rw-r--r-- 1 brian brian 738242420 Sep 10 21:06 system.img
    -rw-r--r-- 1 brian brian  36356808 Sep  2 14:44 userdata.img
    [email protected]:~$
    Last edited by 900supersport; 09-18-2014, 18:04.
    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
      unpacking and repacking system.img

      unpacking and repacking system.img

      Assuming you have gone through the preparations outlined earlier then you should be able to stert a terminal, select out working folder then convert the spars image to an ext4 image as follows.


      Code:
      [email protected]:~$ cd 900ssWorking/
      [email protected]:~/900ssWorking$ simg2img ../sourceROM/system.img system.img.ext4
      [email protected]:~/900ssWorking$ ls -l
      total 720920
      -rw-rw-r-- 1 brian brian 2147483648 Sep 18 16:55 system.img.ext4
      [email protected]:~/900ssWorking$
      The syntax of simg2img is
      simg2img <sparse_image_files> <raw_image_file>
      Now we have an ext4 file system lets see about mounting it, first we will create a directory too use as a mount point and then mount our file system to it.

      Code:
      [email protected]:~/900ssWorking$ mkdir mntsystem
      [email protected]:~/900ssWorking$ sudo mount -t ext4 -o loop system.img.ext4 mntsystem/
      [sudo] password for brian: 
      [email protected]:~/900ssWorking$ ls -l mntsystem/
      total 108
      drwxr-xr-x  2 root root  4096 Sep 10 21:00 app
      drwxr-xr-x  2 root 2000  4096 Sep  2 02:40 bin
      -rw-r--r--  1 root root  4277 Sep 10 21:00 build.prop
      drwxr-xr-x  2 root root  4096 Sep  2 06:57 data
      drwxr-xr-x 19 root root  4096 Sep 10 21:00 etc
      drwxr-xr-x  2 root root  4096 Sep  2 07:10 fonts
      drwxr-xr-x  3 root root  4096 Sep  2 02:40 framework
      drwxr-xr-x  8 root root 12288 Sep  2 02:40 lib
      drwxr-xr-x  2 root root  4096 Jan  1  1970 lost+found
      drwxr-xr-x  5 root root  4096 Sep  2 07:04 media
      drwxr-xr-x  2 root root  4096 Sep  2 07:04 mobile_toolkit
      drwxr-xr-x  2 root root  4096 Sep  2 07:31 priv-app
      drwxr-xr-x  4 root root  4096 Sep  2 06:58 res
      drwxr-xr-x  2 root root  4096 Sep 10 18:15 thirdparty
      drwxr-xr-x  3 root root  4096 Sep  2 06:58 tts
      drwxr-xr-x  8 root root  4096 Sep  2 07:03 usr
      drwxr-xr-x  4 root 2000  4096 Sep  2 02:40 vendor
      drwxr-xr-x  2 root 2000  4096 Sep  2 07:27 xbin
      [email protected]:~/900ssWorking$

      Let's look at what is going on here, we
      1. create a directory as a mount point
      2. mount system.img.ext4 to the mount point mntsystem/ as root -t ext4 specifies that the file system should be mounted as an ext4 file system and -o specifies options, in this case a loop device
      3. ls the contents of mntsystem

      Mounting a file system like this requires elevated permissions hence the use of root. For more info on mount try mount -h, man mount or google Linux mount

      Occasionally its useful to use a file browser to explore our mounted file system, you can use

      Code:
      [email protected]:~/900ssWorking$ sudo nautilus mntsystem/
      
      
      (nautilus:2801): Gtk-WARNING **: Failed to register client: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
      Nautilus-Share-Message: Called "net usershare info" but it failed: 'net usershare' returned error 255: net usershare: cannot open usershare directory /var/lib/samba/usershares. Error No such file or directory
      Please ask your system administrator to enable user sharing.

      Note the warning, I ignore these and have no problems but it would be good to get an explanation/resolution from a linux guru.

      At this point it would be good to make a minor change so lets edit build prop. We will keep the change very simple for the moment, maybe just language and region as follows

      ro.product.locale.language=en
      ro.product.locale.region=GB
      so enter the following, find and edit the two lines, save and close gedit.

      Code:
      [email protected]:~/900ssWorking$ gksudo gedit mntsystem/build.prop 
      [email protected]:~/900ssWorking$
      Note I've used gksudo rather that sudo, some sources recon this is better for graphical apps that sudo, again I'll leave this to the Linux gurus to explain.

      So now we have edited our system file system we can see if we can repack, tidy up and then flash and test. To do this we will use make_ext4fs, lets take a quick look at this

      Code:
      [email protected]:~/900ssWorking$ make_ext4fs 
      Expected filename after options
      make_ext4fs [ -l <len> ] [ -j <journal size> ] [ -b <block_size> ]
          [ -g <blocks per group> ] [ -i <inodes> ] [ -I <inode size> ]
          [ -L <label> ] [ -f ] [ -a <android mountpoint> ]
          [ -S file_contexts ]
          [ -z | -s ] [ -w ] [ -c ] [ -J ] [ -v ]
          <filename> [<directory>]
      There have quite a few options here, we will use
      -a system - to specify the android mount point as system
      -s - to be honest I cannot say for certain about this one other than that it works
      -l <len> - to specifiy the size we want the ext4 file system to be.

      to find the size we could ls -l and read the value but I'll use a slightly different approach, this looks more complicated but later on you will see the benefit. Use stat -h, man stat or google for more info.

      Code:
      [email protected]:~/900ssWorking$ stat -c %s system.img.ext4 
      2147483648
      [email protected]:~/900ssWorking$ sudo make_ext4fs -s -l 2147483648 -a system ../sourceROM/system.img.cust mntsystem/
      [sudo] password for brian: 
      Creating filesystem with parameters:
          Size: 2147483648
          Block size: 4096
          Blocks per group: 32768
          Inodes per group: 8192
          Inode size: 256
          Journal blocks: 8192
          Label: 
          Blocks: 524288
          Block groups: 16
          Reserved block group size: 127
      Created filesystem with 2444/131072 inodes and 188546/524288 blocks
      [email protected]:~/900ssWorking$
      So hopefully we now have a new system image (system.img.cust) ready for flashing. We should now un mount our file system so enter

      Code:
      [email protected]:~/900ssWorking$ sudo umount mntsystem/
      [email protected]:~/900ssWorking$
      There is only one way to find out so copy the ROM to a location that windows can access it, boot to windows and flash the new system, if you get a checksum error rename the checksum.ini file from the folder with the ROM.
      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


        #4
        A little more work on system

        A little more work on system

        Let's do a little more work on system, so enter the following to choose our working directory and mount out ext4 filing system

        Code:
        [email protected]:~$ cd 900ssWorking/
        [email protected]:~/900ssWorking$ sudo mount -t ext4 -o loop system.img.ext4 mntsystem/
        [email protected]:~/900ssWorking$
        Let's look for some apks, we will use the find command for this, you may want google or man find, but below I find files in our file system with file name *.apk, * being a wildcard

        Code:
        [email protected]:~/900ssWorking$ sudo find mntsystem/ -name *.apk
        mntsystem/app/ApplicationsProvider.apk
        ...
        [email protected]:~/900ssWorking$
        Looking at the results I am going to remove all the files in thirdparty and sougouinput.apk and PinyinIME.apk, depending on the ROM you are working your results may differ.

        Code:
        sudo rm mntsystem/thirdparty/*.apk
        sudo rm mntsystem/app/sougouinput.apk
        sudo rm mntsystem/app/PinyinIME.apk
        sudo rm mntsystem/thirdparty/*.odex
        sudo rm mntsystem/app/sougouinput.odex
        sudo rm mntsystem/app/PinyinIME.odex
        At this point I'm done with debloating. It would be worth reviewing and changing build.prop at this point, I'll leave that as an exercise at the moment.

        For rooting KitKat I make changes to both system and boot.img so I'll come back to this, there's also more that can be done to system so I'll be coming back to it later. In the mean time there is good information in my thread on working RK ROMs, see my signature for the link.
        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
          Un-packing and Packing boot.img

          Now to do some work on boot.img.


          We will use Bruno Martins' unpack-MT65xx.pl to do this. this unpacks a boot.img into a kernel and a gzipped cpio archive. The archive is then extracted to a folder boot.img-ramdisk. the files will be extracted into the same folder as the target so we will star off by copying boot.img from our source folder to our working folder.


          Code:
          [email protected]:~/900ssWorking$ cp ../sourceROM/boot.img ./
          [email protected]:~/900ssWorking$ unpack-MT65xx.pl boot.img 
          MTK-Tools by Bruno Martins
          MT65xx unpack script (last update: 31-07-2012)
          
          
          Valid Android signature found...
          
          
          Kernel written to boot.img-kernel.img
          Ramdisk written to boot.img-ramdisk.cpio.gz
          Ramdisk size: 3331 blocks
          Extracted ramdisk contents to directory boot.img-ramdisk
          
          
          Successfully unpacked kernel and ramdisk.
          [email protected]:~/900ssWorking$ ls -l
          total 763144
          -rw-r--r-- 1 brian brian    5881856 Sep 20 14:28 boot.img
          -rw-rw-r-- 1 brian brian    5023592 Sep 20 14:28 boot.img-kernel.img
          drwxrwxr-x 9 brian brian       4096 Sep 20 14:28 boot.img-ramdisk
          -rw-rw-r-- 1 brian brian     854128 Sep 20 14:28 boot.img-ramdisk.cpio.gz
          drwxrwxr-x 2 brian brian       4096 Sep 18 17:08 mntsystem
          -rw-rw-r-- 1 brian brian 2147483648 Sep 18 19:43 system.img.ext4
          [email protected]:~/900ssWorking$

          For the moment we will just make a minor addition to init.rc.


          Code:
          [email protected]:~/900ssWorking$ gedit boot.img-ramdisk/init.rc
          [email protected]:~/900ssWorking$

          move to the end of the file and add a comment


          #900supersport was here

          save and exit gedit.


          Now lets re-pack boot.img


          Bruno's perl script seems to have a 'feature' in that it it will not run from the command line, so I have use perl to execute it


          Code:
          [email protected]:~/900ssWorking$ perl ~/mtktools/repack-MT65xx.pl -boot boot.img-kernel.img boot.img-ramdisk custboot.img
          MTK-Tools by Bruno Martins
          MT65xx repack script (last update: 31-07-2012)
          
          
          Repacking boot image...
          Ramdisk size: 3331 blocks
          
          
          Repacked boot image into custboot.img
          [email protected]:~/900ssWorking$ 
          [email protected]:~/900ssWorking$ ls -l
          total 768892
          -rw-r--r-- 1 brian brian    5881856 Sep 20 14:28 boot.img
          -rw-rw-r-- 1 brian brian    5023592 Sep 20 14:28 boot.img-kernel.img
          drwxrwxr-x 9 brian brian       4096 Sep 20 14:28 boot.img-ramdisk
          -rw-rw-r-- 1 brian brian     854128 Sep 20 14:28 boot.img-ramdisk.cpio.gz
          -rw-r--r-- 1 brian brian    5883904 Sep 20 14:54 custboot.img
          drwxrwxr-x 2 brian brian       4096 Sep 18 17:08 mntsystem
          -rw-rw-r-- 1 brian brian 2147483648 Sep 18 19:43 system.img.ext4
          [email protected]:~/900ssWorking$

          At this point copy the custboot.img to a location accessable be windows and flash to you device checking it still boots. If it does we can now un-pack and customise boot.img and system.img. With the other information I've published on FreakTab you should now be able to customise boot and system, I've more to post yet though :-)
          Last edited by 900supersport; 10-11-2014, 11:00.
          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
            Putting it all together - Let's make a ROM

            Putting it all together - Let's make a ROM


            We now have a toolkit to rework our ROM, so here's what I do.
            1. Unpack the sparse image
            2. mount the unpacked image
            3. remove any junk (debloat)
            4. make any build prop changes
            5. apply system changes for root
            6. add busybox and symlinks
            7. deploy any further files
            8. unpack boot, edit init.rc
            9. review and make ad hoc changes to system and boot
            10. re-pack system and boot images
            That's quite a list and is going to require that we enter a lot of commands, so I'm going to make things more systematic by creating a set of shell scripts, we will do this over a number of posts.

            First we will create these in a subdirectory 900ssMTKKitchen.


            Let's make the folder


            Code:
            [email protected]:~$ cd ~
            [email protected]:~$ mkdir 900ssMTKKitchen
            [email protected]:~$ cd 900ssWorking/

            cd ~ chooses our HOME directory
            we then make a subfolder 900ssMTKKitchen

            It's probably worth clearing out our working folder so we can start from scratch, I'll leave that as an exercise (Hint - you may need elevated permissions)
            Last edited by 900supersport; 09-22-2014, 21:38.
            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


              #7
              Our unpack.sh script

              900ssMTKKitchen::unpack.sh


              We already know how to unpack a sparse image, so as a nice easy start let's script this. I'll give an overview of the script, but if you want more info on shell scripting then there is lots of info on the net.


              Let's create the file
              Code:
              [email protected]:~/900ssWorking$ gedit ../900ssMTKKitchen/unpack.sh
              [email protected]:~/900ssWorking$

              Enter the following text and then save and close gedit.


              Code:
              #!/bin/sh
              #
              #   
              #   900ssMTKKitchen::unpack.sh www.freaktab.com
              #
              #   Copyright 2014 Brian Mahoney [email protected]
              #
              #   1.0
              #
              ############################################################################
              #
              #   900ssMTKKitchen is free software: you can redistribute it and/or modify
              #   it under the terms of the GNU General Public License as published by
              #   the Free Software Foundation, either version 3 of the License, or
              #   (at your option) any later version.
              #
              #   900ssMTKKitchen is distributed in the hope that it will be useful,
              #   but WITHOUT ANY WARRANTY; without even the implied warranty of
              #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
              #   GNU General Public License for more details.
              #
              #   You should have received a copy of the GNU General Public License
              #   along with FreakTabKitchen.  If not, see .
              #
              ############################################################################
              #
              #   20/09/14 Created
              # 
              ############################################################################
              #
              #   unpack a sparse image to an ext4 image and ls -l -a the extracted file
              #
              #   when called with fewer than two parameters a USAGE prompt will be 
              #   displayed
              #
              ############################################################################
              
              
              PROGNAME=$(basename $0)
              
              
              error_exit(){
                  echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
                  exit 1
              }
              
              
              usage(){
                  echo "\n\nUSAGE\n\t${PROGNAME}  \n\n"
                  error_exit "incorrect usage"
              }
              
              
              if [ $# -lt 2 ] ;then
                  usage
              else
                  SPARSE=$1
                  NEWIMAGE=$2
              fi
              
              
              echo "############################################################################"
              echo "working,  please wait"
              
              
              if [ -e $NEWIMAGE ] ;then
                  error_exit 'file exists\n\n'
              else
                  echo "extracting $SPARSE to $NEWIMAGE\n"
                  if simg2img $SPARSE $NEWIMAGE; then
                      echo "$SPARSE unpacked\n"
                  else
                      error_exit "failed to unpack $SPARSE"
                  fi
              fi
              
              
              ls -l -a $NEWIMAGE

              We will now set the execute permission on the file with chmod +x, and then set up a symbolic link


              Code:
              [email protected]:~/900ssWorking$ chmod +x ~/900ssMTKKitchen/unpack.sh
              [email protected]:~/900ssWorking$ ls -l ~/900ssMTKKitchen/unpack.sh
              -rwxrwxr-x 1 brian brian 2022 Sep 20 18:20 /home/brian/900ssMTKKitchen/unpack.sh
              [email protected]:~/900ssWorking$ sudo ln -s /home/brian/900ssMTKKitchen/unpack.sh /usr/local/bin/unpack.sh
              [sudo] password for brian: 
              [email protected]:~/900ssWorking$

              and now we will test it first with incorrect parameters to get a USAGE message
              Code:
              [email protected]:~/900ssWorking$ unpack.sh 
              
              
              
              
              USAGE
                  unpack.sh  
              
              
              
              
              unpack.sh: incorrect usage

              and then repeat with good values


              Code:
              [email protected]:~/900ssWorking$ ../900ssMTKKitchen/unpack.sh ../sourceROM/system.img system.ext4.img
              ############################################################################
              working,  please wait
              extracting ../sourceROM/system.img to system.ext4.img
              
              
              ../sourceROM/system.img unpacked
              
              
              -rw-rw-r-- 1 brian brian 2147483648 Sep 20 18:42 system.ext4.img

              and again when the file already exists


              Code:
              [email protected]:~/900ssWorking$ ../900ssMTKKitchen/unpack.sh ../sourceROM/system.img system.ext4.img
              ############################################################################
              working,  please wait
              unpack.sh: file exists
              
              
              
              
              [email protected]:~/900ssWorking$

              So that's unpack sorted.

              Explanation of unpack.sh

              #!/bin/sh
              flag the file as a shell script to be executed by /bin/sh

              lines starting # are comments

              PROGNAME=$(basename $0)
              populate a variable with the name of the command as it was called, if we symlink multiple aliases to the script then this will determine the symlink used to execute the script. This idea is behind the way busybox works

              error_exit(){
              echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
              exit 1
              }
              here we create a standard method to output an error message (using echo) and exit with a non zero error code (0 is success). Note the usage of the ${PROGNAME} variable

              usage(){
              echo "\n\nUSAGE\n\t${PROGNAME} \n\n"
              error_exit "incorrect usage"
              }
              adds a usage method that displays a message and then exits

              if [ $# -lt 2 ] ;then
              usage
              else
              SPARSE=$1
              NEWIMAGE=$2
              fi
              If we have less than two parameters then display usage method. Otherwise copy the parameters $1 and $2 into the variables SPARSE and NEWIMAGE, this to help with readability. It would probably have been better to test for not equal to 2 rather than less than 2

              we then output some info, test to see ir the unpacked file already exist and exits if so.

              finally we unpack with

              if simg2img $SPARSE $NEWIMAGE; then
              ...
              fi
              this uses the simg2img we have seen already, if this exits with success we get a sucess message, otherwise we use error_exit

              to finish off we do a ls -l -a of the new file
              Last edited by 900supersport; 09-21-2014, 08:25.
              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


                #8
                900ssMTKKitchen::mtkmount.sh

                900ssMTKKitchen::mtkmount.sh

                We already know how to mount an ext4 image, so lets get on with things, I'm naming this mtkmount.sh to avoid confusion with the mount command

                Let's create the file
                [email protected]:~/900ssWorking$ gedit ../900ssMTKKitchen/mtkmount.sh

                Enter the following text and save and exit from gedit.

                Code:
                #!/bin/sh
                #
                #   
                #   900ssMTKKitchen::mtkmount.sh www.freaktab.com
                #
                #   Copyright 2014 Brian Mahoney [email protected]
                #
                #   <version>1.0</version>
                #
                ############################################################################
                #
                #   900ssMTKKitchen is free software: you can redistribute it and/or modify
                #   it under the terms of the GNU General Public License as published by
                #   the Free Software Foundation, either version 3 of the License, or
                #   (at your option) any later version.
                #
                #   900ssMTKKitchen is distributed in the hope that it will be useful,
                #   but WITHOUT ANY WARRANTY; without even the implied warranty of
                #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                #   GNU General Public License for more details.
                #
                #   You should have received a copy of the GNU General Public License
                #   along with FreakTabKitchen.  If not, see <http://www.gnu.org/licenses/>.
                #
                ############################################################################
                #
                #   20/09/14 Created
                # 
                ############################################################################
                #
                #   mount an ext4 image to the specified mount point
                #
                #   when called with fewer than two parameters a USAGE prompt will be 
                #   displayed
                #
                ############################################################################
                
                
                PROGNAME=$(basename $0)
                
                
                error_exit(){
                    echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
                    exit 1
                }
                
                
                usage(){
                    echo "\n\nUSAGE\n\t${PROGNAME} <EXT4IMAGE> <MOUNTPOINT>\n\n"
                    error_exit "incorrect usage"
                }
                
                
                if [ $# -lt 2 ] ;then
                    usage
                else
                    EXT4=$1
                    FOLDER=$2
                fi
                
                
                echo "############################################################################"
                echo "working,  please wait"
                
                
                #test for the existance of mount point creating if required
                if [ -d $FOLDER ] ; then
                    echo $FOLDER " Exists"
                else
                    if mkdir $FOLDER; then
                        echo $FOLDER " created"
                    else
                        error_exit "failed to create ${FOLDER}"
                    fi
                fi
                
                
                #mount
                if sudo mount -o loop -t ext4 $EXT4 $FOLDER; then
                    echo "${EXT4} mounted at ${FOLDER}"
                else
                    error_exit "failed to mount ${FOLDER}"
                fi
                As previously we will set the execute permission and create a symlink

                Code:
                [email protected]:~/900ssWorking$ chmod +x ../900ssMTKKitchen/mtkmount.sh 
                [email protected]:~/900ssWorking$ sudo ln -s /home/brian/900ssMTKKitchen/mtkmount.sh /usr/local/bin/mtkmount.sh
                [sudo] password for brian: 
                [email protected]:~/900ssWorking$
                and test

                Code:
                [email protected]:~/900ssWorking$ mtkmount.sh 
                
                
                
                
                USAGE
                    mtkmount.sh  
                
                
                
                
                mtkmount.sh: incorrect usage
                [email protected]:~/900ssWorking$ mtkmount.sh system.ext4.img mntsystem
                ############################################################################
                working,  please wait
                mntsystem  created
                system.ext4.img mounted at mntsystem
                [email protected]:~/900ssWorking$ ls
                mntsystem  system.ext4.img
                [email protected]:~/900ssWorking$ ls mntsystem/
                app  bin.bak    build.prop  etc    framework  lost+found  mobile_toolkit  res         tts  vendor  xbin.bak
                bin  build.old  data        fonts  lib        media       priv-app        thirdparty  usr  xbin
                [email protected]:~/900ssWorking$ mtkmount.sh system.ext4.img mntsystem
                ############################################################################
                working,  please wait
                mntsystem  Exists
                mount: according to mtab /home/brian/900ssWorking/system.ext4.img is already mounted on mntsystem as loop
                mtkmount.sh: failed to mount mntsystem
                [email protected]:~/900ssWorking$
                I don't think we have anything new in the script so I'll not explain any further
                Last edited by 900supersport; 09-27-2014, 22:05.
                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
                  900ssMTKKitchen::debloat.sh

                  Now lets remove the junk from system


                  Let's create the file
                  Code:
                  [email protected]:~/900ssWorking$ gedit ../900ssMTKKitchen/debloat.sh

                  Enter the following text and save and exit from gedit.
                  Code:
                  #!/bin/sh
                  #
                  #   
                  #   900ssMTKKitchen::debloat.sh www.freaktab.com
                  #
                  #   Copyright 2014 Brian Mahoney [email protected]
                  #
                  #   <version>1.0</version>
                  #
                  ############################################################################
                  #
                  #   900ssMTKKitchen is free software: you can redistribute it and/or modify
                  #   it under the terms of the GNU General Public License as published by
                  #   the Free Software Foundation, either version 3 of the License, or
                  #   (at your option) any later version.
                  #
                  #   900ssMTKKitchen is distributed in the hope that it will be useful,
                  #   but WITHOUT ANY WARRANTY; without even the implied warranty of
                  #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                  #   GNU General Public License for more details.
                  #
                  #   You should have received a copy of the GNU General Public License
                  #   along with FreakTabKitchen.  If not, see <http://www.gnu.org/licenses/>.
                  #
                  ############################################################################
                  #
                  #   20/09/14 Created
                  # 
                  ############################################################################
                  #
                  #   remove excess files from our mounted system.img
                  #
                  #   when called with fewer than two parameters a USAGE prompt will be 
                  #   displayed
                  #
                  ############################################################################
                  
                  
                  PROGNAME=$(basename $0)
                  
                  
                  error_exit(){
                      echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
                      exit 1
                  }
                  
                  
                  usage(){
                      echo "\n\nUSAGE\n\t${PROGNAME} <MOUNTPOINT>\n\n"
                      error_exit "incorrect usage"
                  }
                  
                  
                  copy_remove(){
                      cp $1 $2
                      sudo rm $1
                  }
                  
                  
                  copy_removefolder(){
                      FLIST=`ls ${1}*.*`
                      for INFILES in $FLIST
                      do
                          cp $INFILES $2
                          sudo rm $INFILES
                      done
                  }
                  
                  
                  #check parameters and apply defaults
                  if [ $# -lt 1 ] ;then
                      usage
                  else
                      DEST=$1
                  fi
                  
                  
                  FOLDER="removed/"
                  
                  
                  #test for the existance of mount point creating if required
                  if [ -d $FOLDER ] ; then
                      echo $FOLDER " Exists"
                  else
                      if mkdir $FOLDER; then
                          echo $FOLDER " created"
                      else
                          error_exit "failed to create ${FOLDER}"
                      fi
                  fi
                  
                  
                  #lets copy these files, I'm not going to error trap these, 
                  #just try and copy these files into removed and then delete
                  
                  
                  copy_removefolder ${DEST}thirdparty/ $FOLDER
                  
                  
                  copy_remove ${DEST}app/sougouinput.apk $FOLDER
                  copy_remove ${DEST}app/sougouinput.odex $FOLDER
                  
                  
                  copy_remove ${DEST}app/PinyinIME.apk $FOLDER
                  copy_remove ${DEST}app/PinyinIME.odex $FOLDER
                  
                  
                  echo 'system debloated'

                  Set the execute permission and create a symlink


                  Code:
                  [email protected]:~/900ssWorking$ chmod +x ../900ssMTKKitchen/debloat.sh
                  [email protected]:~/900ssWorking$ sudo ln -s /home/brian/900ssMTKKitchen/debloat.sh /usr/local/bin/debloat.sh
                  [sudo] password for brian: 
                  [email protected]:~/900ssWorking$

                  and test

                  Code:
                  [email protected]:~/900ssWorking$ debloat.sh 
                  
                  
                  
                  
                  USAGE
                  debloat.sh <MOUNTPOINT>
                  
                  
                  
                  
                  debloat.sh: incorrect usage
                  [email protected]:~/900ssWorking$ debloat.sh mntsystem/
                  removed  Exists
                  cp: cannot stat ‘mntsystem//thirdparty/*.odex’: No such file or directory
                  rm: cannot remove ‘mntsystem//thirdparty/*.odex’: No such file or directory
                  cp: cannot stat ‘mntsystem//app/sougouinput.apk’: No such file or directory
                  rm: cannot remove ‘mntsystem//app/sougouinput.apk’: No such file or directory
                  cp: cannot stat ‘mntsystem//app/sougouinput.odex’: No such file or directory
                  rm: cannot remove ‘mntsystem//app/sougouinput.odex’: No such file or directory
                  cp: cannot stat ‘mntsystem//app/PinyinIME.apk’: No such file or directory
                  rm: cannot remove ‘mntsystem//app/PinyinIME.apk’: No such file or directory
                  cp: cannot stat ‘mntsystem//app/PinyinIME.odex’: No such file or directory
                  rm: cannot remove ‘mntsystem//app/PinyinIME.odex’: No such file or directory
                  system debloated

                  As you work more ROMs add additional copy_remove lines to debloat.sh
                  Last edited by 900supersport; 09-27-2014, 22:07.
                  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


                    #10
                    900ssMTKKitchen::editbuildprop.sh

                    And on to editing build prop

                    Let's create the file
                    Code:
                    [email protected]:~/900ssWorking$ gedit ../900ssMTKKitchen/editbuildprop.sh

                    Enter the following text and save and exit from gedit.
                    Code:
                    #!/bin/sh
                    #
                    #   
                    #   900ssMTKKitchen::editbuildprop.sh www.freaktab.com
                    #
                    #   Copyright 2014 Brian Mahoney [email protected]
                    #
                    #   1.0
                    #
                    ############################################################################
                    #
                    #   900ssMTKKitchen is free software: you can redistribute it and/or modify
                    #   it under the terms of the GNU General Public License as published by
                    #   the Free Software Foundation, either version 3 of the License, or
                    #   (at your option) any later version.
                    #
                    #   900ssMTKKitchen is distributed in the hope that it will be useful,
                    #   but WITHOUT ANY WARRANTY; without even the implied warranty of
                    #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                    #   GNU General Public License for more details.
                    #
                    #   You should have received a copy of the GNU General Public License
                    #   along with FreakTabKitchen.  If not, see .
                    #
                    ############################################################################
                    #
                    #   20/09/14 Created
                    # 
                    ############################################################################
                    #
                    #   edit build prop
                    #
                    #   when called with fewer than one parameter a USAGE prompt will be 
                    #   displayed
                    #
                    ############################################################################
                    
                    
                    PROGNAME=$(basename $0)
                    
                    
                    error_exit(){
                        echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
                        exit 1
                    }
                    
                    
                    usage(){
                        echo "\n\nUSAGE\n\t${PROGNAME} <MOUNTPOINT>\n\n"
                        error_exit "incorrect usage"
                    }
                    
                    
                    if [ $# -lt 1 ] ;then
                        usage
                    else
                        FOLDER=$1
                    fi
                    
                    
                    echo "############################################################################"
                    echo "working,  please wait"
                    
                    
                    sudo sed -i 's/\(ro.product.locale.language=\).*/\1en/g' ${FOLDER}build.prop
                    sudo sed -i 's/\(ro.product.locale.region=\).*/\1GB/g' ${FOLDER}build.prop
                    sudo sed -i 's/\(ro.com.android.dateformat=\).*/\1dd-MM-yyyy/g' ${FOLDER}build.prop 
                    sudo sed -i 's/\(persist.sys.timezone=\).*/\1Europe\/London/g' ${FOLDER}build.prop
                    
                    
                    sudo gedit ${FOLDER}build.prop
                    Set the execute permission and create a symlink

                    Code:
                    [email protected]:~/900ssWorking$ chmod +x ../900ssMTKKitchen/editbuildprop.sh
                    [email protected]:~/900ssWorking$ sudo ln -s /home/brian/900ssMTKKitchen/editbuildprop.sh /usr/local/bin/editbuildprop.sh
                    [sudo] password for brian: 
                    [email protected]:~/900ssWorking$
                    and test, you should know the drill by now.

                    here I make 4 basic changes to build prop for localisation and then open buildprop with gedit for review.

                    For more info as to how this works google sed, again we have had to use sudo to edit these files.


                    Here's a post from rrileypm detailing a few build.prop changes, I've used the multi user one myself from time to time. http://www.freaktab.com/showthread.p...blets-(4-2-2-)
                    Last edited by 900supersport; 09-21-2014, 08:33.
                    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
                      900ssMTKKitchen::applyroot.sh

                      And on to adding support for root to system


                      Let's create the file
                      Code:
                      [email protected]:~/900ssWorking$ gedit ../900ssMTKKitchen/applyroot.sh

                      Enter the following text and save and exit from gedit.
                      Code:
                      #!/bin/sh
                      #
                      #   
                      #   900ssMTKKitchen::applyroot.sh www.freaktab.com
                      #
                      #   Copyright 2014 Brian Mahoney [email protected]
                      #
                      #   1.0
                      #
                      ############################################################################
                      #
                      #   900ssMTKKitchen is free software: you can redistribute it and/or modify
                      #   it under the terms of the GNU General Public License as published by
                      #   the Free Software Foundation, either version 3 of the License, or
                      #   (at your option) any later version.
                      #
                      #   900ssMTKKitchen is distributed in the hope that it will be useful,
                      #   but WITHOUT ANY WARRANTY; without even the implied warranty of
                      #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                      #   GNU General Public License for more details.
                      #
                      #   You should have received a copy of the GNU General Public License
                      #   along with FreakTabKitchen.  If not, see .
                      #
                      ############################################################################
                      #
                      #   20/09/14 Created
                      # 
                      ############################################################################
                      #
                      #   add support for root
                      #
                      #   when called with fewer than one parameter a USAGE prompt will be 
                      #   displayed
                      #
                      ############################################################################
                      
                      
                      PROGNAME=$(basename $0)
                      
                      
                      error_exit(){
                          echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
                          exit 1
                      }
                      
                      
                      usage(){
                          echo "\n\nUSAGE\n\t${PROGNAME} \n\n"
                          error_exit "incorrect usage"
                      }
                      
                      
                      if [ $# -lt 1 ] ;then
                          usage
                      else
                          FOLDER=$1
                      fi
                      
                      
                      echo "############################################################################"
                      echo "working,  please wait"
                      
                      
                      BIN=$HOME"/900ssMTKKitchen/rootfiles"
                      
                      
                      echo remove any preexisting root files
                      sudo rm -f ${FOLDER}bin/su
                      sudo rm -f ${FOLDER}xbin/su
                      sudo rm -f ${FOLDER}xbin/daemonsu
                      sudo rm -f ${FOLDER}xbin/sugote
                      sudo rm -f ${FOLDER}bin/.ext/.su
                      sudo rm -f ${FOLDER}etc/install-recovery.sh
                      sudo rm -f ${FOLDER}etc/init.d/99SuperSUDaemon
                      sudo rm -f ${FOLDER}etc/.installed_su_daemon
                      sudo rm -f ${FOLDER}app/Superuser.apk
                      sudo rm -f ${FOLDER}app/Superuser.odex
                      sudo rm -f ${FOLDER}app/SuperUser.apk
                      sudo rm -f ${FOLDER}app/SuperUser.odex
                      sudo rm -f ${FOLDER}app/superuser.apk
                      sudo rm -f ${FOLDER}app/superuser.odex
                      sudo rm -f ${FOLDER}app/Supersu.apk
                      sudo rm -f ${FOLDER}app/Supersu.odex
                      sudo rm -f ${FOLDER}app/SuperSU.apk
                      sudo rm -f ${FOLDER}app/SuperSU.odex
                      sudo rm -f ${FOLDER}app/supersu.apk
                      sudo rm -f ${FOLDER}app/supersu.odex
                      
                      
                      echo deploy files
                      
                      
                      sudo cp $BIN/su ${FOLDER}xbin/su
                      sudo ln -s /system/xbin/su ${FOLDER}bin/su
                      sudo cp $BIN/Superuser.apk ${FOLDER}app/Superuser.apk
                      sudo touch ${FOLDER}etc/.installed_su_daemon
                      
                      
                      echo rooted
                      Note the line
                      BIN=$HOME"/900ssMTKKitchen/rootfiles"
                      This sets the location of the files I will use for rooting. $HOME returns the home directory.

                      Download and extract the following zip to the 900ssMTKKitchen folder for rootfiles etc.

                      900ssMTKKitchen_resources.zip

                      Set the execute permission and create a symlink


                      Code:
                      [email protected]:~/900ssWorking$ chmod +x ../900ssMTKKitchen/applyroot.sh
                      [email protected]:~/900ssWorking$ sudo ln -s /home/brian/900ssMTKKitchen/applyroot.sh /usr/local/bin/applyroot.sh
                      [sudo] password for brian: 
                      [email protected]:~/900ssWorking$

                      and test, you should know the drill by now.
                      Last edited by 900supersport; 09-28-2014, 20:39.
                      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


                        #12
                        900ssMTKKitchen::addbusybox.sh

                        And on to integrating busybox

                        For this and you will need an additional file, if you didn't get the zip in the rrotfiles post then download the following a extract to the 900ssMTKKitchen folder

                        900ssMTKKitchen_resources.zip

                        Let's create the file
                        Code:
                        [email protected]:~/900ssWorking$ gedit ../900ssMTKKitchen/applyroot.sh

                        Enter the following text and save and exit from gedit.
                        Code:
                        #!/bin/sh
                        #
                        #   
                        #   900ssMTKKitchen::addbusybox.sh www.freaktab.com
                        #
                        #   Copyright 2014 Brian Mahoney [email protected]
                        #
                        #   Version 1.0
                        #
                        ############################################################################
                        #
                        #   900ssMTKKitchen is free software: you can redistribute it and/or modify
                        #   it under the terms of the GNU General Public License as published by
                        #   the Free Software Foundation, either version 3 of the License, or
                        #   (at your option) any later version.
                        #
                        #   900ssMTKKitchen is distributed in the hope that it will be useful,
                        #   but WITHOUT ANY WARRANTY; without even the implied warranty of
                        #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                        #   GNU General Public License for more details.
                        #
                        #   You should have received a copy of the GNU General Public License
                        #   along with FreakTabKitchen.  If not, see .
                        #
                        ############################################################################
                        #
                        #   21/09/14 Created
                        # 
                        ############################################################################
                        #
                        #   add support for root
                        #
                        #   when called with fewer than one parameter a USAGE prompt will be 
                        #   displayed
                        #
                        ############################################################################
                        
                        
                        
                        
                        PROGNAME=$(basename $0)
                        
                        
                        
                        
                        error_exit(){
                            echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
                            exit 1
                        }
                        
                        
                        
                        
                        usage(){
                            echo "\n\nUSAGE\n\t${PROGNAME} <MOUNTPOINT>\n\n"
                            error_exit "incorrect usage"
                        }
                        
                        
                        
                        
                        if [ $# -lt 1 ] ;then
                            usage
                        else
                            FOLDER=$1
                        fi
                        
                        
                        echo "############################################################################"
                        echo "working, adding busybox please wait"
                        
                        
                        BIN=$HOME"/900ssMTKKitchen/rootfiles"
                        
                        
                        if sudo cp $HOME/900ssMTKKitchen/deploy/busybox ${FOLDER}xbin/busybox;then
                            if cd ${FOLDER}xbin;then
                                echo make-update busybox links
                        
                        
                                sudo ln -s /system/xbin/busybox [
                                sudo ln -s /system/xbin/busybox [[
                                sudo ln -s /system/xbin/busybox acpid
                                sudo ln -s /system/xbin/busybox adjtimex
                                sudo ln -s /system/xbin/busybox arp
                                sudo ln -s /system/xbin/busybox arping
                                sudo ln -s /system/xbin/busybox ash
                                sudo ln -s /system/xbin/busybox awk
                                sudo ln -s /system/xbin/busybox base64
                                sudo ln -s /system/xbin/busybox basename
                                sudo ln -s /system/xbin/busybox beep
                                sudo ln -s /system/xbin/busybox blkid
                                sudo ln -s /system/xbin/busybox blockdev
                                sudo ln -s /system/xbin/busybox brctl
                                sudo ln -s /system/xbin/busybox bunzip2
                                sudo ln -s /system/xbin/busybox bzcat
                                sudo ln -s /system/xbin/busybox bzip2
                                sudo ln -s /system/xbin/busybox cal
                                sudo ln -s /system/xbin/busybox cat
                                sudo ln -s /system/xbin/busybox catv
                                sudo ln -s /system/xbin/busybox chat
                                sudo ln -s /system/xbin/busybox chattr
                                sudo ln -s /system/xbin/busybox chgrp
                                sudo ln -s /system/xbin/busybox chmod
                                sudo ln -s /system/xbin/busybox chown
                                sudo ln -s /system/xbin/busybox chpst
                                sudo ln -s /system/xbin/busybox chroot
                                sudo ln -s /system/xbin/busybox chrt
                                sudo ln -s /system/xbin/busybox chvt
                                sudo ln -s /system/xbin/busybox cksum
                                sudo ln -s /system/xbin/busybox clear
                                sudo ln -s /system/xbin/busybox cmp
                                sudo ln -s /system/xbin/busybox comm
                                sudo ln -s /system/xbin/busybox conspy
                                sudo ln -s /system/xbin/busybox cp
                                sudo ln -s /system/xbin/busybox cpio
                                sudo ln -s /system/xbin/busybox crond
                                sudo ln -s /system/xbin/busybox crontab
                                sudo ln -s /system/xbin/busybox cut
                                sudo ln -s /system/xbin/busybox date
                                sudo ln -s /system/xbin/busybox dc
                                sudo ln -s /system/xbin/busybox dd
                                sudo ln -s /system/xbin/busybox deallocvt
                                sudo ln -s /system/xbin/busybox depmod
                                sudo ln -s /system/xbin/busybox devmem
                                sudo ln -s /system/xbin/busybox df
                                sudo ln -s /system/xbin/busybox diff
                                sudo ln -s /system/xbin/busybox dirname
                                sudo ln -s /system/xbin/busybox dmesg
                                sudo ln -s /system/xbin/busybox dnsd
                                sudo ln -s /system/xbin/busybox dnsdomainname
                                sudo ln -s /system/xbin/busybox dos2unix
                                sudo ln -s /system/xbin/busybox du
                                sudo ln -s /system/xbin/busybox dumpkmap
                                sudo ln -s /system/xbin/busybox echo
                                sudo ln -s /system/xbin/busybox ed
                                sudo ln -s /system/xbin/busybox egrep
                                sudo ln -s /system/xbin/busybox env
                                sudo ln -s /system/xbin/busybox envdir
                                sudo ln -s /system/xbin/busybox envuidgid
                                sudo ln -s /system/xbin/busybox ether-wake
                                sudo ln -s /system/xbin/busybox expand
                                sudo ln -s /system/xbin/busybox expr
                                sudo ln -s /system/xbin/busybox fakeidentd
                                sudo ln -s /system/xbin/busybox false
                                sudo ln -s /system/xbin/busybox fbset
                                sudo ln -s /system/xbin/busybox fbsplash
                                sudo ln -s /system/xbin/busybox fdflush
                                sudo ln -s /system/xbin/busybox fdformat
                                sudo ln -s /system/xbin/busybox fdisk
                                sudo ln -s /system/xbin/busybox fgconsole
                                sudo ln -s /system/xbin/busybox fgrep
                                sudo ln -s /system/xbin/busybox find
                                sudo ln -s /system/xbin/busybox findfs
                                sudo ln -s /system/xbin/busybox flock
                                sudo ln -s /system/xbin/busybox fold
                                sudo ln -s /system/xbin/busybox free
                                sudo ln -s /system/xbin/busybox freeramdisk
                                sudo ln -s /system/xbin/busybox fsck
                                sudo ln -s /system/xbin/busybox fsck.minix
                                sudo ln -s /system/xbin/busybox fstrim
                                sudo ln -s /system/xbin/busybox fsync
                                sudo ln -s /system/xbin/busybox ftpd
                                sudo ln -s /system/xbin/busybox ftpget
                                sudo ln -s /system/xbin/busybox ftpput
                                sudo ln -s /system/xbin/busybox fuser
                                sudo ln -s /system/xbin/busybox getopt
                                sudo ln -s /system/xbin/busybox grep
                                sudo ln -s /system/xbin/busybox groups
                                sudo ln -s /system/xbin/busybox gunzip
                                sudo ln -s /system/xbin/busybox gzip
                                sudo ln -s /system/xbin/busybox hd
                                sudo ln -s /system/xbin/busybox hdparm
                                sudo ln -s /system/xbin/busybox head
                                sudo ln -s /system/xbin/busybox hexdump
                                sudo ln -s /system/xbin/busybox hostname
                                sudo ln -s /system/xbin/busybox httpd
                                sudo ln -s /system/xbin/busybox hush
                                sudo ln -s /system/xbin/busybox hwclock
                                sudo ln -s /system/xbin/busybox id
                                sudo ln -s /system/xbin/busybox ifconfig
                                sudo ln -s /system/xbin/busybox ifdown
                                sudo ln -s /system/xbin/busybox ifup
                                sudo ln -s /system/xbin/busybox inetd
                                sudo ln -s /system/xbin/busybox insmod
                                sudo ln -s /system/xbin/busybox install
                                sudo ln -s /system/xbin/busybox ionice
                                sudo ln -s /system/xbin/busybox iostat
                                sudo ln -s /system/xbin/busybox ip
                                sudo ln -s /system/xbin/busybox ipaddr
                                sudo ln -s /system/xbin/busybox ipcalc
                                sudo ln -s /system/xbin/busybox iproute
                                sudo ln -s /system/xbin/busybox iprule
                                sudo ln -s /system/xbin/busybox iptunnel
                                sudo ln -s /system/xbin/busybox kbd_mode
                                sudo ln -s /system/xbin/busybox kill
                                sudo ln -s /system/xbin/busybox killall
                                sudo ln -s /system/xbin/busybox killall5
                                sudo ln -s /system/xbin/busybox less
                                sudo ln -s /system/xbin/busybox ln
                                sudo ln -s /system/xbin/busybox loadkmap
                                sudo ln -s /system/xbin/busybox losetup
                                sudo ln -s /system/xbin/busybox lpd
                                sudo ln -s /system/xbin/busybox lpq
                                sudo ln -s /system/xbin/busybox lpr
                                sudo ln -s /system/xbin/busybox ls
                                sudo ln -s /system/xbin/busybox lsattr
                                sudo ln -s /system/xbin/busybox lsmod
                                sudo ln -s /system/xbin/busybox lsof
                                sudo ln -s /system/xbin/busybox lspci
                                sudo ln -s /system/xbin/busybox lsusb
                                sudo ln -s /system/xbin/busybox lzcat
                                sudo ln -s /system/xbin/busybox lzma
                                sudo ln -s /system/xbin/busybox lzop
                                sudo ln -s /system/xbin/busybox lzopcat
                                sudo ln -s /system/xbin/busybox makedevs
                                sudo ln -s /system/xbin/busybox man
                                sudo ln -s /system/xbin/busybox md5sum
                                sudo ln -s /system/xbin/busybox microcom
                                sudo ln -s /system/xbin/busybox mkdir
                                sudo ln -s /system/xbin/busybox mkdosfs
                                sudo ln -s /system/xbin/busybox mke2fs
                                sudo ln -s /system/xbin/busybox mkfifo
                                sudo ln -s /system/xbin/busybox mkfs.ext2
                                sudo ln -s /system/xbin/busybox mkfs.minix
                                sudo ln -s /system/xbin/busybox mkfs.vfat
                                sudo ln -s /system/xbin/busybox mknod
                                sudo ln -s /system/xbin/busybox mkswap
                                sudo ln -s /system/xbin/busybox modinfo
                                sudo ln -s /system/xbin/busybox modprobe
                                sudo ln -s /system/xbin/busybox more
                                sudo ln -s /system/xbin/busybox mount
                                sudo ln -s /system/xbin/busybox mountpoint
                                sudo ln -s /system/xbin/busybox mpstat
                                sudo ln -s /system/xbin/busybox mv
                                sudo ln -s /system/xbin/busybox nameif
                                sudo ln -s /system/xbin/busybox nanddump
                                sudo ln -s /system/xbin/busybox nandwrite
                                sudo ln -s /system/xbin/busybox nbd-client
                                sudo ln -s /system/xbin/busybox nc
                                sudo ln -s /system/xbin/busybox netstat
                                sudo ln -s /system/xbin/busybox nice
                                sudo ln -s /system/xbin/busybox nmeter
                                sudo ln -s /system/xbin/busybox nohup
                                sudo ln -s /system/xbin/busybox nslookup
                                sudo ln -s /system/xbin/busybox ntpd
                                sudo ln -s /system/xbin/busybox od
                                sudo ln -s /system/xbin/busybox openvt
                                sudo ln -s /system/xbin/busybox patch
                                sudo ln -s /system/xbin/busybox pgrep
                                sudo ln -s /system/xbin/busybox pidof
                                sudo ln -s /system/xbin/busybox ping
                                sudo ln -s /system/xbin/busybox ping6
                                sudo ln -s /system/xbin/busybox pipe_progress
                                sudo ln -s /system/xbin/busybox pivot_root
                                sudo ln -s /system/xbin/busybox pkill
                                sudo ln -s /system/xbin/busybox pmap
                                sudo ln -s /system/xbin/busybox powertop
                                sudo ln -s /system/xbin/busybox printenv
                                sudo ln -s /system/xbin/busybox printf
                                sudo ln -s /system/xbin/busybox ps
                                sudo ln -s /system/xbin/busybox pscan
                                sudo ln -s /system/xbin/busybox pstree
                                sudo ln -s /system/xbin/busybox pwd
                                sudo ln -s /system/xbin/busybox pwdx
                                sudo ln -s /system/xbin/busybox raidautorun
                                sudo ln -s /system/xbin/busybox rdate
                                sudo ln -s /system/xbin/busybox rdev
                                sudo ln -s /system/xbin/busybox readahead
                                sudo ln -s /system/xbin/busybox readlink
                                sudo ln -s /system/xbin/busybox readprofile
                                sudo ln -s /system/xbin/busybox realpath
                                sudo ln -s /system/xbin/busybox renice
                                sudo ln -s /system/xbin/busybox reset
                                sudo ln -s /system/xbin/busybox resize
                                sudo ln -s /system/xbin/busybox rev
                                sudo ln -s /system/xbin/busybox rm
                                sudo ln -s /system/xbin/busybox rmdir
                                sudo ln -s /system/xbin/busybox rmmod
                                sudo ln -s /system/xbin/busybox route
                                sudo ln -s /system/xbin/busybox rpm
                                sudo ln -s /system/xbin/busybox rpm2cpio
                                sudo ln -s /system/xbin/busybox rtcwake
                                sudo ln -s /system/xbin/busybox run-parts
                                sudo ln -s /system/xbin/busybox runsv
                                sudo ln -s /system/xbin/busybox runsvdir
                                sudo ln -s /system/xbin/busybox rx
                                sudo ln -s /system/xbin/busybox script
                                sudo ln -s /system/xbin/busybox scriptreplay
                                sudo ln -s /system/xbin/busybox sed
                                sudo ln -s /system/xbin/busybox seq
                                sudo ln -s /system/xbin/busybox setconsole
                                sudo ln -s /system/xbin/busybox setkeycodes
                                sudo ln -s /system/xbin/busybox setlogcons
                                sudo ln -s /system/xbin/busybox setserial
                                sudo ln -s /system/xbin/busybox setsid
                                sudo ln -s /system/xbin/busybox setuidgid
                                sudo ln -s /system/xbin/busybox sha1sum
                                sudo ln -s /system/xbin/busybox sha256sum
                                sudo ln -s /system/xbin/busybox sha3sum
                                sudo ln -s /system/xbin/busybox sha512sum
                                sudo ln -s /system/xbin/busybox showkey
                                sudo ln -s /system/xbin/busybox slattach
                                sudo ln -s /system/xbin/busybox sleep
                                sudo ln -s /system/xbin/busybox smemcap
                                sudo ln -s /system/xbin/busybox softlimit
                                sudo ln -s /system/xbin/busybox sort
                                sudo ln -s /system/xbin/busybox split
                                sudo ln -s /system/xbin/busybox start-stop-daemon
                                sudo ln -s /system/xbin/busybox stat
                                sudo ln -s /system/xbin/busybox strings
                                sudo ln -s /system/xbin/busybox stty
                                sudo ln -s /system/xbin/busybox sum
                                sudo ln -s /system/xbin/busybox sv
                                sudo ln -s /system/xbin/busybox svlogd
                                sudo ln -s /system/xbin/busybox swapoff
                                sudo ln -s /system/xbin/busybox swapon
                                sudo ln -s /system/xbin/busybox switch_root
                                sudo ln -s /system/xbin/busybox sync
                                sudo ln -s /system/xbin/busybox sysctl
                                sudo ln -s /system/xbin/busybox tac
                                sudo ln -s /system/xbin/busybox tail
                                sudo ln -s /system/xbin/busybox tar
                                sudo ln -s /system/xbin/busybox tcpsvd
                                sudo ln -s /system/xbin/busybox tee
                                sudo ln -s /system/xbin/busybox telnet
                                sudo ln -s /system/xbin/busybox telnetd
                                sudo ln -s /system/xbin/busybox test
                                sudo ln -s /system/xbin/busybox tftp
                                sudo ln -s /system/xbin/busybox tftpd
                                sudo ln -s /system/xbin/busybox time
                                sudo ln -s /system/xbin/busybox timeout
                                sudo ln -s /system/xbin/busybox top
                                sudo ln -s /system/xbin/busybox touch
                                sudo ln -s /system/xbin/busybox tr
                                sudo ln -s /system/xbin/busybox traceroute
                                sudo ln -s /system/xbin/busybox traceroute6
                                sudo ln -s /system/xbin/busybox true
                                sudo ln -s /system/xbin/busybox tty
                                sudo ln -s /system/xbin/busybox ttysize
                                sudo ln -s /system/xbin/busybox tunctl
                                sudo ln -s /system/xbin/busybox ubiattach
                                sudo ln -s /system/xbin/busybox ubidetach
                                sudo ln -s /system/xbin/busybox ubimkvol
                                sudo ln -s /system/xbin/busybox ubirmvol
                                sudo ln -s /system/xbin/busybox ubirsvol
                                sudo ln -s /system/xbin/busybox ubiupdatevol
                                sudo ln -s /system/xbin/busybox udpsvd
                                sudo ln -s /system/xbin/busybox umount
                                sudo ln -s /system/xbin/busybox uname
                                sudo ln -s /system/xbin/busybox unexpand
                                sudo ln -s /system/xbin/busybox uniq
                                sudo ln -s /system/xbin/busybox unix2dos
                                sudo ln -s /system/xbin/busybox unlzma
                                sudo ln -s /system/xbin/busybox unlzop
                                sudo ln -s /system/xbin/busybox unxz
                                sudo ln -s /system/xbin/busybox unzip
                                sudo ln -s /system/xbin/busybox uptime
                                sudo ln -s /system/xbin/busybox usleep
                                sudo ln -s /system/xbin/busybox uudecode
                                sudo ln -s /system/xbin/busybox uuencode
                                sudo ln -s /system/xbin/busybox vconfig
                                sudo ln -s /system/xbin/busybox vi
                                sudo ln -s /system/xbin/busybox volname
                                sudo ln -s /system/xbin/busybox watch
                                sudo ln -s /system/xbin/busybox watchdog
                                sudo ln -s /system/xbin/busybox wc
                                sudo ln -s /system/xbin/busybox wget
                                sudo ln -s /system/xbin/busybox which
                                sudo ln -s /system/xbin/busybox whoami
                                sudo ln -s /system/xbin/busybox whois
                                sudo ln -s /system/xbin/busybox xargs
                                sudo ln -s /system/xbin/busybox xz
                                sudo ln -s /system/xbin/busybox xzcat
                                sudo ln -s /system/xbin/busybox yes
                                sudo ln -s /system/xbin/busybox zcat
                                sudo ln -s /system/xbin/busybox zcip
                        
                        
                                cd ../..
                                echo busybox update completed
                            fi
                        fi



                        Set the execute permission and create a symlink


                        Code:
                        [email protected]:~/900ssWorking$ chmod +x ../900ssMTKKitchen/addbusybox.sh
                        [email protected]:~/900ssWorking$ sudo ln -s /home/brian/900ssMTKKitchen/addbusybox.sh /usr/local/bin/addbusybox.sh
                        [sudo] password for brian: 
                        [email protected]:~/900ssWorking$

                        and test, you should know the drill by now.
                        Last edited by 900supersport; 09-28-2014, 20:41.
                        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


                          #13
                          Deploy files as required

                          900ssMTKKitchen::deploy.sh

                          Again you will need to have downloaded and extracted the zip fro the apply root post.

                          Code:
                          #!/bin/sh
                          #
                          #
                          #   900ssMTKKitchen::deploy.sh www.freaktab.com
                          #
                          #   Copyright 2014 Brian Mahoney [email protected]
                          #
                          #   1.0
                          #
                          ############################################################################
                          #
                          #   900ssMTKKitchen is free software: you can redistribute it and/or modify
                          #   it under the terms of the GNU General Public License as published by
                          #   the Free Software Foundation, either version 3 of the License, or
                          #   (at your option) any later version.
                          #
                          #   900ssMTKKitchen is distributed in the hope that it will be useful,
                          #   but WITHOUT ANY WARRANTY; without even the implied warranty of
                          #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                          #   GNU General Public License for more details.
                          #
                          #   You should have received a copy of the GNU General Public License
                          #   along with FreakTabKitchen.  If not, see .
                          #
                          ############################################################################
                          #
                          #   22/09/14 Created
                          # 
                          ############################################################################
                          #
                          #   add support for root
                          #
                          #   when called with fewer than one parameter a USAGE prompt will be 
                          #   displayed
                          #
                          ############################################################################
                          
                          
                          
                          
                          PROGNAME=$(basename $0)
                          
                          
                          
                          
                          error_exit(){
                              echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
                              exit 1
                          }
                          
                          
                          
                          
                          usage(){
                              echo "\n\nUSAGE\n\t${PROGNAME} <MOUNTPOINT>\n\n"
                              error_exit "incorrect usage"
                          }
                          
                          
                          
                          
                          if [ $# -lt 1 ] ;then
                              usage
                          else
                              FOLDER=$1
                          fi
                          
                          
                          echo "############################################################################"
                          echo "working, deploying please wait"
                          
                          
                          BASE=$HOME"/900ssMTKKitchen/deploy"
                          
                          
                          sudo cp $BASE/preinstall.sh $FOLDER/bin/preinstall.sh
                          test as usual.

                          If you have other files you intend to deploy in your ROMs as a matter of course then add sudo cp lines to this script and add them to the the deploy folder in the kitchen.

                          You may want to take a quick look at preinstall.sh, it's a standard bash script, note on android the first line is slightly different.

                          As we are working on a Linux system then permissions on preinstall.sh are copied with it. if we needed to set the permissions explicitly we would need to add a sudo chmod 755 preinstall.sh following the sudo cp line.
                          Last edited by 900supersport; 09-28-2014, 20:50.
                          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


                            #14
                            unpacking boot.img

                            900ssMTKKitchen::unpackboot.sh

                            Code:
                            #!/bin/sh
                            #
                            #   
                            #   900ssMTKKitchen::unpackboot.sh www.freaktab.com
                            #
                            #   Copyright 2014 Brian Mahoney [email protected]
                            #
                            #   1.0
                            #
                            ############################################################################
                            #
                            #   900ssMTKKitchen is free software: you can redistribute it and/or modify
                            #   it under the terms of the GNU General Public License as published by
                            #   the Free Software Foundation, either version 3 of the License, or
                            #   (at your option) any later version.
                            #
                            #   900ssMTKKitchen is distributed in the hope that it will be useful,
                            #   but WITHOUT ANY WARRANTY; without even the implied warranty of
                            #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                            #   GNU General Public License for more details.
                            #
                            #   You should have received a copy of the GNU General Public License
                            #   along with FreakTabKitchen.  If not, see .
                            #
                            ############################################################################
                            #
                            #   22/09/14 Created
                            # 
                            ############################################################################
                            #
                            #   unpack a boot.img
                            #
                            #   when called with fewer than one parameter a USAGE prompt will be 
                            #   displayed
                            #
                            ############################################################################
                            
                            
                            
                            
                            PROGNAME=$(basename $0)
                            
                            
                            
                            
                            error_exit(){
                                echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
                                exit 1
                            }
                            
                            
                            
                            
                            usage(){
                                echo "\n\nUSAGE\n\t${PROGNAME} <SOURCE> \n\n"
                                error_exit "incorrect usage"
                            }
                            
                            
                            #check parameters
                            if [ $# -lt 1 ] ;then
                                usage
                            else
                                BOOTIMAGE=$1
                            fi
                            
                            
                            if cp $BOOTIMAGE boot.img;then
                                if unpack-MT65xx.pl boot.img;then
                                    echo boot.img unpacked
                                else
                                    error_exit "failed to unpack boot.img"
                                fi
                            fi
                            We have already see how to unpack boot.img so I don't think there is anything new here. Set permissions, create symlink and test
                            Last edited by 900supersport; 09-28-2014, 20:52.
                            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


                              #15
                              apply init.rc changes

                              900ssMTKKitchen::applyinitrcchanges.sh

                              Code:
                              #!/bin/sh
                              #
                              #   
                              #   900ssMTKKitchen::applyinitrcchanges.sh www.freaktab.com
                              #
                              #   Copyright 2014 Brian Mahoney [email protected]
                              #
                              #   1.0
                              #
                              ############################################################################
                              #
                              #   900ssMTKKitchen is free software: you can redistribute it and/or modify
                              #   it under the terms of the GNU General Public License as published by
                              #   the Free Software Foundation, either version 3 of the License, or
                              #   (at your option) any later version.
                              #
                              #   900ssMTKKitchen is distributed in the hope that it will be useful,
                              #   but WITHOUT ANY WARRANTY; without even the implied warranty of
                              #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                              #   GNU General Public License for more details.
                              #
                              #   You should have received a copy of the GNU General Public License
                              #   along with FreakTabKitchen.  If not, see .
                              #
                              ############################################################################
                              #
                              #   22/09/14 Created
                              # 
                              ############################################################################
                              #
                              #   apply changes to init.rc
                              #
                              #   when called with fewer than one parameter a USAGE prompt will be 
                              #   displayed
                              #
                              ############################################################################
                              
                              
                              PROGNAME=$(basename $0)
                              
                              
                              error_exit(){
                                  echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
                                  exit 1
                              }
                              
                              
                              
                              
                              usage(){
                                  echo "\n\nUSAGE\n\t${PROGNAME} \n\n"
                                  error_exit "incorrect usage"
                              }
                              
                              
                              #check parameters
                              if [ -e boot.img-ramdisk/init.rc ] ;then
                                  cat $HOME/900ssMTKKitchen/deploy/addinitdsupport >> boot.img-ramdisk/init.rc
                                  cat $HOME/900ssMTKKitchen/deploy/addrootdaemon >> boot.img-ramdisk/init.rc
                                  cat $HOME/900ssMTKKitchen/deploy/addpreinstall >> boot.img-ramdisk/init.rc
                                  gedit boot.img-ramdisk/init.rc
                              else
                                  error_exit 'no boot.img-ramdisk/init.rc found'
                              fi
                              >> appends to a file so here we add a few pre-defined blocks of instructions to the end of init.rc. A more sophisticated approach would be to check if the lines have already been entered. To do this we would probably want to add a check_add method that checks init.rc for a key and if not found adds a block of text, if this block contains the key then we can run many times and add only once.
                              Last edited by 900supersport; 09-28-2014, 20:57.
                              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