Rooting the Galaxy Nexus

The essential part of the Superboot image is a small shellscript. Actually the entire boot environment is only there so this shell script can be successfully executed. The script consists of the following commands:
mount -o rw,remount -t ext4 /dev/block/platform/omap/omap_hsmmc.0/by-name/system /system
rm /system/bin/su
rm /system/xbin/su
mkdir /system/xbin
cat /superboot/su>/system/xbin/su
chmod 6755 /system/xbin/su
cat /superboot/Superuser.apk>/system/app/Superuser.apk
mount -o ro,remount -t ext4 /dev/block/platform/omap/omap_hsmmc.0/by-name/system /system

Lets see what it does:
  1. Remounts the /system directory as read-writable (by default it's mounted as read-only).
  2. Removes any optionally existing occurances of su from /system/bin or /system/xbin.
  3. Creates the /system/xbin directory (in case it does not exist yet).
  4. Copies a version of su to /system/xbin and the Superuser app to /system/app.
  5. Sets the permission on su to world-executable and sets the setuid and setgid bits/flags.
  6. Remounts the /system directory as read-only.
That's all it takes to make your phone "rooted". Of course the point is that this su version supports the permission database of the accompanying Superuser app. Smile So only those apps will get root privilege through a call to the the su executable, which you grant permission to do so.