{"id":3031,"date":"2022-12-29T22:19:47","date_gmt":"2022-12-29T14:19:47","guid":{"rendered":"https:\/\/jir.idv.tw\/wordpress\/?p=3031"},"modified":"2022-12-30T07:54:29","modified_gmt":"2022-12-29T23:54:29","slug":"linux-kernel%e6%9b%b4%e6%96%b0%e7%b7%a8%e8%ad%af%ef%bc%8c%e7%ac%ac%e4%b8%80%e6%ac%a1%e5%b0%b1%e4%b8%8a%e6%89%8bdebian%e7%b3%bb%e7%b5%b1","status":"publish","type":"post","link":"https:\/\/jir.idv.tw\/wordpress\/?p=3031","title":{"rendered":"[Linux] KERNEL\u66f4\u65b0\u7de8\u8b6f\uff0c\u7b2c\u4e00\u6b21\u5c31\u4e0a\u624b(Debian\u7cfb\u7d71)"},"content":{"rendered":"<p><strong>\u5982\u4f55KERNEL\u66f4\u65b0\u7de8\u8b6f\uff0c\u7b2c\u4e00\u6b21\u5c31\u4e0a\u624b<\/strong><br \/>\n\u5176\u5be6\uff0c\u81ea\u5df1\u5c0d\u91cd\u65b0\u7de8\u8b6fKERNEL\u975e\u5e38\u7684\u6c92\u4fe1\u5fc3\u548c\u632b\u6298\u3002<br \/>\n\u4ee5\u524d\u786c\u9ad4\u5f88\u5dee\uff0c\u7db2\u8def\u793e\u7fa4\u8a0e\u8ad6\u5f88\u96e3\u627e(\u4e5f\u8a31\u81ea\u5df1\u4e0d\u6703\u7528google\u548c\u82f1\u6587\u80fd\u529b\u4e0d\u5920\u597d)\u3002<br \/>\n\u6539\u500b\u9700\u8981\u7684KERNEL\uff0c\u5e38\u5e38\u5f04\u597d\u639b\u4e0a\u53bb\uff0c\u5c31\u662f\u6b7b\u7576\u6216\u4e0d\u80fd\u7528\u3002<br \/>\n\u5370\u8c61\u4e2d\u6709\u6210\u529f\u80fd\u958b\u6a5f\u548c\u6539\u5584\u96fb\u8166\u786c\u9ad4\u904b\u884c\u7684\u7d00\u9304\uff0c\u5927\u6982\u662f\u5169\u6b21(\u90a3\u6642\u5019KERNEL\u7248\u672c\u662f2.x\u7248)\u3002<br \/>\n\u5c48\u6307\u4e00\u7b97\uff0c\u5df2\u7d93\u662f\u5feb\u53e6\u5916\u4e00\u500b20\u5e74\u982d&#8230;@@<br \/>\n\u73fe\u5728\u56e0\u70ba\u8981\u5617\u8a66\u8dd1\u5b89\u5353\u6a21\u64ec\u6a5f\uff0c\u70ba\u4e86\u9a45\u52d5\uff0c\u767c\u73fe\u751a\u81f3\u5df2\u7d93\u9032\u6b65\u52306.x\u7248\u672c\u3002<br \/>\n\u4e0d\u904e\u81ea\u5df1\u7684\u7cfb\u7d71\u6c92\u6709\u8ffd\u65b0\u6c42\u8b8a\uff0c\u6211\u90fd\u9084\u5728\u75284.x\u7248\u7684\u548c\u5617\u8a665.x\u7248\u7684APT\u9810\u8f09\u7248\u5957\u4ef6\u3002<br \/>\n\u9019\u6b21\u7576\u7136\u5c31\u4f86\u5617\u8a66\u65e2\u6709\u7684\u7248\u672c\uff0c\u65b0\u589e\u5b89\u5353\u6a21\u64ec\u6a5f\u9700\u8981\u7684\u9a45\u52d5\u7a0b\u5f0f\uff0c\u518d\u6b21\u9ad4\u9a57KERNEL\u7de8\u8b6f\u7684\u632b\u6298\u5730\u7344\u3002<br \/>\n\u96d6\u7136\u73fe\u5728\u7684\u786c\u9ad4\u4f9d\u7136\u662f\u8001\u96fb\u8166\uff0c\u6574\u9ad4\u6548\u80fd\u9084\u662f\u8ddf\u7576\u521d\u4e0d\u540c\u800c\u8a9e\u7684\u8a13\u6578\uff0c\u96d6\u7136\u7e31\u4f7f\u904e\u7a0b\u4e2d\u6709\u932f\u8aa4\u3001\u5931\u6557\uff0c\u4ecd\u7136\u6bcf\u500b\u6307\u4ee4\u6b65\u9a5f\u90fd\u5f88\u5feb\u80fd\u5b8c\u6210\u904b\u7b97\uff0c\u4e0d\u50cf\u4ee5\u524d\u8dd1\u7684\u6642\u9593\u662f\u7b97\u5c0f\u6642\u8d77\u8df3\u7684\u3002<br \/>\n\u73fe\u5728\u7b97\u662f\u6210\u529f\u4e86\uff0c\u6545\u6574\u7406\u4e00\u4e0b\u64cd\u4f5c\u904e\u7a0b\u7684\u5fc3\u5f97\uff0c\u4e5f\u7d66\u81ea\u5df1\u4e00\u500b\u7d00\u9304\u7576\u672a\u4f86\u9700\u8981\u53c3\u8003\u3002<\/p>\n<p>\u67e5\u770b\u81ea\u5df1\u73fe\u5728\u4f7f\u7528\u7684\u7248\u672c\u3002<br \/>\n<code>uname -a<\/code><\/p>\n<p>\u5148\u628a\u76f8\u95dc\u5957\u4ef6\u900f\u904eapt(aptitude\u4e5f\u53ef\u4ee5)\u66f4\u65b0\u548c\u5fc5\u8981\u7684\u5b89\u88dd\u3002<br \/>\n<code>sudo apt update<br \/>\nsudo apt upgrade<br \/>\nsudo apt install nano vim wget gnupg2<br \/>\nsudo apt install build-essential dwarves python3 libncurses-dev flex bison libssl-dev bc libelf-dev<\/code><br \/>\n\u5269\u4e0b\u5f8c\u9762\u7de8\u8b6f\u82e5\u6709\u7f3a\u5957\u4ef6\uff0c\u770b\u540d\u5b57\u7f3a\u4ec0\u9ebc\uff0c\u5f8c\u9762\u518d\u52a0\u88dd\u4ec0\u9ebc\u4ea6\u53ef\u3002<br \/>\n<!--more--><br \/>\n\u7bc4\u4f8b\uff0c\u5b89\u88dd5.15.12\u7248\u672c\u7684KERNEL\u3002<br \/>\n\u6211\u5011\u5230\u9019\u500b\u7db2\u5740\u6293\u4e0b\u4f86source\u539f\u59cb\u6a94\u548cpatch\u88dc\u91d8\uff1a<br \/>\n<code>wget https:\/\/cdn.kernel.org\/pub\/linux\/kernel\/v5.x\/linux-5.15.12.tar.gz<br \/>\nwget https:\/\/cdn.kernel.org\/pub\/linux\/kernel\/v5.x\/patch-5.15.12.xz<\/p>\n<p>tar xvfz linux-5.15.12.tar.gz<br \/>\ncd linux-5.15.12<br \/>\nsudo cp -v \/boot\/config-$(uname -r) .config<\/code><br \/>\n\u628a\u76ee\u524dKERNEL\u7248\u672c\u958b\u6a5f\u7684\u6a94\u6848\u8907\u88fd\u904e\u4f86\u7576\u57fa\u672c\u8a2d\u5b9a\u6a94\uff0c\u4e0d\u4e00\u5b9a\u8981\u76f8\u540c\u7248\u672c\uff0c\u5f8c\u9762\u6709\u6307\u4ee4\u6703\u5e6b\u52a9\u4fee\u6b63\u3002<\/p>\n<p>(*\u975e\u5fc5\u8981\u53ef\u4ee5\u7565\u904e)\u958b\u59cb\u4fee\u6b63\u88dc\u91d8\u3002)<br \/>\n<code>sudo cp ..\/patch-5.15.12.xz .\/<br \/>\nxz -dc patch-5.15.12.xz | patch -p1 -dry-run<br \/>\nxz -dc patch-5.15.12.xz | patch -p1 <\/code><br \/>\n(-dry-run\u662f\u6e2c\u8a66\u88dc\u91d8\u6a94\u6848\u6b63\u78ba\u6027\uff1b\u53e6\u5916\u5982\u5fc5\u8981\uff0c\u53ef\u4ee5\u6062\u5fa9\u70ba\u88dc\u91d8\u4fee\u6539\u524d\u7684\u7248\u672cxz -dc patch-5.15.12.xz | patch -p1 -R)<\/p>\n<p>\u975e\u7b2c\u4e00\u6b21\u5b89\u88dd\u53ef\u4ee5\u5148\u57f7\u884c\u6e05\u9664\u65e2\u6709\u7684\u7de8\u8b6f\u548c\u8a2d\u5b9a\u6a94\u3002<br \/>\n<code>make clean<\/code><br \/>\n(\u6216sudo make clean)<\/p>\n<p>*\u975e\u5fc5\u8981\u547c\u53eb\u548c\u5ba3\u544a<br \/>\n(uname -m)<br \/>\n(export ARCH=x86_64)<br \/>\n(export CROSS_COMPILE=x86_64-linux-gnu-)<\/p>\n<p>\u9032\u5165\u9810\u8a08\u5b89\u88dd\u7684\u7248\u672c\uff0c\u4ee5\u6587\u5b57\u5c0d\u8a71\u4ecb\u9762\u7684\u9078\u55ae\u8a2d\u5b9a\u76f8\u95dc\u5957\u4ef6\u3001\u9a45\u52d5\u548c\u529f\u80fd\u3002<br \/>\n<code>sudo make menuconfig <\/code><br \/>\n\u7576\u8a2d\u5b9a\u9700\u8981\u65b0\u589e\u7684\u9a45\u52d5\u6216\u9810\u8a2d\u6a94\u6848\u5f8c\uff0c[save]\u3001[exit]\u3002<\/p>\n<p><code>make localmodconfig<\/code><br \/>\n\u6b64KERNEL\u7248\u672c\u7684.config\u548c\u8907\u88fd\u904e\u4f86\u7684.config\u6bd4\u8f03\u5dee\u7570\uff0c\u770b\u7f3a\u4ec0\u9ebc\u8a2d\u5b9a\uff0c\u5c31\u9078\u64c7\u65b0\u589e\u597d\u7f3a\u7684\u689d\u4ef6\u4ea6\u53ef\u3002<\/p>\n<p>\u958b\u59cb\u7de8\u8b6f\u6e96\u5099\u76f8\u95dc\u958b\u6a5fIMAGE\u6a94\u6848\u548c\u9a45\u52d5\u7a0b\u5f0f\u6a94\u6848\u779c!<br \/>\n<code>sudo make bzImage -j$(nproc --all)<\/code><br \/>\n(-jx\u6307\u7684\u662f\u7528CPU\u591a\u5c11\u9846\u6838\u5fc3\u8dd1\u7de8\u8b6f\uff0c\u53c3\u6578\u53ef\u6709\u53ef\u7121)<br \/>\n(\u82e5\u56e0\u70baGCC\u9810\u8a2d32bit\u74b0\u5883\u7528\u7684\u7570\u5e38\uff1ald: warning: creating DT_TEXTREL in a PIE\uff0c\u53ef\u4ee5\u5617\u8a66\uff1asudo make KBUILD_CFLAGS=-no-pie bzImage -j$(nproc &#8211;all)\u8ffd\u52a0\u53c3\u6578\u8a66\u8a66\u770bbypass)<br \/>\n(\u6216\u662fsudo make bzImage -j$(nproc &#8211;all) -no-pie)<br \/>\n<code>sudo make modules -j$(nproc --all)<br \/>\nsudo make modules_install<br \/>\nsudo make install<\/code><br \/>\n(make deb-pkg)<\/p>\n<p>\u5b89\u88dd\u5b8c\u6210\uff0c\u66f4\u65b0GRUB\u958b\u6a5f\u9078\u55ae\u548c\u91cd\u958b\u6a5f\u3002<br \/>\n<code>sudo update-grub<br \/>\nsudo reboot<\/code><br \/>\nPS.\u5982\u6709\u5fc5\u8981\uff0cX WINDOW\u4e0b\u53ef\u4ee5\u88ddGrub Customizer\u4f86\u7ba1\u7406GRUB\u958b\u6a5f\u9078\u55ae\u548c\u8a2d\u5b9a\u53c3\u6578\u3002<\/p>\n<p>\u795d\u5404\u4f4d\u9806\u5229\u958b\u6a5f\u548c\u555f\u7528\u9700\u8981\u7684\u786c\u9ad4\u9a45\u52d5!!<\/p>\n<p><strong>\u76ee\u524dKERNEL\u4f7f\u7528\u7684\u5404\u7248\u672c\u4e0b\u8f09\u8655\uff1a<\/strong><br \/>\n<a href=\"https:\/\/cdn.kernel.org\/pub\/linux\/kernel\/v4.x\/\" rel=\"noopener\" target=\"_blank\">https:\/\/cdn.kernel.org\/pub\/linux\/kernel\/v4.x\/<\/a><br \/>\n<a href=\"https:\/\/cdn.kernel.org\/pub\/linux\/kernel\/v5.x\/\" rel=\"noopener\" target=\"_blank\">https:\/\/cdn.kernel.org\/pub\/linux\/kernel\/v5.x\/<\/a><br \/>\n<a href=\"https:\/\/cdn.kernel.org\/pub\/linux\/kernel\/v6.x\/\" rel=\"noopener\" target=\"_blank\">https:\/\/cdn.kernel.org\/pub\/linux\/kernel\/v6.x\/<\/a><\/p>\n<p><strong>\u76f8\u95dc\u53c3\u8003\u6587\u7ae0\uff1a<\/strong><br \/>\n<a href=\"https:\/\/techviewleo.com\/how-to-install-linux-kernel-on-debian\/\" rel=\"noopener\" target=\"_blank\">https:\/\/techviewleo.com\/how-to-install-linux-kernel-on-debian\/<\/a><br \/>\n<a href=\"https:\/\/www.cyberciti.biz\/faq\/debian-ubuntu-building-installing-a-custom-linux-kernel\/\" rel=\"noopener\" target=\"_blank\">https:\/\/www.cyberciti.biz\/faq\/debian-ubuntu-building-installing-a-custom-linux-kernel\/<\/a><br \/>\n<a href=\"https:\/\/unix.stackexchange.com\/questions\/194455\/how-to-install-compile-module-in-debian-without-using-full-kernel-only-by-using\" rel=\"noopener\" target=\"_blank\">https:\/\/unix.stackexchange.com\/questions\/194455\/how-to-install-compile-module-in-debian-without-using-full-kernel-only-by-using<\/a><br \/>\n<a href=\"http:\/\/g2doc.com:81\/pages\/d7fdf0\/\" rel=\"noopener\" target=\"_blank\">http:\/\/g2doc.com:81\/pages\/d7fdf0\/<\/a><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/71253360\/compiling-the-linux-kernel-make-menuconfig-error\" rel=\"noopener\" target=\"_blank\">https:\/\/stackoverflow.com\/questions\/71253360\/compiling-the-linux-kernel-make-menuconfig-error<\/a><br \/>\n<a href=\"https:\/\/man7.org\/linux\/man-pages\/man1\/gcc.1.html\" rel=\"noopener\" target=\"_blank\">https:\/\/man7.org\/linux\/man-pages\/man1\/gcc.1.html<\/a><br \/>\n<a href=\"https:\/\/gts3.org\/2017\/cross-kernel.html\" rel=\"noopener\" target=\"_blank\">https:\/\/gts3.org\/2017\/cross-kernel.html<\/a><br \/>\n<a href=\"https:\/\/www.kernel.org\/doc\/html\/v4.11\/process\/applying-patches.html\" rel=\"noopener\" target=\"_blank\">https:\/\/www.kernel.org\/doc\/html\/v4.11\/process\/applying-patches.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55KERNEL\u66f4\u65b0\u7de8\u8b6f\uff0c\u7b2c\u4e00\u6b21\u5c31\u4e0a\u624b \u5176\u5be6\uff0c\u81ea\u5df1\u5c0d\u91cd\u65b0\u7de8\u8b6fKERNEL\u975e\u5e38\u7684\u6c92\u4fe1\u5fc3\u548c\u632b\u6298\u3002 \u4ee5\u524d\u786c\u9ad4\u5f88\u5dee\uff0c\u7db2\u8def\u793e\u7fa4\u8a0e\u8ad6\u5f88\u96e3\u627e(\u4e5f\u8a31\u81ea\u5df1\u4e0d\u6703\u7528google\u548c\u82f1\u6587\u80fd\u529b\u4e0d\u5920\u597d)\u3002 \u6539\u500b\u9700\u8981\u7684KERNEL\uff0c\u5e38\u5e38\u5f04\u597d\u639b\u4e0a\u53bb\uff0c\u5c31\u662f\u6b7b\u7576\u6216\u4e0d\u80fd\u7528\u3002 \u5370\u8c61\u4e2d\u6709\u6210\u529f\u80fd\u958b\u6a5f\u548c\u6539\u5584\u96fb\u8166\u786c\u9ad4\u904b\u884c\u7684\u7d00\u9304\uff0c\u5927\u6982\u662f\u5169\u6b21(\u90a3\u6642\u5019KERNEL\u7248\u672c\u662f2.x\u7248)\u3002 \u5c48\u6307\u4e00\u7b97\uff0c\u5df2\u7d93\u662f\u5feb\u53e6\u5916\u4e00\u500b20\u5e74\u982d&#8230;@@ \u73fe\u5728\u56e0\u70ba\u8981\u5617\u8a66\u8dd1\u5b89\u5353\u6a21\u64ec\u6a5f\uff0c\u70ba\u4e86\u9a45\u52d5\uff0c\u767c\u73fe\u751a\u81f3\u5df2\u7d93\u9032\u6b65\u52306.x\u7248\u672c\u3002 \u4e0d\u904e\u81ea\u5df1\u7684\u7cfb\u7d71\u6c92\u6709\u8ffd\u65b0\u6c42\u8b8a\uff0c\u6211\u90fd\u9084\u5728\u75284.x\u7248\u7684\u548c\u5617\u8a665.x\u7248\u7684APT\u9810\u8f09\u7248\u5957\u4ef6\u3002 \u9019\u6b21\u7576\u7136\u5c31\u4f86\u5617\u8a66\u65e2\u6709\u7684\u7248\u672c\uff0c\u65b0\u589e\u5b89\u5353\u6a21\u64ec\u6a5f\u9700\u8981\u7684\u9a45\u52d5\u7a0b\u5f0f\uff0c\u518d\u6b21\u9ad4\u9a57KERNEL\u7de8\u8b6f\u7684\u632b\u6298\u5730\u7344\u3002 \u96d6\u7136\u73fe\u5728\u7684\u786c\u9ad4\u4f9d\u7136\u662f\u8001\u96fb\u8166\uff0c\u6574\u9ad4\u6548\u80fd\u9084\u662f\u8ddf\u7576\u521d\u4e0d\u540c\u800c\u8a9e\u7684\u8a13\u6578\uff0c\u96d6\u7136\u7e31\u4f7f\u904e\u7a0b\u4e2d\u6709\u932f\u8aa4\u3001\u5931\u6557\uff0c\u4ecd\u7136\u6bcf\u500b\u6307\u4ee4\u6b65\u9a5f\u90fd\u5f88\u5feb\u80fd\u5b8c\u6210\u904b\u7b97\uff0c\u4e0d\u50cf\u4ee5\u524d\u8dd1\u7684\u6642\u9593\u662f\u7b97\u5c0f\u6642\u8d77\u8df3\u7684\u3002 \u73fe\u5728\u7b97\u662f\u6210\u529f\u4e86\uff0c\u6545\u6574\u7406\u4e00\u4e0b\u64cd\u4f5c\u904e\u7a0b\u7684\u5fc3\u5f97\uff0c\u4e5f\u7d66\u81ea\u5df1\u4e00\u500b\u7d00\u9304\u7576\u672a\u4f86\u9700\u8981\u53c3\u8003\u3002 \u67e5\u770b\u81ea\u5df1\u73fe\u5728\u4f7f\u7528\u7684\u7248\u672c\u3002 uname -a \u5148\u628a\u76f8\u95dc\u5957\u4ef6\u900f\u904eapt(aptitude\u4e5f\u53ef\u4ee5)\u66f4\u65b0\u548c\u5fc5\u8981\u7684\u5b89\u88dd\u3002 sudo apt u&#8230; <a href=\"https:\/\/jir.idv.tw\/wordpress\/?p=3031\" class=\"readmore\">Read more (\u5b8c\u6574\u6587\u7ae0\u5167\u5bb9)<span class=\"screen-reader-text\">[Linux] KERNEL\u66f4\u65b0\u7de8\u8b6f\uff0c\u7b2c\u4e00\u6b21\u5c31\u4e0a\u624b(Debian\u7cfb\u7d71)<\/span><span class=\"fa fa-angle-double-right\" aria-hidden=\"true\"><\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-3031","post","type-post","status-publish","format-standard","hentry","category-4","content-layout-excerpt-thumb"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3031","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3031"}],"version-history":[{"count":6,"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3031\/revisions"}],"predecessor-version":[{"id":3039,"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3031\/revisions\/3039"}],"wp:attachment":[{"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}