最終更新:2022-10-13 (木) 17:37:31 (564d)  

Ubuntu/Linuxカーネル/ソースコード
Top / Ubuntu / Linuxカーネル / ソースコード

ディレクトリ構成

Obtaining the source for an Ubuntu release

  • There are a number of different ways of getting the kernel sources.

apt-get source

  • apt-get source linux-image-$(uname -r)
  • If you have installed a version of Ubuntu and you want to make changes to the kernel that is installed on your system, use the apt-get method to obtain the sources.
  • この方法がおすすめ

Ubuntu 16.04.2

  • linux-hwe-4.8.0
    user@user-VirtualBox:~/linux$ apt-get source linux-image-$(uname -r)
    Reading package lists... Done
    Picking 'linux-hwe' as source package instead of 'linux-image-4.8.0-36-generic'
    NOTICE: 'linux-hwe' packaging is maintained in the 'Git' version control system at:
    git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/xenial -b hwe
    Please use:
    git clone git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/xenial -b hwe
    to retrieve the latest (possibly unreleased) updates to the package.
    Need to get 154 MB of source archives.
    Get:1 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main linux-hwe 4.8.0-56.61~16.04.1 (dsc) [8,543 B]
    Get:2 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main linux-hwe 4.8.0-56.61~16.04.1 (tar) [140 MB]
    Get:3 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main linux-hwe 4.8.0-56.61~16.04.1 (diff) [14.1 MB]                           
    Fetched 154 MB in 19s (8,038 kB/s)                                                                                                     
    gpgv: Signature made 2017年06月14日 20時45分02秒 JST using RSA key ID CBEECEA3
    gpgv: Can't check signature: public key not found
    dpkg-source: warning: failed to verify signature on ./linux-hwe_4.8.0-56.61~16.04.1.dsc
    dpkg-source: info: extracting linux-hwe in linux-hwe-4.8.0
    dpkg-source: info: unpacking linux-hwe_4.8.0.orig.tar.gz
    dpkg-source: info: applying linux-hwe_4.8.0-56.61~16.04.1.diff.gz
    dpkg-source: info: upstream files that have been modified: 
    ...

Ubuntu 16.04

  • user@ubuntu:~/linux$ apt-get source linux-image-$(uname -r)
    Reading package lists... Done
    Picking 'linux' as source package instead of 'linux-image-4.4.0-21-generic'
    NOTICE: 'linux' packaging is maintained in the 'Git' version control system at:
    git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/xenial
    Please use:
    git clone git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/xenial
    to retrieve the latest (possibly unreleased) updates to the package.
    Need to get 146 MB of source archives.
    Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main linux 4.4.0-81.104 (dsc) [9,617 B]
    Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main linux 4.4.0-81.104 (tar) [133 MB]
    Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates/main linux 4.4.0-81.104 (diff) [12.9 MB]                                          
    Fetched 146 MB in 28min 15s (86.0 kB/s)                                                                                                    
    gpgv: Signature made Wed 14 Jun 2017 12:55:41 AM PDT using RSA key ID CBEECEA3
    gpgv: Can't check signature: public key not found
    dpkg-source: warning: failed to verify signature on ./linux_4.4.0-81.104.dsc
    dpkg-source: info: extracting linux in linux-4.4.0
    dpkg-source: info: unpacking linux_4.4.0.orig.tar.gz
    dpkg-source: info: applying linux_4.4.0-81.104.diff.gz
    dpkg-source: info: upstream files that have been modified: 
     linux-4.4.0/Documentation/ABI/stable/sysfs-bus-vmbus
    ...
    

Git

  • The source for each release is maintained in its own git repository on kernel.ubuntu.com.

メインライン

  • If you plan on working on more than one kernel release you can save space and time by downloading the upstream kernel tree.
    git clone git://kernel.ubuntu.com/ubuntu/linux.git
    git clone --reference linux git://kernel.ubuntu.com/ubuntu/ubuntu-karmic.git
    git clone --reference linux git://kernel.ubuntu.com/ubuntu/ubuntu-maverick.git

リリース毎

kernel.orgのクローン?

関連