How to add kernel source code to aosp build image

314 views
Skip to first unread message

Aditya Parmar

unread,
Jun 3, 2017, 4:13:52 PM6/3/17
to android-porting
I have HTC's kernel source code for my device but the issue is I can't add it to my aosp build anyone please tell me how to do that.

Thank you.

Joey Troy

unread,
Jul 12, 2017, 3:49:10 PM7/12/17
to android-porting
There was an article some time ago by JB and he said AOSP was not designed to have the kernel built with the code. I would recommend building your kernel and then create a folder structure like the following

android/devices/htc/device_name (your device files)
android/device/htc/device_name_kernel (your kernel file goes in here)

and then in your device.mk file have something like the following this taken from htc flounder

ifeq ($(TARGET_PREBUILT_KERNEL),)
ifeq
($(USE_SVELTE_KERNEL), true)
LOCAL_KERNEL
:= device/htc/flounder_svelte-kernel/Image.gz-dtb
else
LOCAL_KERNEL
:= device/htc/flounder-kernel/Image.gz-dtb
endif
# USE_SVELTE_KERNEL
else
LOCAL_KERNEL
:= $(TARGET_PREBUILT_KERNEL)
endif


BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE
:= f2fs


# This ensures the needed build tools are available.
# TODO: make non-linux builds happy with external/f2fs-tool; system/extras/f2fs_utils
ifeq
($(HOST_OS),linux)
TARGET_USERIMAGES_USE_F2FS
:= true
endif


LOCAL_FSTAB
:= $(LOCAL_PATH)/fstab.flounder




TARGET_RECOVERY_FSTAB
= $(LOCAL_FSTAB)


PRODUCT_COPY_FILES
:= \
    $
(LOCAL_KERNEL):kernel \
    $
(LOCAL_PATH)/init.flounder.rc:root/init.flounder.rc \
    $
(LOCAL_PATH)/init.flounder.usb.rc:root/init.flounder.usb.rc \
    $
(LOCAL_PATH)/init.recovery.flounder.rc:root/init.recovery.flounder.rc \
    $
(LOCAL_FSTAB):root/fstab.flounder \
    $
(LOCAL_PATH)/ueventd.flounder.rc:root/ueventd.flounder.rc
Reply all
Reply to author
Forward
0 new messages