0

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?

ThunderBird
  • 1,955

2 Answers2

0

Here's the link to the original post

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.

0

You need to add some server of Debian/Ubuntu too into list of this file - before you are able to use the command apt-get source :

/etc/apt/sources.list

sources.list is explained in man of Ubuntu:

man sources.list

Add into /etc/apt/sources.list (only in case it is not written already there) after :

sudo gedit /etc/apt/sources.list

this one line:

deb-src http://archive.ubuntu.com/ubuntu main restricted universe multiverse

Then after saving and closing gedit, do:

sudo apt-get update

After this you should be able to use command with any package:

sudo apt-get source

Cheers.

dschinn1001
  • 3,829