Why system.img built from Android source code is much smaller than the factory system.img?

1,271 views
Skip to first unread message

Tony

unread,
Oct 18, 2014, 3:41:08 AM10/18/14
to android-...@googlegroups.com

Hello, 

I checked out the Android source code from the official website, and built it locally.

I was using Android source code 4.4.

My target device is Nexus 7 (2013, Wifi).

According to Android document (https://source.android.com/source/building-devices.html),

I selected aosp_flo-userdebug in lunch.

Then, I built the code using make -j16.

After it succeed, I found the images in my OUT folder.

    -rw-r--r-- 1 user user 7.0M Oct 17 17:57 boot.img
    -rw-r--r-- 1 user user 4.6M Oct 17 17:14 cache.img
    -rw-rw-r-- 1 user user 567K Oct 17 17:55 ramdisk.img
    -rw-rw-r-- 1 user user 1.2M Oct 17 17:57 ramdisk-recovery.img
    -rw-r--r-- 1 user user 7.6M Oct 17 17:57 recovery.img
    **-rw-r--r-- 1 user user 260M Oct 17 18:14 system.img**
    -rw-r--r-- 1 user user 134M Oct 17 18:06 userdata.img

I used fastboot to flash these images to my device, but it seems not work...

Therefore, I have to flash it back using factory images (https://developers.google.com/android/nexus/images).

I downloaded the one for my device, which is "razor" for Nexus 7 [2013] (Wi-Fi).

After flashing the device with new images, it works again...

I checked the factory images, and found out that:

    -rw-r--r-- 1 user user 6.9M Jan  1  2009 boot.img
    -rw-r----- 1 user user 3.9M Nov 19  2013 bootloader-flo-flo-04.01.img
    -rw------- 1 user user 4.6M Nov 15  2013 cache.img
    -rw-r--r-- 1 user user 7.4M Jan  1  2009 recovery.img
    **-rw-r--r-- 1 user user 689M Jan  1  2009 system.img**
    -rw------- 1 user user 134M Nov 15  2013 userdata.img

Everything seems to be good, except two things:

  1. My system.img is only 260M, while the official one is about 690M.

  2. The official one comes with a bootloader.img, while mine does not.

Did I do anything wrong in the compiling/building?

And, why there is a huge size difference between my system.img and the official one?

Thanks a lot for your help!

Glenn Kasten

unread,
Oct 18, 2014, 10:54:52 AM10/18/14
to android-...@googlegroups.com
The factory image includes proprietary software (for example, GMS),
whereas images built directly from AOSP do not.
That will explain part of the size difference.

But the fact that the images you built from AOSP don't boot
might indicate another problem ... perhaps your build is incomplete?
Sorry, I don't know how to help with this.

Tony

unread,
Oct 18, 2014, 3:09:37 PM10/18/14
to android-...@googlegroups.com
Hello Glenn,

Thanks a lot for your response. I double checked with the result of compile. 
It seems to be no error during the compiling. 
Enclosed is a screenshot of the final output. It says "make completed successfully"...

So, I think there is no problem in the make process.
But did I choose the right lunch option for NEXUS 7 (2013, wifi)? I am using aosp_flo-userdebug now. Is there any other option that I can obtain larger image that matches the factory image? 

Thanks a lot!
And, I am appreciated to anyone who can offer any suggestions. Thanks!
make-j16.png

Benoit Fouet

unread,
Oct 20, 2014, 10:18:19 AM10/20/14
to android-...@googlegroups.com
Hi,


Le 18/10/2014 21:09, Tony a écrit :
Hello Glenn,

Thanks a lot for your response. I double checked with the result of compile. 
It seems to be no error during the compiling. 
Enclosed is a screenshot of the final output. It says "make completed successfully"...

So, I think there is no problem in the make process.
But did I choose the right lunch option for NEXUS 7 (2013, wifi)? I am using aosp_flo-userdebug now. Is there any other option that I can obtain larger image that matches the factory image? 


Did you also get the proprietary binaries that are needed to boot your device?
See https://source.android.com/source/building-devices.html for details.

--
Ben

Tony

unread,
Oct 20, 2014, 11:18:00 PM10/20/14
to android-...@googlegroups.com
Hi Ben, 

Thanks a lot for your help. 
Yes, I indeed found that I missed one binary file for my device....
So now, after I flash my device using fastboot, it works like a charm!

Thanks a lot! And thanks to all!

Tony Petro

unread,
Sep 12, 2015, 4:54:41 PM9/12/15
to Android Building
Hi Tony,

What was the fix for you?  I am having the exact same problem that you had:  After successfully building the android (aosp) source, I am unable to successfully flash the device.  I used fastboot with the images that I created and it does not work.
But I can use the factory images to flash and that does work.  I was wondering how you were able to flash your device with your compiled images.

Thank you!!!!

-Tony P.
Reply all
Reply to author
Forward
0 new messages