Ubuntu get linux source

Where is Ubuntu source code? [duplicate]

How do I get the source code of the Ubuntu operating system? How do I run the modified code? What programming languages ​​can be used to modify the code?

2 Answers 2

The source code for ubuntu is divided up by package — from a running ubuntu system you can easily retreive the source for any package by doing:

apt-get source (package name) 

Otherwise, go to launchpad, and search up the package in question. For example, here’s the download page for the source code for a specific version of curl:

https://launchpad.net/ubuntu/+source/curl/7.21.2-4ubuntu1

That said, it’s a lot easier if you’re on a Linux system already — the package sources are divided into an original source tarball plus ubuntu patches, so if you don’t use apt-get source , you’ll need to manually apply the patch to the source code. And new-style packages are even divided into multiple packages.

What’s more, the packages are generally not designed to be cross-compiled from a non-Linux system. Even if you download them and open them in VS, you won’t be able to build them from a Windows system.

Finally, note that not everything is in C and C++ — there are packages in just about any language you can imagine. But I suppose most of them could be opened in VS as text files 🙂

Note: If you really, really want all of it, and I can’t stress enough how silly it would be to download everything just to start learning about the system, you can use the debmirror tool, available in ubuntu, to do this:

debmirror -a none \ --source \ -s main \ -d lucid,lucid-security,lucid-updates \ -r /ubuntu \ --progress \ -e http \ -h archive.ubuntu.com \ ## or other ubuntu archive mirror destpath 

This will be an absolutely huge download. Have several tens of GBs of space available. Note that this downloads only core packages — replace -s main with -s main,universe,multiverse,restricted to get everything.

Once you have the package files, you can extract the source by running dpkg-source -x on a .dsc file of interest.

Источник

Ubuntu Wiki

The majority of users that are interested in building their own kernel are doing so because they have installed Ubuntu on their system and they wish to make a small change to the kernel for that system. In many cases the user just wants to make a kernel configuration change.

Читайте также:  Сделать бэкап сервера linux

The purpose of this page is to give that user a minimum amount of information for them to meet the goal of making a simple change to the kernel, building it and installing their kernel. It is not intended to be the definitive guide to doing Ubuntu kernel development.

Build Environment

sudo apt-get build-dep linux linux-image-$(uname -r)
sudo apt-get install libncurses-dev gawk flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf llvm
deb-src http://archive.ubuntu.com/ubuntu disco main deb-src http://archive.ubuntu.com/ubuntu disco-updates main

Obtaining the source for an Ubuntu release

There are a number of different ways of getting the kernel sources. The two main ways will be documented here.

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 (described below) to obtain the sources.

However, if you wish to get the most up to date sources for the Ubuntu release you are running and make changes to that, use the git method (described below) to obtain the sources.

apt-get

apt-get source linux-image-unsigned-$(uname -r)

git

git clone git://kernel.ubuntu.com/ubuntu/ubuntu-.git
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-disco.git

Modifying the configuration

chmod a+x debian/rules chmod a+x debian/scripts/* chmod a+x debian/scripts/misc/* LANG=C fakeroot debian/rules clean LANG=C fakeroot debian/rules editconfigs # you need to go through each (Y, Exit, Y, Exit..) or get a complaint about config later

This takes the current configuration for each architecture/flavour supported and calls menuconfig to edit its config file. The chmod is needed because the way the source package is created, it loses the executable bits on the scripts.

In order to make your kernel «newer» than the stock Ubuntu kernel from which you are based you should add a local version modifier. Add something like «+test1» to the end of the first version number in the debian.master/changelog file, before building. This will help identify your kernel when running as it also appears in uname -a. Note that when a new Ubuntu kernel is released that will be newer than your kernel (which needs regenerating), so care is needed when upgrading. NOTE: do not attempt to use CONFIG_LOCALVERSION as this _will_ break the build.

Building the kernel

LANG=C fakeroot debian/rules clean # quicker build: LANG=C fakeroot debian/rules binary-headers binary-generic binary-perarch # if you need linux-tools or lowlatency kernel, run instead: LANG=C fakeroot debian/rules binary
cd .. ls *.deb linux-headers-4.8.0-17_4.8.0-17.19_all.deb linux-headers-4.8.0-17-generic_4.8.0-17.19_amd64.deb linux-image-4.8.0-17-generic_4.8.0-17.19_amd64.deb

on later releases you will also find a linux-extra- package which you should also install if present.

Читайте также:  Star office для linux

Testing the new kernel

sudo dpkg -i linux*4.8.0-17.19*.deb sudo reboot

Debug Symbols

sudo apt-get install pkg-config-dbgsym LANG=C fakeroot debian/rules clean LANG=C fakeroot debian/rules binary-headers binary-generic binary-perarch skipdbg=false

See also

Kernel Git Guide More information about using git to pull down the kernel sources.
ARM Cross Compile For more info about ARM and cross compilation.

Kernel/BuildYourOwnKernel (последним исправлял пользователь b-stolk 2022-09-08 00:38:14)

The material on this wiki is available under a free license, see Copyright / License for details.

Источник

How do I get the Ubuntu source code? [closed]

Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Where can I find the source code for the latest Ubuntu release? Also, how would I view the code? Would it just be lots of .cpp and .h files I could view in Visual Studio?

Thanks, was i right going for the dists subfolder? At this point i was presented with a massive number of sub-folders? Are each of these part of the OS?

3 Answers 3

The source code for ubuntu is divided up by package — from a running ubuntu system you can easily retreive the source for any package by doing:

apt-get source (package name) 

Otherwise, go to launchpad, and search up the package in question. For example, here’s the download page for the source code for a specific version of curl: https://launchpad.net/ubuntu/+source/curl/7.21.2-4ubuntu1

That said, it’s a lot easier if you’re on a Linux system already — the package sources are divided into an original source tarball plus ubuntu patches, so if you don’t use apt-get source , you’ll need to manually apply the patch to the source code. And new-style packages are even divided into multiple packages.

What’s more, the packages are generally not designed to be cross-compiled from a non-Linux system. Even if you download them and open them in VS, you won’t be able to build them from a Windows system.

Finally, note that not everything is in C and C++ — there are packages in just about any language you can imagine. But I suppose most of them could be opened in VS as text files 🙂

Note: If you really, really want all of it, and I can’t stress enough how silly it would be to download everything just to start learning about the system, you can use the debmirror tool, available in ubuntu, to do this:

debmirror -a none \ --source \ -s main \ -d lucid,lucid-security,lucid-updates \ -r /ubuntu \ --progress \ -e http \ -h archive.ubuntu.com \ ## or other ubuntu archive mirror destpath 

This will be an absolutely huge download. Have several tens of GBs of space available. Note that this downloads only core packages — replace -s main with -s main,universe,multiverse,restricted to get everything.

Читайте также:  Linux reboot from terminal

Once you have the package files, you can extract the source by running dpkg-source -x on a .dsc file of interest.

Источник

Where can I find the source code of Ubuntu?

I would like to know where to find the source code of Ubuntu. I’d like to see how far it is «open source».

Despite being «open» there are things called binary blobs in the kernel as far as I’m aware. It’s open, but not decipherable in some places.

5 Answers 5

apt-get source linux-source-3.2.0 
sudo apt-get build-dep $package 
sudo apt-get build-dep abiword apt-get source abiword 

The source code for every package in the main and universe archives is in Launchpad, or you can get it by enabling Sources in the Software Properties dialog, and then doing apt-get source $packagename in a terminal, after refreshing the package information.

Source code for packages in the partner repositories is not generally available, as they are mostly not open source applications. This is true for some items available in the Software Center as well.

Software in linux distributions is organized into packages. Each package either contains user facing software like Firefox, or libraries like libasound2 which is required by firefox. If you install Firefox, the apt system will figure out what prerequisite packages exist, will download and install them. Now, these packages are generally distributed as binary files that have already been compiled for a given processor architecture, but the exact source used to compile that version of a package is available via apt-get source firefox .

The vast majority of things in Ubuntu’s repositories of packages are open source. But Ubuntu does have a list of approved proprietary software. While this software doesn’t satisfy the freedom goals of Ubuntu, they are greatly desired by the community, and provide a lot of value. Examples of this are Skype or Sun Java (now removed). These packages are not listed on the Ubuntu packages site.

You can download the complete source code ISOs from the Ubuntu download servers:

  1. http://cdimage.ubuntu.com/releases//release/source/ for currently-supported releases. For example, http://cdimage.ubuntu.com/releases/12.04/release/source/ for 12.04.
  2. http://old-releases.ubuntu.com/releases//release/source/ for obsolete/EOL releases. For example, http://old-releases.ubuntu.com/releases/12.10/source/ for 12.10. However, source ISOs seem to be available only for 12.10 onwards.

Источник

Оцените статью
Adblock
detector