快速編譯kernel

2021-08-28 05:20:25 字數 3735 閱讀 2930

source build/envsetup.sh

lunch xx

make showcommands bootimage  >build.log

通過引數showcommands 將編譯的命令顯示出來,

比如原來編譯命令是make -j4 但是編譯的細節沒看到,如果要顯示編譯的命令可以用引數showcommands

a.touch buld_kernel.sh

b.複製第二步編譯的build.log中 bin/bash -c 開始的每一段到buld_kernel.sh裡

c.在指令碼之前加上 source 和 lunch 就可以了

d.增加可執行全限

chmod +x buld_kernel.sh

./build_kernel.sh

注:以後每次編譯使用這個指令碼就可以了

下面是製作的指令碼

source build/envsetup.sh

lunch 19

/bin/bash -c "(if [ ! -z \"hq_sdm450_defconfig\" ]; then            rm -f ../../out/target/product/hq_sdm450/obj/kernel/msm-4.9/.config;            make -j2 -c kernel/msm-4.9 o=../../out/target/product/hq_sdm450/obj/kernel/msm-4.9 dtc_ext=dtc config_build_arm64_dt_overlay=y arch=arm64 cross_compile=aarch64-linux-android- hq_sdm450_defconfig;             make -j2 -c kernel/msm-4.9 o=../../out/target/product/hq_sdm450/obj/kernel/msm-4.9 dtc_ext=dtc config_build_arm64_dt_overlay=y arch=arm64 cross_compile=aarch64-linux-android- headers_install;         if [ -d \"out/target/product/hq_sdm450/obj/kernel/msm-4.9/usr/include/bringup_headers\" ]; then                 cp -rf  out/target/product/hq_sdm450/obj/kernel/msm-4.9/usr/include/bringup_headers/* out/target/product/hq_sdm450/obj/kernel/msm-4.9/usr/include/ ;            fi ;            fi ) && (if [ \"hq_sdm450_defconfig\" != \"hq_sdm450_defconfig\" ]; then            echo \"used a different defconfig for header generation\";          rm -f ../../out/target/product/hq_sdm450/obj/kernel/msm-4.9/.config;            make -j2 -c kernel/msm-4.9 o=../../out/target/product/hq_sdm450/obj/kernel/msm-4.9 dtc_ext=dtc config_build_arm64_dt_overlay=y arch=arm64 cross_compile=aarch64-linux-android- hq_sdm450_defconfig; fi ) && (if [ ! -z \"\" ]; then             echo \"overriding kernel config with ''\";          echo  >> out/target/product/hq_sdm450/obj/kernel/msm-4.9/.config;           make -j2 -c kernel/msm-4.9 o=../../out/target/product/hq_sdm450/obj/kernel/msm-4.9 dtc_ext=dtc config_build_arm64_dt_overlay=y arch=arm64 cross_compile=aarch64-linux-android- oldconfig; fi )"

/bin/bash -c "(rm -rf out/target/product/hq_sdm450/obj/kernel_obj ) && (ln -s kernel/msm-4.9 out/target/product/hq_sdm450/obj/kernel_obj )"

/bin/bash -c "(rm -rf out/target/product/hq_sdm450/obj/kernel/msm-4.9/arch/arm64/boot/dts ) && (make -j2 -c kernel/msm-4.9 o=../../out/target/product/hq_sdm450/obj/kernel/msm-4.9 dtc_ext=dtc config_build_arm64_dt_overlay=y arch=arm64 cross_compile=aarch64-linux-android- kcflags=-mno-android ) && (make -j2 -c kernel/msm-4.9 o=../../out/target/product/hq_sdm450/obj/kernel/msm-4.9 dtc_ext=dtc config_build_arm64_dt_overlay=y arch=arm64 cross_compile=aarch64-linux-android- kcflags=-mno-android modules ) && (make -j2 -c kernel/msm-4.9 o=../../out/target/product/hq_sdm450/obj/kernel/msm-4.9 install_mod_path=../../../dlkm install_mod_strip=1 dtc_ext=dtc config_build_arm64_dt_overlay=y arch=arm64 cross_compile=aarch64-linux-android- modules_install ) && (mdpath=\`find out/target/product/hq_sdm450/dlkm/lib/modules -type f -name modules.dep\`; if [ \"\$mdpath\" != \"\" ];then mpath=\`dirname \$mdpath\`; ko=\`find \$mpath/kernel -type f -name *.ko\`; for i in \$ko; do mv \$i out/target/product/hq_sdm450/dlkm/lib/modules/; done; fi ) && (mdpath=\`find out/target/product/hq_sdm450/dlkm/lib/modules -type f -name modules.dep\`; if [ \"\$mdpath\" != \"\" ];then mpath=\`dirname \$mdpath\`; rm -rf \$mpath; fi )"

/bin/bash -c "(rm -f out/target/product/hq_sdm450/kernel ) && (cp \"out/target/product/hq_sdm450/obj/kernel/msm-4.9/arch/arm64/boot/image.gz-dtb\" \"out/target/product/hq_sdm450/kernel\" )"

編譯核心 kernel

學習linux就從核心編譯開始,現在就讓我們邁出第一步,下面記錄編譯過程 以下操作均在root下完成 1 準備工作 根據自己機器的硬體情況,選擇核心編譯配置選項,在這裡我使用的是預設配置 make menuconfig後直接儲存退出,生成.config檔案 具體配置可以參考金步國先生翻譯的資料 li...

linux核心編譯kernel編譯

核心編譯的簡單流程 1.先uname r查詢當前系統的kernel版本 3.切換至解壓後的原始碼目錄下,sudo i 進入root模式 4.apt get install libncurses dev,安裝 make menuconfig時需要用到的庫檔案 5.執行make menuconfig,選...

Linux的核心編譯,kernel

linux的核心 kernel 1 linux就是指kernel 2 kernel負責整個硬體的驅動,和提供各種核心功能 3 kernel是乙個檔案,一般放置在 boot vmlinuz uname r 此檔案包含各項硬體偵測程式和驅動模組 4 核心模組 kernel module 有些功能沒有整合...