Differences between revisions 5 and 6
Revision 5 as of 2015-03-27 05:13:28
Size: 7675
Editor: ?Joseph Lee
Revision 6 as of 2015-03-27 05:17:33
Size: 7660
Editor: ?Joseph Lee
Deletions are marked like this. Additions are marked like this.
Line 41: Line 41:
   *1 May --26 May    *27 Apr --26 May
Line 44: Line 44:
    Fixing time. All packages which are essential for booting should be fixed during this period. Until mid-term, there should be at least half of them got fixed. Mid-term evaluation may be these packages' patches.     Fixing time. All packages mentioned above should be fixed during this period. Until mid-term, there should be at least half of them got fixed. Mid-term evaluation may be these packages' patches.
  • Name Joseph Lee

  • Contact/Email/IRC nick:

  • Background: I am a sophomore Computer Science student in Jilin University, China. I have about three years' experience on C/C++ programming, some experience on Python and shell. I have been using GNU/Linux for about two years and enjoy working with it. I really love the concept of free software and always want to contribute to it. This project may be a good start.

  • Project title Bootable Clang-Built Debian

  • Project details:

    • A.Efforts I have made
      • I have read some documents on Debian bootstrap and packaging, and tried to build some packages.
      • I have the experience of installing Gentoo and Arch Linux, and have performed installing a Debian from another Linux system with debootstrap(details below).
      • I made a clang only environment and tried to build packages in it.I also fixed bash-4.3 package in a "tricky" way, which means I add some things into debian/rules instead of fixing source code. But it actually worked. :-P
      • So I think I have got a general idea about how this works and what I should do.
      B.Problem division
      • In this project, I will focus on some key packages to produce a bootable minimal clang-built Debian. I think this project should be divided into two part.
        • First is fixing packages. In this step, I will use an environment in which /usr/bin/gcc, /usr/bin/g++ and /usr/bin/cpp symlinks has been changed to point to clang. It can avoid the influence of GCC and make sure these packages are build with clang.
        • After finish fixes, a bootstrap like a new ports should be performed. Thank to early work on Debian bootstrap, I have some tools to do this easier than before.
      C.Some notes
      • 1.The first thing need to note is the difference between bootable and bootstrap. They both need at least a number of packages. But they focus on different points. Bootstrap focuses on source packages' "compilability". There are many build dependency circles in Debian, the most simple example is that you can't build a gcc package without a gcc package installed. Bootstrap aims at breaking these build dependency circles, building all Debian (binary) packages from source. Bootable is the capability of making a computer ready to work after pressing the “Start" button. It needs at least a bootloader(grub), a working linux kernel, an init system(systemd), a shell(bash,dash) and some basic system tools(e.g. GNU coreutils). In this project, bootable is the ultimate goal. To get there, we need enough clang-built packages. So we need a bootstrap to get all these packages from a "native" clang-built environment.
      • 2.About the fixing, the packages need to be fixed is not only the packages which are essential also booting, but also all dependencies needed to get those packages.They should be built in right order.
      • 3.There are many types of building error(details on clang.debian.net), I will pick up two examples.
        • One may be the way in which GCC deals with options is different from clang.It seems that the GCC driver ignores -rdynamic in the presence of -static while the clang driver does not. I met this situation while trying to build bash with clang. I tried to fix this by add a LDFLAGS -fuse-lg=gold. (This may not be best solution, I will try in other ways.)
        • A big problem is that some GNU features isn't supported in clang by default. Such as clang is following by default the C99 standard while gcc promote GNU89(This can be fix by using -std=gnu89 option), clang rejects nested C functions while gcc accepts them( This can be fix by stripping out the nested functions and add static qualifier to avoid polluting the symbol table.
        4.About the bootstrap, there is an important thing to note. Glibc is a very very basic component in the tool chain that should be build first. But it may be very hard to fix it by a single person. I haven't found anyone built it with clang successfully. I will try to fix it in the first step, but I'll put it in the last part of the first step's schedule, and if I can't finish that, a GCC-built glibc may be used at first in the second part. After finish the bootstrap, if time permitting, I will go back to it and do some further work. (Maybe I can also have a try on the latest version of glibc) There are also some work out there can be used in this project. For example, LLVMLinux can be very useful in fixing kernel.
      D.How to make a bootable Debian
      • A bootable Debian can be made from a minimal environment. I have tried it with existing tools and packages.
        • Prepare a partition which is marked bootable by partition tool. Mount it and install base system into it. This can usually be done with debootstrap.
        • Mount /dev /sys with --bind and mount /proc as proc file system.
        • Chroot into the directory, configure network, hostname, time zone, locales and so on. This may need some addition packages installed.
        • Create /etc/fstab, configure the directories should be mounted at booting such as /, /home, /boot, swap
        • Install packages linux-image and grub. Then install grub to the partition
        I performed these with a qemu image and tested it with qemu.
      • This project have two requirements. I will send them to the mentor.
  • Synopsis: Fix packages which are essential for booting a Debian and make a minimal bootable clang-built Debian.

  • Benefits to Debian

    • First we can make clang as an alternative for GGC. It's always better to have choices.
    • Second, clang is a compiler which performs more checks and gives out more alerts, with which we can improve the overall quality of code of these softwares during building.
  • Deliverables: A set of packages built with Clang(with patches)

  • Project schedule:

    • This is just a rough guideline of how the project will be done. Schedules may get some changes during the whole project.
      • 27 Apr --26 May
        • Before coding. During this period, I need read documents on Debian packaging tools and bootstrap tools, make myself familiar with them. And I need also read more documents about clang to get more familiar with possible problems, and think some methods to deal with these problems.
      • 27 May -- 27 Jul
        • Fixing time. All packages mentioned above should be fixed during this period. Until mid-term, there should be at least half of them got fixed. Mid-term evaluation may be these packages' patches.
      • 28 Jul -- 7 Aug
        • In this period, I should perform the bootstrap.
      • 8 Aug -- 14 Aug
        • Time for rechecking patches to improve the quality.
      • 15 Aug -- 28 Aug
        • If I didn't fix glibc during the first part and time permitting, I will go back to try to fix glibc. Another task is get ready for final evaluation. Sort out packages and patches, submit them at last.
  • Exams and other commitments: I will have some exams in July which won't take too much time.

  • Other summer plans: I have no other big plan during this summer. I am sure I can work 35-40 hours per week on average in this project.

  • Why Debian?: Debian is a very important distribution in the GNU/Linux world as many others' base. Contributing to it is more like contributing to the whole GNU/Linux world. And this project I am applying interests me very much. I can learn how a distribution is made from some stand-alone software from it, as well as get a chance to dive into some excellent codes.

  • Are you applying for other projects in SoC? No