Android: 3G/1G and 2G/2G kernels problem


MOD Android ROMを行っているときに遭遇する可能性のある問題は、BTのメーカーが持参しているkernelがCONFIGを持っていることです.VMSPLIT_2 G=yでコンパイルされていますが、このときAndroid上層部が3 Gのオフセットでprelinkをすると問題になり、解決策は以下の通りです.
 1, add the prelink-linux-arm-2G.map to build/core/and change its name to prelink-arm-2G.map if you have it; or just edit every libs' address in the old prelink-linux-arm.map, eg:
        old:          libdl.so                0xAFF00000 # [<64K]
        new:        libdl.so                0x6FF00000 # [<64K]
各ライブラリのprelinkアドレスから1 G減算
2, in bionic/linker/- edit the Android.mk:
ifneq ($(TARGET_USES_2G_VM_SPLIT),true)
# This is aligned to 4K page boundary so that both GNU ld and gold work.  Gold
# actually produces a correct binary with starting address 0xB0000100 but the
# extra objcopy step to rename symbols causes the resulting binary to be misaligned
# and unloadable.  Increasing the alignment adds an extra 3840 bytes in padding
# but switching to gold saves about 1M of space.
LINKER_TEXT_BASE := 0xB0001000
else
LINKER_TEXT_BASE := 0x70001000
LOCAL_CFLAGS += -DVM_SPLIT_2G
endif
書き換えLINKER_TEXT_BASEおよびマクロVM_の定義SPLIT_2 Gは、関連コードの動作を変更する.
3, in bionic/linker/- edit linker.h
#ifdef ARCH_SH
#define LIBBASE 0x60000000
#define LIBLAST 0x70000000
#define LIBINC  0x00100000
#elif defined(VM_SPLIT_2G)
#define LIBBASE 0x40000000
#define LIBLAST 0x50000000
#define LIBINC  0x00100000
#else
#define LIBBASE 0x80000000
#define LIBLAST 0x90000000
#define LIBINC  0x00100000
#endif

Android.mkで2 Gか3 GかLIBBASEとLIBLASTを選択
4, in build/tools/apriori - edit Android.mk, add:
ifeq ($(TARGET_USES_2G_VM_SPLIT),true)
LOCAL_CFLAGS += -DVM_SPLIT_2G
endif
 -edit prelinkmap.c, add:
#ifdef VM_SPLIT_2G
#define PRELINK_MAX 0x8FFFFFFF
#define PRELINK_MIN 0x50000000
#else
#define PRELINK_MIN 0x90000000
#define PRELINK_MAX 0xBFFFFFFF
#endif

5, in device/xxx/yyy/or vendor/xxx/yyy/- edit BoardConfig[_Common].mk、このすべてを有効にするスイッチをオンにします.
TARGET_USES_2G_VM_SPLIT := true

そしてメーカーのkernelを一緒にコンパイルすることができます.