Skip to main content
Fixed machine ID.
Source Link
ttsiodras
  • 691
  • 2
  • 5
  • 12
#linuxbox# gdb --args fastboot flash system system.img
...
#linuxbox# mkdir /system
#linuxbox# mount -o loop,ro system.img /system
#linuxbox# ls -l /system
total 208
drwxr-xr-x 106 root root   8192 Sep 17 22:24 app
drwxr-xr-x   3 root 2000   8192 Sep 26 21:08 bin
-rw-r--r--   1 root root   6847 Sep 12 16:59 build.prop
drwxr-xr-x  19 root root   4096 Sep 26 21:08 etc
drwxr-xr-x   2 root root   4096 Aug 11 22:27 fonts
drwxr-xr-x   4 root root   4096 Sep 12 16:56 framework
drwxr-xr-x  10 root root  16384 Sep 12 16:59 lib
drwxr-xr-x   2 root root   4096 Jan  1  1970 lost+found
drwxr-xr-x   3 root root   4096 Aug 11 22:18 media
drwxr-xr-x  59 root root   4096 Aug 11 22:29 priv-app
-rw-r--r--   1 root root 126951 Aug  1  2008 recovery-from-boot.p
drwxr-xr-x   3 root root   4096 Aug 11 21:02 scripts
drwxr-xr-x   3 root root   4096 Aug 11 21:02 tts
drwxr-xr-x  11 root root   4096 Sep 26 21:08 usr
drwxr-xr-x   8 root 2000   4096 Aug 11 22:29 vendor
drwxr-xr-x   2 root 2000   4096 Sep 26 21:09 xbin
    
#linuxbox# ../extras/source/extras/ext4_utils/make_ext4fs \
      -l 2048M new_system.img /system
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 2666/131072 inodes and 375014/524288 blocks
#linuxbox# fastboot flash system new_system.img
erasing 'system'...
OKAY [  0.064s]
sending 'system' (2088960 KB)...
^C
#linuxbox# ../extras/source/extras/ext4_utils/make_ext4fs \
      -l 1536M new_system.img /system

#linuxbox#  ./fastboot flash system system.img 
erasing 'system'...
OKAY [  0.065s]
sending 'system' (1572864 KB)...
OKAY [ 51.039s]
writing 'system'...
OKAY [235.080s]
finished. total time: 286.183s
#linuxbox# unzip -l /opt/vendor/Asus/firmware/UL-K01E-WW-12.16.1.12-user.zip |\
     grep boot.img$
7368704  2011-03-22 11:21   boot.img
$linuxbox$ mkdir rootfs
$linuxbox$ cd rootfs
$linuxbox$ abootimg -x /path/to/boot.img
$linuxbox$ ls -l
bootimg.cfg
initrd.img
zImage
$linuxbox$ mkdir initrd
$linuxbox$ cd initrd
$linuxbox$ gzip -cd ../initrd.img | cpio -ivd
...
$linuxbox$ vi default.prop

First, let'sI set up default.prop to be root onwhen the booted kernel boots:

I also copied the /system/bin/sh (from the over-the-air Asus .zip file) into /sbin/sh - from the over-the-air Asus .zip file. I did the same forwith busybox - quite handy tool.

$busybox$ find . | cpio --create --format='newc' | gzip -9 > ../initrd.custom.gz
$busybox$ cd ..
$busybox$ abootimg --create ../new_boot_busybox.img \
    -f bootimg.cfg -k zImage -r initrd.custom.gz
linuxbox# fastboot boot new_boot_busybox.img

And...and witness the following...

#linuxbox# adb logcat
- exec '/system/bin/sh' failed: Permission denied (13) -

#linuxbox# adb shell
- exec '/system/bin/sh' failed: Permission denied (13) -
#linuxbox# adb root
restarting adbd as root

#linuxbox# adb shell
- exec '/system/bin/sh' failed: Permission denied (13) -
#linuxbox# adb shell
- exec '/sbin/sh' failed: Permission denied (13) -
#linuxbox# adb pull /proc/partitions
15 KB/s (1272 bytes in 0.079s)
#linuxbox# adb pull /proc/mounts
16 KB/s (1358 bytes in 0.079s)

#linuxbox# grep system mounts
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 rw,seclabel,relatime,data=ordered 0 0
#linuxbox# adb pull /system
remote object '/system' does not exist
#linuxbox# adb pull /proc/kmsg
failed to copy '/proc/kmsg' to './kmsg': Operation not permitted
#linuxbox# adb push /sbin/sh /system/bin/sh
failed to copy '/sbin/sh' to '/system/bin/sh': Permission denied
# gdb --args fastboot flash system system.img
...
# mkdir /system
# mount -o loop,ro system.img /system
# ls -l /system
total 208
drwxr-xr-x 106 root root   8192 Sep 17 22:24 app
drwxr-xr-x   3 root 2000   8192 Sep 26 21:08 bin
-rw-r--r--   1 root root   6847 Sep 12 16:59 build.prop
drwxr-xr-x  19 root root   4096 Sep 26 21:08 etc
drwxr-xr-x   2 root root   4096 Aug 11 22:27 fonts
drwxr-xr-x   4 root root   4096 Sep 12 16:56 framework
drwxr-xr-x  10 root root  16384 Sep 12 16:59 lib
drwxr-xr-x   2 root root   4096 Jan  1  1970 lost+found
drwxr-xr-x   3 root root   4096 Aug 11 22:18 media
drwxr-xr-x  59 root root   4096 Aug 11 22:29 priv-app
-rw-r--r--   1 root root 126951 Aug  1  2008 recovery-from-boot.p
drwxr-xr-x   3 root root   4096 Aug 11 21:02 scripts
drwxr-xr-x   3 root root   4096 Aug 11 21:02 tts
drwxr-xr-x  11 root root   4096 Sep 26 21:08 usr
drwxr-xr-x   8 root 2000   4096 Aug 11 22:29 vendor
drwxr-xr-x   2 root 2000   4096 Sep 26 21:09 xbin
    
# ../extras/source/extras/ext4_utils/make_ext4fs \
      -l 2048M new_system.img /system
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 2666/131072 inodes and 375014/524288 blocks
# fastboot flash system new_system.img
erasing 'system'...
OKAY [  0.064s]
sending 'system' (2088960 KB)...
^C
# ../extras/source/extras/ext4_utils/make_ext4fs \
      -l 1536M new_system.img /system

#  ./fastboot flash system system.img 
erasing 'system'...
OKAY [  0.065s]
sending 'system' (1572864 KB)...
OKAY [ 51.039s]
writing 'system'...
OKAY [235.080s]
finished. total time: 286.183s
# unzip -l /opt/vendor/Asus/firmware/UL-K01E-WW-12.16.1.12-user.zip |\
     grep boot.img$
7368704  2011-03-22 11:21   boot.img
$ mkdir rootfs
$ cd rootfs
$ abootimg -x /path/to/boot.img
$ ls -l
bootimg.cfg
initrd.img
zImage
$ mkdir initrd
$ cd initrd
$ gzip -cd ../initrd.img | cpio -ivd
...
$ vi default.prop

First, let's set up to be root on the booted kernel:

I also copied the /system/bin/sh into /sbin/sh - from the over-the-air Asus .zip file. I did the same for busybox.

$ find . | cpio --create --format='newc' | gzip -9 > ../initrd.custom.gz
$ cd ..
$ abootimg --create ../new_boot_busybox.img \
    -f bootimg.cfg -k zImage -r initrd.custom.gz

And witness the following...

# adb logcat
- exec '/system/bin/sh' failed: Permission denied (13) -

# adb shell
- exec '/system/bin/sh' failed: Permission denied (13) -
# adb root
restarting adbd as root

# adb shell
- exec '/system/bin/sh' failed: Permission denied (13) -
# adb shell
- exec '/sbin/sh' failed: Permission denied (13) -
# adb pull /proc/partitions
15 KB/s (1272 bytes in 0.079s)
# adb pull /proc/mounts
16 KB/s (1358 bytes in 0.079s)

# grep system mounts
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 rw,seclabel,relatime,data=ordered 0 0
# adb pull /system
remote object '/system' does not exist
# adb pull /proc/kmsg
failed to copy '/proc/kmsg' to './kmsg': Operation not permitted
# adb push /sbin/sh /system/bin/sh
failed to copy '/sbin/sh' to '/system/bin/sh': Permission denied
linuxbox# gdb --args fastboot flash system system.img
...
linuxbox# mkdir /system
linuxbox# mount -o loop,ro system.img /system
linuxbox# ls -l /system
total 208
drwxr-xr-x 106 root root   8192 Sep 17 22:24 app
drwxr-xr-x   3 root 2000   8192 Sep 26 21:08 bin
-rw-r--r--   1 root root   6847 Sep 12 16:59 build.prop
drwxr-xr-x  19 root root   4096 Sep 26 21:08 etc
drwxr-xr-x   2 root root   4096 Aug 11 22:27 fonts
drwxr-xr-x   4 root root   4096 Sep 12 16:56 framework
drwxr-xr-x  10 root root  16384 Sep 12 16:59 lib
drwxr-xr-x   2 root root   4096 Jan  1  1970 lost+found
drwxr-xr-x   3 root root   4096 Aug 11 22:18 media
drwxr-xr-x  59 root root   4096 Aug 11 22:29 priv-app
-rw-r--r--   1 root root 126951 Aug  1  2008 recovery-from-boot.p
drwxr-xr-x   3 root root   4096 Aug 11 21:02 scripts
drwxr-xr-x   3 root root   4096 Aug 11 21:02 tts
drwxr-xr-x  11 root root   4096 Sep 26 21:08 usr
drwxr-xr-x   8 root 2000   4096 Aug 11 22:29 vendor
drwxr-xr-x   2 root 2000   4096 Sep 26 21:09 xbin
    
linuxbox# ../extras/source/extras/ext4_utils/make_ext4fs \
      -l 2048M new_system.img /system
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 2666/131072 inodes and 375014/524288 blocks
linuxbox# fastboot flash system new_system.img
erasing 'system'...
OKAY [  0.064s]
sending 'system' (2088960 KB)...
^C
linuxbox# ../extras/source/extras/ext4_utils/make_ext4fs \
      -l 1536M new_system.img /system

linuxbox#  ./fastboot flash system system.img 
erasing 'system'...
OKAY [  0.065s]
sending 'system' (1572864 KB)...
OKAY [ 51.039s]
writing 'system'...
OKAY [235.080s]
finished. total time: 286.183s
linuxbox# unzip -l /opt/Asus/firmware/UL-K01E-WW-12.16.1.12-user.zip |\
     grep boot.img$
7368704  2011-03-22 11:21   boot.img
linuxbox$ mkdir rootfs
linuxbox$ cd rootfs
linuxbox$ abootimg -x /path/to/boot.img
linuxbox$ ls -l
bootimg.cfg
initrd.img
zImage
linuxbox$ mkdir initrd
linuxbox$ cd initrd
linuxbox$ gzip -cd ../initrd.img | cpio -ivd
...
linuxbox$ vi default.prop

I set up default.prop to be root when the kernel boots:

I also copied /system/bin/sh (from the over-the-air Asus .zip file) into /sbin/sh. I did the same with busybox - quite handy tool.

busybox$ find . | cpio --create --format='newc' | gzip -9 > ../initrd.custom.gz
busybox$ cd ..
busybox$ abootimg --create ../new_boot_busybox.img \
    -f bootimg.cfg -k zImage -r initrd.custom.gz
linuxbox# fastboot boot new_boot_busybox.img

...and witness the following...

linuxbox# adb logcat
- exec '/system/bin/sh' failed: Permission denied (13) -

linuxbox# adb shell
- exec '/system/bin/sh' failed: Permission denied (13) -
linuxbox# adb root
restarting adbd as root

linuxbox# adb shell
- exec '/system/bin/sh' failed: Permission denied (13) -
linuxbox# adb shell
- exec '/sbin/sh' failed: Permission denied (13) -
linuxbox# adb pull /proc/partitions
15 KB/s (1272 bytes in 0.079s)
linuxbox# adb pull /proc/mounts
16 KB/s (1358 bytes in 0.079s)

linuxbox# grep system mounts
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 rw,seclabel,relatime,data=ordered 0 0
linuxbox# adb pull /system
remote object '/system' does not exist
linuxbox# adb pull /proc/kmsg
failed to copy '/proc/kmsg' to './kmsg': Operation not permitted
linuxbox# adb push /sbin/sh /system/bin/sh
failed to copy '/sbin/sh' to '/system/bin/sh': Permission denied
Typo
Source Link
ttsiodras
  • 691
  • 2
  • 5
  • 12

Thisabootimg actually failed the first time I run this, since I had to update the bootimg.cfg  had to be updated - the bootsize parameter had to the updatedbe changed, since the package is bigger now. abootimg reports what it needs, so that's easy enough.

This actually failed the first time, since I had to update the bootimg.cfg  - the bootsize parameter had to the updated since the package is bigger now. abootimg reports what it needs, so that's easy enough.

abootimg actually failed the first time I run this, since bootimg.cfg had to be updated - the bootsize parameter had to be changed, since the package is bigger now. abootimg reports what it needs, so that's easy enough.

Removed erroneous paste.
Source Link
ttsiodras
  • 691
  • 2
  • 5
  • 12
linux_box# fastboot devices
0a3dXXXX     fastboot

linux_box# mount /dev/sdcard /mnt/sdcardfor a New Backupfor a New Backupsdcard
linux_box# cp /mnt/sdcard/system.img .
linux_box# fastboot flash system system.img
error: cannot load 'system.img'
linux_box# fastboot devices
0a3dXXXX     fastboot

linux_box# mount /dev/sdcard /mnt/sdcardfor a New Backupfor a New Backup
linux_box# cp /mnt/sdcard/system.img .
linux_box# fastboot flash system system.img
error: cannot load 'system.img'
linux_box# fastboot devices
0a3dXXXX     fastboot

linux_box# mount /dev/sdcard /mnt/sdcard
linux_box# cp /mnt/sdcard/system.img .
linux_box# fastboot flash system system.img
error: cannot load 'system.img'
Tweeted twitter.com/#!/StackAndroid/status/648840932431896576
Stage 2 - Trying to solve this over a custom boot image
Source Link
ttsiodras
  • 691
  • 2
  • 5
  • 12
Loading
Source Link
ttsiodras
  • 691
  • 2
  • 5
  • 12
Loading