■ 커널 소스코드 다운로드
http://opensource.samsung.com/reception/receptionSub.do?method=sub&sub=F&searchValue=shv-e160s
■ 툴체인 다운로드
arm-eabi-4.4.3
■ 오리지널 boot.img 가져오기
root 권한으로 adb shell에서 아래를 실행하여 원본 boot.img를 sdcard에 넣는다.
su
dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=/storage/sdcard0/boot.img.orig bs=4096
■ 오리지널 boot.img 분해 및 정보보기
../boot.img.orig/unpackbootimg -i ../boot.img.orig/boot.img.orig
※ BOARD_KERNEL_CMDLINE을 정확히 보기 위해서는 폰에서 /proc/cmdline을 cat 하면 된다.
■ 커널 CONFIG 복사
내 설정을 저장하기 위해 복사본으로 작업한다.
cp -f arch/arm/configs/q1_kor_skt_defconfig ./configs/hasu0707_defconfig
■ 커널에 OTG 및 USB시리얼 드라이버 추가
./configs/hasu0707_defconfig 파일에서 아래를 적당한 위치에 추가.
# by hasu0707
CONFIG_USB_SERIAL_CP210X=y
CONFIG_USB_SERIAL_FTDI_SIO=y
■ 커널 빌드
../scripts/build.sh
■ 커널 적용
fastboot boot new_boot.img
■ 결과
실패ㅠㅠ
■ scripts/build.sh
#!/bin/sh
###########################################################
#
# build.sh : kernel/ 밑에서 작업 할 것.
#
###########################################################
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
export KERNEL_BUILD_ID=hasu0707
export TOOLCHAIN=/opt/kernel_samsung_shv-e160s/arm-eabi-4.4.3
export PATH=${TOOLCHAIN}/bin:${PATH}
###########################################################
#
# 나만의 커널 설정을 만들어 놓고 그것을 사용해 빌드한다.
#
###########################################################
cp -f ../configs/${KERNEL_BUILD_ID}_defconfig ./arch/arm/configs/
mkdir -p ./${KERNEL_BUILD_ID}/kernel
mkdir -p ./${KERNEL_BUILD_ID}/ko
make ARCH=arm V=0 O=./${KERNEL_BUILD_ID}/kernel/ CROSS_COMPILE=${TOOLCHAIN}/bin/arm-eabi- ${KERNEL_BUILD_ID}_defconfig zImage
make -j8 ARCH=arm O=./${KERNEL_BUILD_ID}/kernel/ 2>&1 | tee ${KERNEL_BUILD_ID}_kernel.log
###########################################################
#
# zImage가 생성되어 있으면 빌드가 정상적으로 된 것이므로
# mkbootimg를 사용해 new_boot.img를 만든다.
# mkbootimg 파라메터는 기종마다 다르다.
#
###########################################################
if [ -f ./${KERNEL_BUILD_ID}/kernel/arch/arm/boot/zImage ]
then
cp -f ./${KERNEL_BUILD_ID}/kernel/arch/arm/boot/zImage ./
find ./${KERNEL_BUILD_ID}/kernel -name "*.ko" -print -exec cp -f {} ./${KERNEL_BUILD_ID}/ko/ \;
../scripts/mkbootimg --kernel zImage --ramdisk ../boot.img.orig/boot.img.orig-ramdisk.gz --base 0x48000000 --pagesize 2048 --cmdline 'androidboot.hardware=qcom kgsl.mmutype=gpummu vmalloc=400M usb_id_pin_rework=true' -o new_boot.img
echo "### COMPLETE !! ###"
fi
■ scripts/clean.sh
#!/bin/sh
###########################################################
#
# clean.sh : kernel/ 밑에서 작업하는 것으로 셋팅되어 있음.
#
###########################################################
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
export KERNEL_BUILD_ID=hasu0707
export TOOLCHAIN=/opt/kernel_samsung_shv-e160s/arm-eabi-4.4.3
export PATH=${TOOLCHAIN}/bin:${PATH}
make mrproper
if [ -d ./${KERNEL_BUILD_ID}/ ]
then
rm -rf ./${KERNEL_BUILD_ID}/
fi
if [ -f ./zImage ]
then
rm ./zImage
fi
if [ -f ./new_boot.img ]
then
rm -rf ./new_boot.img
fi
rm -f ./arch/arm/configs/${KERNEL_BUILD_ID}_defconfig
rm -f ./${KERNEL_BUILD_ID}_kernel.log