使用gdb或者crash时需要debug symbols, 可以从http://ddebs.ubuntu.com/pool/main/l/linux/下载,但有时候里面没有需要自己生成,下需方法使用了debian/rules脚本来为Ubuntu Kernel生成debug symbols, 所以它不需要注释的那些make命令, 这个脚本会自动生成.config文件,如果要修改可以使用fakeroot debian/rules editconfigs命令。如果使用的是社区的Kernel, 默认的.config文件应该已经包括了生成debug symbols的配置(CONFIG_KALLSYMS=y & CONFIG_KALLSYMS_ALL=y)。
sudo apt-get build-dep linux-image-$(uname -r) #需要添加附录中的deb-src源
git clone git://kernel.ubuntu.com/ubuntu/linux.git ubuntu-linux
#git clone --reference ubuntu-linux git://kernel.ubuntu.com/ubuntu/ubuntu-vivid.git
git clone --reference ubuntu-linux git://kernel.ubuntu.com/ubuntu/ubuntu-xenial.git
cd ubuntu-xenial
git tag -l Ubuntu-*
git checkout -b Ubuntu-4.4.0-0.10 Ubuntu-4.4.0-0.10
sudo apt-get install fakeroot pkg-config-dbgsym git build-essential kernel-package kernel-wedge
sudo apt-get install libncurses5-dev qt4-dev-tools
sudo apt-get install libncurses5-dev kernel-package fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge libelf-dev asciidoc binutils-dev pkg-config-dbgsym
#make xconfig #or make menuconfig
#make localmodconfig #speed compliling time for test
#make-kpkg #a script which automates and replaces the sequence "make dep; make clean; make bzImage; make modules"
#make mrproper
#git reset --hard HEAD
fakeroot debian/rules clean
#fakeroot debian/rules editconfigs
fakeroot debian/rules DEB_BUILD_OPTIONS=parallel=4 clean binary-generic binary-headers skipdbg=false
附录, source.list:
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://no.archive.ubuntu.com/ubuntu/ vivid main restricted deb-src http://no.archive.ubuntu.com/ubuntu/ vivid main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://no.archive.ubuntu.com/ubuntu/ vivid-updates main restricted deb-src http://no.archive.ubuntu.com/ubuntu/ vivid-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://no.archive.ubuntu.com/ubuntu/ vivid universe deb-src http://no.archive.ubuntu.com/ubuntu/ vivid universe deb http://no.archive.ubuntu.com/ubuntu/ vivid-updates universe deb-src http://no.archive.ubuntu.com/ubuntu/ vivid-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://no.archive.ubuntu.com/ubuntu/ vivid multiverse deb-src http://no.archive.ubuntu.com/ubuntu/ vivid multiverse deb http://no.archive.ubuntu.com/ubuntu/ vivid-updates multiverse deb-src http://no.archive.ubuntu.com/ubuntu/ vivid-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://no.archive.ubuntu.com/ubuntu/ vivid-backports main restricted universe multiverse deb-src http://no.archive.ubuntu.com/ubuntu/ vivid-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu vivid-security main restricted deb-src http://security.ubuntu.com/ubuntu vivid-security main restricted deb http://security.ubuntu.com/ubuntu vivid-security universe deb-src http://security.ubuntu.com/ubuntu vivid-security universe deb http://security.ubuntu.com/ubuntu vivid-security multiverse deb-src http://security.ubuntu.com/ubuntu vivid-security multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu vivid partner # deb-src http://archive.canonical.com/ubuntu vivid partner ## This software is not part of Ubuntu, but is offered by third-party ## developers who want to ship their latest software. # deb http://extras.ubuntu.com/ubuntu vivid main # deb-src http://extras.ubuntu.com/ubuntu vivid main ## Debugging symbols deb http://ddebs.ubuntu.com vivid main restricted universe multiverse deb http://ddebs.ubuntu.com vivid-updates main restricted universe multiverse deb http://ddebs.ubuntu.com vivid-proposed main restricted universe multiverse