Saturday, November 24, 2012


How to maintain various versions with the same target binary inside android file system ???


In Android, whatever folders with Android.mk files are added to external folder in android file system,while building the android, it will be compiled.

   I faced an interesting problem.  Wifi need wpa_supplicant. There are multiple wpa_supplicants are available in external folder. I could not figure it out which one will be compiled.
   external/wpa_supplicant
   external/wpa_supplicant_6
   external/wpa_supplicant_8

Because whatever things we copied to external folder, if it has Android.mk, then that folder will be compiled.
All 3 folders are having same target binary [wpa_supplicant,wpa_cli]. If we have multiple target binary with the same name, compilation will fail.

I analysed and found that in device.../BoardConfig.mk will have the macro to specify the WPA_SUPPLICANT_VERSION=0_x_8.0

if the WPA_SUPPLICANT_VERSION is 5.0, wpa_supplicant folder will be compiled.
if the WPA_SUPPLICANT_VERSION is 6.0, wpa_supplicant_6 folder will be compiled.
if the WPA_SUPPLICANT_VERSION is 8.0, wpa_supplicant_8 folder will be compiled.

within the external/wpa_supplicant/Android.mk if the WPA_SUPPLICANT_VERSION == 0_x_5.0, then only the folder source codes will be compiled.
within the external/wpa_supplicant6/Android.mk if the WPA_SUPPLICANT_VERSION == 0_x_6.0, then only the folder source codes will be compiled.
within the external/wpa_supplicant8/Android.mk if the WPA_SUPPLICANT_VERSION == 0_x_8.0, then only the folder source codes will be compiled.
Target android board can have any supplicant version, it might be 5.0 /6.0/8.0.


   Lessons learnt:
  
   we can have multiple versions of the same binary under external folder,decide which version to be compiled based on target board.

  where I can apply:

     Assume that TI android board has various accelerators for display.Some TI boards will use x hardware accelerators for display. Some boards will use Y hardware accelerators for display. We can use same target binary  so it can either use x hardware accelerator or y hardware accelerator for display based on BoardConfig. Finaly display binary is same.

 we can not put only x hardware accelerator source code in android. It will fail while compiling for Y hardware accelerator source.
User has to take care of copying the code based hardware accelerator. Or else we can copy x and y hardware accelerator code and decide which
one to be compiled by boardconfig.mk macros .



 

No comments: