FORUMS
Remove All Ads from XDA

Modifying uRamdisk & bootutil

2,208 posts
Thanks Meter: 993
 
By Renate NST, Inactive Recognized Developer / Recognized Contributor on 16th July 2012, 09:38 PM
Post Reply Email Thread
There's a lot of fine-tuning you can do by modifying init.rc that is packed into uRamdisk in the boot partition.

In the Unix world to modify init.rc inside uRamdisk you would need to:
  1. Use dd to strip the image header
  2. Use gzip to expand the contents
  3. Use cpio to separate it into files
  4. Edit what you want in init.rc
  5. Use cpio to combine the files
  6. Use gzip to compress the contents
  7. Use mkimage to wrap the contents
In the Windows world a command line utility simplifies this:
Code:
bootutil /v /x uRamdisk init.rc
Edit init.rc
Code:
bootutil /v /r uRamdisk init.rc
As always, be careful and make a backup.
Making a Clockwork Recovery update to restore the original uRamdisk might be a good idea.
Download bootutil.exe in the signature.
The Following 5 Users Say Thank You to Renate NST For This Useful Post: [ View ] Gift Renate NST Ad-Free
 
 
16th July 2012, 11:16 PM |#2  
Senior Member
Thanks Meter: 52
 
More
Quote:
Originally Posted by Renate NST

There's a lot of fine-tuning you can do by modifying init.rc that is packed into uRamdisk in the boot partition.

In the Unix world to modify init.rc inside uRamdisk you would need to:

  1. Use dd to strip the image header
  2. Use gzip to expand the contents
  3. Use cpio to separate it into files
  4. Edit what you want in init.rc
  5. Use cpio to combine the files
  6. Use gzip to compress the contents
  7. Use mkimage to wrap the contents
In the Windows world a command line utility simplifies this:
Code:
bootutil /v /x uRamdisk init.rc
Edit init.rc
Code:
bootutil /v /r uRamdisk init.rc
As always, be careful and make a backup.
Making a Clockwork Recovery update to restore the original uRamdisk might be a good idea.
Download bootutil.exe in the signature.

Cool!
Now we will see real hard core modding!
18th July 2012, 02:49 PM |#3  
Renate NST's Avatar
OP Inactive Recognized Developer / Recognized Contributor
Boston
Thanks Meter: 993
 
More
I've added delete to the operations of bootutil:
Code:
usage:  bootutil image file [...]
/d  delete files
/l  list files
/r  replace files
/x  extract files
/v  verbose
The Following 2 Users Say Thank You to Renate NST For This Useful Post: [ View ] Gift Renate NST Ad-Free
19th July 2012, 02:25 AM |#4  
Renate NST's Avatar
OP Inactive Recognized Developer / Recognized Contributor
Boston
Thanks Meter: 993
 
More
Here's some ideas of what you can do with bootutil.

Install adbd in /system/bin and chmod 755 it.
Delete both sbin and sbin/adbd from uRamdisk.
Change the start of adbd in init.rc from /sbin/adbd to /system/bin/adbd

Trim the cruft from PATH in init.rc and make it only /system/bin

Delete the whole secton in init.rc for the /data/media/B&N Downloads

Add a mount point for USB drives right before the root gets ro in init.rc

Delete all that stuff for /sys/devices/platform/omapdss
Where/when/what did that ever exist?
The Following User Says Thank You to Renate NST For This Useful Post: [ View ] Gift Renate NST Ad-Free
29th July 2012, 12:04 AM |#5  
Junior Member
Thanks Meter: 4
 
More
Renate, Thank you very much for your tool. I've been looking for a way to change mount point from /sdcard to /mnt/sdcard for a long time. With bootutil it's much easier.
How I did it:
1. Flash noogie.img to sdcard.
2. Boot from sdcard and connect NST to PC.
3. In partition manager assign letter to boot partition.(ex. MiniTool Partition Wizard)
4. Update mount points in init.rc at E:\uRamdisk with bootutil.(Don't forget to mkdir your mount points)
5. Remove letter from boot partition with partition manager.
6. Reboot NST.
7. Update mount points /system/etc/vold.conf
23rd August 2012, 02:27 AM |#6  
Renate NST's Avatar
OP Inactive Recognized Developer / Recognized Contributor
Boston
Thanks Meter: 993
 
More
I've added more stuff and more flags to bootutil.exe
It won't make a lot of difference for modifying just init.rc,
but it will allow you to make your own ramdisks and insert files and symlinks.

Code:
usage:  bootutil [flags] image file [file...]
/d  delete files
/g  group id
/i  insert before
/l  list files
/m  file mode
/n  new archive (name)
/r  replace files
/s  symlink (path)
/x  extract files
/u  user id
/v  verbose

# create 3 symlinks to busybox
bootutil /v uRamdisk /i /sbusybox date ls ps

# insert adbd before stuff with chmod 755
bootutil /v uRamdisk /istuff system/bin/adbd /m755
The Following User Says Thank You to Renate NST For This Useful Post: [ View ] Gift Renate NST Ad-Free
2nd March 2013, 02:51 AM |#7  
Member
Thanks Meter: 0
 
More
Error Messages
Many thanks for bootutil! I'm trying to modify the init in uRamdisk and am getting the following errors messages:

GZip signature not found OR

Image signature not found.

Any suggestions?

Thanks!
2nd March 2013, 06:38 AM |#8  
Renate NST's Avatar
OP Inactive Recognized Developer / Recognized Contributor
Boston
Thanks Meter: 993
 
More
Quote:
Originally Posted by dnordquest

Any suggestions?

Are you sure that what you have is a uRamdisk?
Try this:
Code:
C:\>bootutil /l /v uRamdisk
Read image, 11 files
drwxrwx--x                              data
-rw-r--r--        89  2013-02-08 08:54  default.prop
drwxr-xr-x                              dev
-rw-r--r--       324                    env.txt
-rwxr-x---    107344  2012-02-03 09:13  init
-rwxr-x---      1677                    init.goldfish.rc
-rwxr-x---     19131  2013-02-08 08:54  init.rc
-rwxr-x---     40205                    initlogo.rle
drwxr-xr-x                              proc
drwxr-xr-x                              sys
drwxr-xr-x                              system
Then try:
Code:
C:\>bootutil /x /v uRamdisk init
2nd March 2013, 12:39 PM |#9  
Member
Thanks Meter: 0
 
More
"Are you sure that what you have is a uRamdisk?"

When I try bootutil.exe on the uRamdisk from my boot directory, I get "Gzip signature not found."
When I try it on the uRamdisk from the binaries.zip file you linked to as a source for a good init, I get what you say I should get. The uRamdisk from my 1.2.1 updated, rooted NST is 182K. The uRamdisk that works is 168k. Should I look for another?

Thanks.
2nd March 2013, 06:37 PM |#10  
Renate NST's Avatar
OP Inactive Recognized Developer / Recognized Contributor
Boston
Thanks Meter: 993
 
More
I do have version 1.1, 1.1.2, 1.1.5, 1.2, 1.2.1 of the uRamdisk and they all work fine with bootutil.
Maybe whoever did your rooted uRamdisk did a sloppy job?
Get that file to me and I'll take a look.
Code:
E:\>bootutil /v /l E:\Nook11\ramdisk.img
Read image, 13 files
drwxrwx--x            data
-rw-r--r--       118  default.prop
drwxr-xr-x            dev
-rw-r--r--       324  env.txt
-rwxr-x---    127964  init
-rwxr-x---      1677  init.goldfish.rc
-rwxr-x---     18728  init.rc
-rwxr-x---     40205  initlogo.rle
drwxr-xr-x            proc
drwxr-x---            sbin
-rwxr-x---    134136  sbin/adbd
drwxr-xr-x            sys
drwxr-xr-x            system

E:\>bootutil /v /l E:\Nook112\ramdisk.img
Read image, 13 files
drwxrwx--x            data
-rw-r--r--       118  default.prop
drwxr-xr-x            dev
-rw-r--r--       324  env.txt
-rwxr-x---    127964  init
-rwxr-x---      1677  init.goldfish.rc
-rwxr-x---     18728  init.rc
-rwxr-x---     40205  initlogo.rle
drwxr-xr-x            proc
drwxr-x---            sbin
-rwxr-x---    134136  sbin/adbd
drwxr-xr-x            sys
drwxr-xr-x            system

E:\>bootutil /v /l E:\Nook115\ramdisk.img
Read image, 13 files
drwxrwx--x            data
-rw-r--r--       118  default.prop
drwxr-xr-x            dev
-rw-r--r--       324  env.txt
-rwxr-x---    127964  init
-rwxr-x---      1677  init.goldfish.rc
-rwxr-x---     19067  init.rc
-rwxr-x---     40205  initlogo.rle
drwxr-xr-x            proc
drwxr-x---            sbin
-rwxr-x---    134136  sbin/adbd
drwxr-xr-x            sys
drwxr-xr-x            system

E:\>bootutil /v /l E:\Nook12\ramdisk.img
Read image, 13 files
drwxrwx--x            data
-rw-r--r--       118  default.prop
drwxr-xr-x            dev
-rw-r--r--       324  env.txt
-rwxr-x---    128000  init
-rwxr-x---      1677  init.goldfish.rc
-rwxr-x---     19259  init.rc
-rwxr-x---     40205  initlogo.rle
drwxr-xr-x            proc
drwxr-x---            sbin
-rwxr-x---    134136  sbin/adbd
drwxr-xr-x            sys
drwxr-xr-x            system

E:\>bootutil /v /l E:\Nook121\ramdisk.img
Read image, 13 files
drwxrwx--x            data
-rw-r--r--       118  default.prop
drwxr-xr-x            dev
-rw-r--r--       324  env.txt
-rwxr-x---    128000  init
-rwxr-x---      1677  init.goldfish.rc
-rwxr-x---     19259  init.rc
-rwxr-x---     40205  initlogo.rle
drwxr-xr-x            proc
drwxr-x---            sbin
-rwxr-x---    134136  sbin/adbd
drwxr-xr-x            sys
drwxr-xr-x            system
The Following User Says Thank You to Renate NST For This Useful Post: [ View ] Gift Renate NST Ad-Free
3rd March 2013, 09:55 AM |#11  
Renate NST's Avatar
OP Inactive Recognized Developer / Recognized Contributor
Boston
Thanks Meter: 993
 
More
So, mystery solved.

My bootutil.exe never addressed the possibility of name or comment fields on the internal GZip.
It does now, download in the signature.
See also: http://forum.xda-developers.com/show...&postcount=137
The Following User Says Thank You to Renate NST For This Useful Post: [ View ] Gift Renate NST Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes