A way to save disk space is to use --depth=1 and repo sync with -c option 
as given here:

https://stackoverflow.com/questions/37937498/depth-1-option-with-google-repo?noredirect=1&lq=1

Size of AOSP10 reduced from: 51G to 18G

Now I can keep by AOSP On SDD for speed and have the out folder on HDD.
On Thursday, June 10, 2021 at 7:29:05 AM UTC+5:30 [email protected] wrote:

> Hi,
> what was the overall compilation time though, Mr. Ravishankar? (Also, what 
> branch/tag, board and make target were used?)
>
> For those who is limited with resources, It can be stripped even more, 
> (one can save ~16gb by removing .repo dir, some memory can be recovered by 
> using zram/compressed swap, and couple more gbs can be saved by using btrfs 
> with compression set to zstd=3,
>    mount ... -o compress=zstd:3 
>    btrfs property set /build/aosp/out compression ""
> To get some extra boost to compilation speed (in this configuration it'll 
> be more about preventing CPU choking), pass "mitigations=off selinux=0 
> audit=0" as kernel options and reboot; to run builds, try to stay lean 
> (make snod, m - ok, make all - not ok since it'll build some tests).
>
> And since this is not super obvious for some people, -Xmx4g is required in 
> this case because Java won't allocate enough heap without it, if there's 
> not enough physical memory. To investigate what takes time, one can open 
> build trace:
> > Just open $OUT_DIR/build.trace.gz in Chrome’s chrome://tracing,
>
> Enjoy,
>
> On Wed, Jun 9, 2021 at 4:25 AM Ravishankar S <[email protected]> 
> wrote:
>
>> I have completed by AOSP build on a 4 core 8GB machine with the following 
>> specs: 
>>
>> Ryzen 3 3300u, 1TB HDD, 8GB Dual channel RAM.  
>> Usable is 5.81G when fully booted into Kubuntu 20.04 (no apps running)
>>
>> 1) FIrst enable the zram on you system and reboot: sudo apt install 
>> zram-config. 
>>
>> 2) Default swapfile size is 2G. Its barely sufficient for the initial 
>> soong_ui phase.  Just scraped through. It should be increased to least 4GB. 
>> If you have the swapfile on SSD or  can move it to an SSD then its even 
>> better.
>>
>> (For sure this phase takes a lot of RAM (~12G) and lots of disk IO. It 
>> will take more time than normal as there is lots of swapping)
>>
>> 3)  Still in case the soong_ui phase does not get through then you can 
>> try to reduce  reduce the number of jobs say m -j3 or m -j2. 
>>
>> 4) The next phase is just compilation and other stuff that is not RAM 
>> intensive but mainly CPU and some Disk I/O. You can speed up this phase 
>> slightly by using tmfs for the /tmp folder.
>>
>> 5) The last phase is the documentation where Java is used and for this no 
>> amount of swap space will help and the system will crash for sure. We have 
>> the use the solution provided here and restart the make with just 1 job (m 
>> -j1)
>>
>>
>> https://stackoverflow.com/questions/60468693/java-outofmemoryerror-when-building-aosp-10/60474592#60474592
>>
>> export _JAVA_OPTIONS="-Xmx4g" 
>>
>> You can try to use m-j2 but it seemed fast enough with m -j1 and less 
>> pressure on RAM.
>>
>> Other resources are: 110GB disk space after checkout and 170GB after 
>> build.
>>
>>
>>    
>>
>> -- 
>> -- 
>> You received this message because you are subscribed to the "Android 
>> Building" mailing list.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-building?hl=en
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Android Building" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/android-building/bc27d026-a038-46c1-9143-c745e40a3b65n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/android-building/bc27d026-a038-46c1-9143-c745e40a3b65n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-building/00881c5d-b32c-4db8-9d60-08807a781904n%40googlegroups.com.

Reply via email to