NEXUS 4
haidragon@ubuntu:~/Desktop/android$ mkdir kernel_code
haidragon@ubuntu:~/Desktop/android$ ls
abi bionic build dalvik development docs extract-broadcom-hammerhead.sh extract-qcom-hammerhead.sh hardware libcore Makefile n5-4-4-4 out pdk sdk tools
art bootable cts developers device external extract-lge-hammerhead.sh frameworks kernel_code libnativehelper n4-4-4-4 ndk packages prebuilts system vendor
haidragon@ubuntu:~/Desktop/android$ cd kernel_code/
haidragon@ubuntu:~/Desktop/android/kernel_code$ ls
haidragon@ubuntu:~/Desktop/android/kernel_code$ git clone https://aosp.tuna.tsinghua.edu.cn/kernel/msm.git
Cloning into 'msm'...
remote: Counting objects: 7332827, done.
remote: Total 7332827 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (7332827/7332827), 1.55 GiB | 3.58 MiB/s, done.
Resolving deltas: 100% (6180720/6180720), done.
haidragon@ubuntu:~/Desktop/android/kernel_code$ ls
msm
haidragon@ubuntu:~/Desktop/android/kernel_code$ cd ..
haidragon@ubuntu:~/Desktop/android$ source build/envsetup.sh
including device/asus/flo/vendorsetup.sh
including device/asus/deb/vendorsetup.sh
including device/asus/tilapia/vendorsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/samsung/manta/vendorsetup.sh
including device/generic/mips/vendorsetup.sh
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/x86/vendorsetup.sh
including device/lge/mako/vendorsetup.sh
including device/lge/hammerhead/vendorsetup.sh
including sdk/bash_completion/adb.bash
haidragon@ubuntu:~/Desktop/android$ export ARCH=arm
haidragon@ubuntu:~/Desktop/android$ export CROSS_COMPILE=arm-eabi-
haidragon@ubuntu:~/Desktop/android$ cd kernel_code/
haidragon@ubuntu:~/Desktop/android/kernel_code$ cd msm
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ make mako_defconfig
make: *** No rule to make target 'mako_defconfig'. Stop.
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ make hammerhead_defconfig
make: *** No rule to make target 'hammerhead_defconfig'. Stop.
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ ls
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ ls
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ ls
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ cd ..
haidragon@ubuntu:~/Desktop/android/kernel_code$ ls
msm
haidragon@ubuntu:~/Desktop/android/kernel_code$ cd msm/
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ git branch -a
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ git checkout 99f5b2b
Checking out files: 100% (41565/41565), done.
Note: checking out '99f5b2b'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 99f5b2bda28d smd_pkt: Add sanity check to avoid unregistering the driver twice
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ ls
'=1 skip=$(LC_ALL=C grep -a -b -o $'\''x1fx8bx08x00x00x00x00x00'\'' kernel | cut -d '\'':'\'' -f 1) | zgrep -a '\''Linux version'\''' Kconfig arch fs make_defconfig.sh sound
AndroidKernel.mk MAINTAINERS block include mm tools
COPYING Makefile build.config init net usr
CREDITS README crypto ipc samples virt
Documentation REPORTING-BUGS drivers kernel scripts
Kbuild android firmware lib security
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ ls
'=1 skip=$(LC_ALL=C grep -a -b -o $'\''x1fx8bx08x00x00x00x00x00'\'' kernel | cut -d '\'':'\'' -f 1) | zgrep -a '\''Linux version'\''' Kconfig arch fs make_defconfig.sh sound
AndroidKernel.mk MAINTAINERS block include mm tools
COPYING Makefile build.config init net usr
CREDITS README crypto ipc samples virt
Documentation REPORTING-BUGS drivers kernel scripts
Kbuild android firmware lib security
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ ll
total 568
drwxr-xr-x 25 haidragon haidragon 4096 Jun 2 19:25 ./
drwxr-xr-x 3 haidragon haidragon 4096 Jun 2 18:45 ../
drwxr-xr-x 8 haidragon haidragon 4096 Jun 2 19:25 .git/
-rw-r--r-- 1 haidragon haidragon 1014 Jun 2 19:25 .gitignore
-rw-r--r-- 1 haidragon haidragon 4320 Jun 2 19:25 .mailmap
-rw-r--r-- 1 haidragon haidragon 21279 Jun 2 19:09 '=1 skip=$(LC_ALL=C grep -a -b -o $'\''x1fx8bx08x00x00x00x00x00'\'' kernel | cut -d '\'':'\'' -f 1) | zgrep -a '\''Linux version'\'''
-rw-r--r-- 1 haidragon haidragon 3520 Jun 2 19:25 AndroidKernel.mk
-rw-r--r-- 1 haidragon haidragon 18693 Jun 2 19:25 COPYING
-rw-r--r-- 1 haidragon haidragon 94984 Jun 2 19:25 CREDITS
drwxr-xr-x 96 haidragon haidragon 12288 Jun 2 19:25 Documentation/
-rw-r--r-- 1 haidragon haidragon 2536 Jun 2 19:25 Kbuild
-rw-r--r-- 1 haidragon haidragon 252 Jun 2 19:25 Kconfig
-rw-r--r-- 1 haidragon haidragon 210739 Jun 2 19:25 MAINTAINERS
-rw-r--r-- 1 haidragon haidragon 53736 Jun 2 19:25 Makefile
-rw-r--r-- 1 haidragon haidragon 17459 Jun 2 19:25 README
-rw-r--r-- 1 haidragon haidragon 3371 Jun 2 19:25 REPORTING-BUGS
drwxr-xr-x 3 haidragon haidragon 4096 Jun 2 19:25 android/
drwxr-xr-x 29 haidragon haidragon 4096 Jun 2 19:25 arch/
drwxr-xr-x 3 haidragon haidragon 4096 Jun 2 19:25 block/
-rw-r--r-- 1 haidragon haidragon 268 Jun 2 19:25 build.config
drwxr-xr-x 3 haidragon haidragon 4096 Jun 2 19:25 crypto/
drwxr-xr-x 106 haidragon haidragon 4096 Jun 2 19:25 drivers/
drwxr-xr-x 37 haidragon haidragon 4096 Jun 2 19:25 firmware/
drwxr-xr-x 72 haidragon haidragon 4096 Jun 2 19:25 fs/
drwxr-xr-x 22 haidragon haidragon 4096 Jun 2 19:25 include/
drwxr-xr-x 2 haidragon haidragon 4096 Jun 2 19:25 init/
drwxr-xr-x 2 haidragon haidragon 4096 Jun 2 19:25 ipc/
drwxr-xr-x 10 haidragon haidragon 4096 Jun 2 19:25 kernel/
drwxr-xr-x 9 haidragon haidragon 4096 Jun 2 19:25 lib/
-rwxr-xr-x 1 haidragon haidragon 565 Jun 2 19:25 make_defconfig.sh*
drwxr-xr-x 2 haidragon haidragon 4096 Jun 2 19:25 mm/
drwxr-xr-x 55 haidragon haidragon 4096 Jun 2 19:25 net/
drwxr-xr-x 13 haidragon haidragon 4096 Jun 2 19:25 samples/
drwxr-xr-x 13 haidragon haidragon 4096 Jun 2 19:25 scripts/
drwxr-xr-x 9 haidragon haidragon 4096 Jun 2 19:25 security/
drwxr-xr-x 23 haidragon haidragon 4096 Jun 2 19:25 sound/
drwxr-xr-x 13 haidragon haidragon 4096 Jun 2 19:25 tools/
drwxr-xr-x 2 haidragon haidragon 4096 Jun 2 19:25 usr/
drwxr-xr-x 3 haidragon haidragon 4096 Jun 2 19:25 virt/
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ git branch -r --conta××× 99f5b2b
origin/android-msm-mako-3.4-lollipop-mr1
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ git checkout -b android-msm-mako-3.4-lollipop-mr1 origin/android-msm-mako-3.4-lollipop-mr1
Branch 'android-msm-mako-3.4-lollipop-mr1' set up to track remote branch 'android-msm-mako-3.4-lollipop-mr1' from 'origin'.
Switched to a new branch 'android-msm-mako-3.4-lollipop-mr1'
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ git log
commit 99f5b2bda28d5e91dc10a1c17043ae0074fae81f (HEAD -> android-msm-mako-3.4-lollipop-mr1, tag: android-5.1.1_r0.9, origin/android-msm-mako-3.4-lollipop-mr1)
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ cd ../../
haidragon@ubuntu:~/Desktop/android$ source build/envsetup.sh
including device/asus/flo/vendorsetup.sh
including device/asus/deb/vendorsetup.sh
including device/asus/tilapia/vendorsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/samsung/manta/vendorsetup.sh
including device/generic/mips/vendorsetup.sh
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/x86/vendorsetup.sh
including device/lge/mako/vendorsetup.sh
including device/lge/hammerhead/vendorsetup.sh
including sdk/bash_completion/adb.bash
haidragon@ubuntu:~/Desktop/android$ cd -
/home/haidragon/Desktop/android/kernel_code/msm
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ export ARCH=arm
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ export CROSS_COMPILE=arm-eabi-
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ make mako_defconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
warning: (ARCH_MSM_KRAITMP && ARCH_MSM_CORTEX_A5) selects HAVE_HW_BRKPT_RESERVED_RW_ACCESS which has unmet direct dependencies (HAVE_HW_BREAKPOINT)
warning: (ARCH_MSM_KRAITMP && ARCH_MSM_CORTEX_A5) selects HAVE_HW_BRKPT_RESERVED_RW_ACCESS which has unmet direct dependencies (HAVE_HW_BREAKPOINT)
#
# configuration written to .config
#
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ echo ${PATH}
/home/haidragon/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/haidragon/Desktop/java-7-openjdk-amd64/bin
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ git clone https://aosp.tuna.tsinghua.edu.cn/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
Cloning into 'arm-eabi-4.6'...
fatal: repository 'https://aosp.tuna.tsinghua.edu.cn/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/' not found
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ export PATH=/home/haidragon/Desktop/android/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/:$PATH
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ echo ${PATH}
/home/haidragon/Desktop/android/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/:/home/haidragon/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/haidragon/Desktop/java-7-openjdk-amd64/bin
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ make mako_defconfig
warning: (ARCH_MSM_KRAITMP && ARCH_MSM_CORTEX_A5) selects HAVE_HW_BRKPT_RESERVED_RW_ACCESS which has unmet direct dependencies (HAVE_HW_BREAKPOINT)
warning: (ARCH_MSM_KRAITMP && ARCH_MSM_CORTEX_A5) selects HAVE_HW_BRKPT_RESERVED_RW_ACCESS which has unmet direct dependencies (HAVE_HW_BREAKPOINT)
#
# configuration written to .config
#
haidragon@ubuntu:~/Desktop/android/kernel_code/msm$ make -j16
scripts/kconfig/conf --silentoldconfig Kconfig
warning: (ARCH_MSM_KRAITMP && ARCH_MSM_CORTEX_A5) selects HAVE_HW_BRKPT_RESERVED_RW_ACCESS which has unmet direct dependencies (HAVE_HW_BREAKPOINT)
warning: (ARCH_MSM_KRAITMP && ARCH_MSM_CORTEX_A5) selects HAVE_HW_BRKPT_RESERVED_RW_ACCESS which has unmet direct dependencies (HAVE_HW_BREAKPOINT)
CHK include/linux/version.h
CC scripts/mod/empty.o
MKELF scripts/mod/elfconfig.h
HOSTCC scripts/mod/file2alias.o
错误整理:
https://blog.csdn.net/abc87891842/article/details/55051042
生成boot.img
刷入手机 发现无法启动 原因是有一个没有编译出来 编译镜像用错了。
NEXUS 5
5成功
make hammerhead_defconfig
haidragondeMacBook-Air:mako haidragon$ fastboot flash boot /Users/haidragon/Downloads/boot5.img
< waiting for any device >
^C
haidragondeMacBook-Air:mako haidragon$ adb reboot bootloader
haidragondeMacBook-Air:mako haidragon$ fastboot flash boot /Users/haidragon/Downloads/boot5.img
Sending 'boot' (8704 KB) OKAY [ 0.490s]
Writing 'boot' OKAY [ 0.747s]
Finished. Total time: 1.437s
haidragondeMacBook-Air:mako haidragon$ fastboot reboot
Rebooting OKAY [ 0.001s]
Finished. Total time: 0.001s
haidragondeMacBook-Air:mako haidragon$
编译成功是这样的 要编译出zImage-dtb 4手机内核没编译出来
参考:
https://blog.csdn.net/u012417380/article/details/73353670
转载于:https://blog.51cto.com/haidragon/2404104