I've downloaded Android source code. Now I want to make it for my own device (LG GT540). I heard that you need to create some 'Device configuration' for that. Although several developers have already created device configurations for my device, but I want to create my own, just for learning.
I saw a lot of files like BoardConfig.mk, AndroidProducts.mk, etc. But don't know what they do. Besides they contain a lot of configurations. Over that, there's not a good documentation for that.
Can anyone experienced with Android porting and device configurations help me?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Right... So you want to build your own device tree, read on.
Disclaimer: this is by no means complete, and there will be omissions as have explained all this top of my head and copied pasted certain bits that I have here on my own device tree.
The device tree, for example,
/device/lg/gt540
would consist of the following make files:/device/lg/gt540/libsensors
,/device/lg/gt540/liblights
,/device/lg/gt540/libcamera
etc./device/lg/gt540/device_gt540.mk
, this is specific also.device_gt540.mk
Lets peek into each of those to give a glance as to where it all fits in.
Android.mk:
This is how the build will use that to build recovery, sensors, lights and camera (of course there will be more), its saying 'Yo Builder, go into each of the directories specified, and build the respective sources plskthxbai'
AndroidBoard.mk:
Now this, is telling the build system, to be able to drop this kernel into the
out/target/product/lg/gt540
(notice the correlation with the device tree directory?)AndroidProducts.mk:
Its telling the build as in 'Yo Builder, read that device make file please and process it upon completion of build.'
*device_xxxxx.mk: (for this example, device_gt540.mk) *
This is where all the specifics for the device such as drivers, proprietary libraries, supporting scripts specifically for the device, gets copied over to
out/target/product/lg/gt540/system/
in this case. Notice how the overrides for the properties, these end up in thebuild.prop
found in the root of the/system
of the Android ROM.BoardConfig.mk:
That is an excerpt, notice how we specify kernel's base address, this is how the
boot.img
gets generated after compilation is done and yet again, gets dropped intoout/target/product/lg/gt540/boot.img
. Also, more importantly, we're telling the build system to use the target platform for cross-compiling the sources (*TARGET_BOARD_PLATFORM*/*TARGET_CPU_ABI*) There will be more information in there such as conditional flags to pass to the compiler, for an example. we specified the directiveHAVE_FM_RADIO
to tell it, when it comes to handling the source for the FM radio system, to conditionally compile parts of the source. Again, this is hardware specific and mileage will vary, also this applies to the address for boot. In a nutshell, this is saying 'Yo Builder, read the damn variables and remember them and apply them when cross-compiling those source files!'Now that the internals of each of those Android build make-files are shown.
Now, onto the
vendor/
part of it, in AOSP, simply, once again, correlation and corresponds with thedevice/
tree, as in continuing with this example,vendor/lg/gt540/
which gets picked up by thelunch
. There's more make files in there but the general consensus is there's a directory calledproprietary
which contains the proprietary libs (due to close-source etc) that gets copied over. The copying over of the libraries gets specified in the file device-vendor-blobs.mk, in this case,gt540-vendor-blobs.mk
.When the magic happens by doing the following:
This is reading in the entire entries found in each of the
device/
subdirectories and "remembers them", so the build system knows what type of target is used etc.When the
. lunch
gets invoked, a menu appears prompting to pick the device that is required to build. Now the last and final step to do the build...I run
multitail
on another terminal and monitor thebuildlog.log
file to check and make sure its building.This last step will depend on how many cores you have (n cores + 1 as a rule) and it takes a while to build, GB build takes 40mins on my laptop running Arch Linux 64bit, ICS build takes about 2hrs 30 mins. So mileage will vary on what type of horsepower your machine has.
When the build is done, a little bell goes off and at the bottom of the said log file, I see this:
As matter of interest JBQ (Jean Baptiste Queru - the 'boss' for managing/distributing the source from Google), his build step is this...
Yup! 32 cores! That..... is pretty powerful.
There is some information here: http://elinux.org/Android_Device
An excellent resource for anyone building Android for a device is here: http://com.odroid.com/sigong/nf_file_board/nfile_board_view.php?bid=98
(A Practical Real-World Approach To Android Platform Development In ODROID)
Though some of the stuff in there is particular to the ODROID board, it still offers great insight into the inner workings of Android and the necessary customization for a new board.
If you're looking to get into the hardware side of things probably the single most informative resource I've found has been:
http://source.android.com/compatibility/overview.html
Read through the documentation they wrote for manufacturers looking to build android devices, it's the most thorough/complete reference you will find.