Posts Tagged ‘gsoc mips loongson’

Waiting For Results

April 8, 2009

It seems foka were really busy recently. I met him on #debian-soc yesterday and he told me I’ve got another ‘sponsor’–Lazyfai. I was very excited since foka mentioned him once that he has already do some work on building a N32 ABI MIPS port for Debian. No time for enjoying this great news with me, foka just disappeared, leaving me alone grinning like a Cheshire cat…

However, right now is a perfect time for me to warm up. Although the proposal result or even the shortlist doesn’t come out yet, it’ll be a waste of time to just wait for these things doing nothing. And furthermore, I’ve already made up my mind that whatever I got passed or not I’ll devote myself to this project in the summer. It’s my first show in FOSS world and I have the chance to learn things and being mentored by people like foka and r0bertz. HOW CAN somebody just give it up!?

So I think I’ll do these things down below as much as possible before I got further instructions from mentors:

1.Read <See MIPS Run> (already borrowed one today)

2.Follow the guide to build a lfs and clfs system(lfs is 50% done today)

3.Do research on r0bertiz’s pioneering work[1]

I think these 3 things are enough for me to get no sleep these days. However, there are so many thing to to like:

1. Talk on debian-mips. Ask their opinion on this project, especially on building a new branch from MIPS port. ( already sent email, no reply yet)

2.Get to know about loongson 2F ISA and features. Gathering info from official data sheets and maybe more importantly  from the changelog of gcc-4.4, binutils2.19 and glibc2.9. Information about PLT(procedure linkage table), PIC(position independent code) and “h asm constraint”(??) will be highlighted.

3.Preparing for benchmarks and N32 ABI apps. Since the results from [2] show that a least one of the huge improvement from “march=mips1” to “march=mips3” is from audio CODEC test(Loongson = 230~240 seconds, mips1 = 500 seconds).Also, in their test, N32 ABI test result is missing duo to incompatibles. So provide enough N32 application is also a job.

4.Get to know buildd system if I have to host a mirror of Debian and this job come along with many more things to care about, things I can’t describe or predict right now(But I am SURE that there are so many such things!) such as how to host a mirror, how to access a remote host etc.

Well, for now, just these things above are within my short-sighted eyes and I’m not really sure what I saw is what it is. And time goes by, more and more new and stronger monsters will show their bloody teeth. So this job is really a challenge for me, a challenge lasting for 4 month to deal with and a challenge I believe will benefit me a lot if i succeed. *Very* luckily, I got r0bertz, foka and Lazyfai behind me!




GSoC Proposal: Creating a new MIPS N32 ABI port for Debian

April 5, 2009

Creating a new MIPS N32 ABI port for Debian


This project first focus on creating a new MIPS N32 ABI port for Debian. Different from O32 and N64, N32 is a address model which has most 64-bit capability but using 32-bit data structure to save space and process time a lot. A second focus will be given on making such a “mipsn32el” arch fully optimized for Loongson 2F CPU[6] which gains more and more popularity in subnotebook/netbook.


I’m now pursuing my master degree in Fudan University in Shanghai. I major in Micro Electronics and choose EDA software development as my research interest. I have experience with C/C++ programming in a FPGA EDA software project in my lab, in which I’m in charge of : a verilog parser using flex/bison; a netlist viewer using MFC. I’ve taken part in a Altera held competition with 2 other students in which we design and implement a “wireless multimedia monitoring system” which won us an outstanding reward finally. I have also some experience in porting linux to Xilinx and Altera’s FPGA development board although I just mainly copy other people’s pioneering work.

Besides the technical background, the best reason I give myself as the best person for this project are is I’m extremely fascinated by the open-source software development and joining in GSoC project is a precious opportunity to learn about it, including from mentors, developers and other students like me. Another reason worth to be mentioned is, I’m very proud to port one of the most popular and also my favorite linux distribution to Loongson, which is all designed by my own country. Loognson will not only benefit from the large amount of packages in Debian, but also from its talented developers and its influence in FOSS world.


In this project, there are 2 main tasks. First, create a MIPS N32 ABI port for Debian. As mentioned above, N32 ABI model is the best for current 64-bit MIPS arch. This port will use “-march=mips3 -mabi=n32” to make it more generic. The second goal of this project is to optimize the generic port for Loongson 2F with “-march=loongson”. Make such optimizations needs new feature supported in the latest tool chain, to be exactly, gcc-4.4, glibc2.9 and binutils2.19. It is reported that this optimization will fully utilize Loongson 2F’s 64-bit capability and push its performance to utmost [1]. Of course benchmarks will be provided to give a thorough comparison between O32, N32, N64, not only on loongson’s behalf but also will provide datas as reference for other MIPS systems.

Benefits to Debian:

With the growing popularity of Loongson 2F based computers such as Gdium Liberty 1000 Netbook[3], Lemote Yeeloong 8089 Notebook[4] and Fuloong[5], there is a great need and interest to have Debian running at top performance on these machines, especially to serve the greater cause of promoting free/open-source software and of providing computer-assisted education to those who most need it. This work will also make Debian more “universal” by adding a new arch and more popular through its use in Loongson based computer that it’ll attract more talented people to contribute to Debian.


The first three should be achieved with no excuse while the last two tasks especially the last one are optional. I list them here in case I can assure the quality of the first 3 tasks and there are time left for them.

  1. A minimal basic system of Debian fully optimized with N32 ABI
  2. Make this basic system optimized for Loongson 2F
  3. Providing benchmarks to compare performance among O32, N32 and N64 port. The comparison will not only take care of compilation time but also actual system performance as a whole.
  4. Migrating X windows and basic desktop environment
  5. Migrating application such as Iceweasel and

Project details:

As discussed with in IRC with foka, marga, r0bertz, aurel32 etc,  it is better to build a “generic” N32 ABI port at first and then we can use benchmark to fully study its performance compared with O32, N64 and N32 ABI optimized for Loongson 2F. I list jobs to be done down below:

I will start the porting just like others by following CLFS instructions to build a minimal system with N32 ABI by using “-march=mips3 -mabi=n32”. The “mipsel” port in current Debian repository is multilib version but mostly optimized for O32 which is very old. This “generic” port will push performance of those 64-bit MIPS systems to limit.

As such a minimal system is established, optimization for the Loongson will begin. The optimizing job is mostly done by a series of tools including gcc4.4, glibc2.9, binutils2.19. These version is selected because some features are supported in them. For instance, gcc4.4 is optimized for loongson by supporting its instruction set, pipe-line model and scheduler support etc. and  glibc,binutils support PLT etc.  I, on the other hand, will  focus on finding incompatibles.

Then benchmarks will be provided to give a thorough comparison between O32, N32, N64, not only on loongson’s behalf but also will provide datas as reference for other MIPS systems. There is a convincing report by r0bertz that said “coreutils compilation time reduced from 19 minutes to 12 minutes” and “30% overall speed improvement”. So the benchmarks should test against this report and besides these results, more tests should be run to treat the system performance as a whole instead of just choosing compilation time.

If everything goes smooth,the rest of the time will be devoted to porting X, basic desktop environment and other applications. Porting applications should be a collective job in community rather than a single person’s work. Making this job explicitly public will attract more people and will accelerate the pace of porting Debian to Loongson remarkably.

As above mentioned, r0bertz who likes to co-mentor this project with foka, has already pioneered this work using “-march=loongson2f -mabi=n32 -mplt”[1][2]. His work can be a good starting point for this project since he has already submitted many patches and applications for users to test. I think his opinions will help me a lot in this project.

Project schedule:

These timeline are fairly simple and inaccurate, however I’ll be very glad to change it with advice from mentors and other people caring this project.

  • Preparation Stage, April 20th~May 10th : Get myself started and finish Deliverables(1).
  • Mid-term stage, May 11st~July 5th : Deliverables(2)
  • pre-Final stage, July 6th~Aug 13th : A). Deliveralbes(3). The first 3 systems to compare include : the generic N32 version, the version optimized for Loongson and the “mipsel” multilib version Debian already have.B). Release a ‘testing’ version of Loongson based Debian on the internet to let volunteers in the community to try and test. C) Deliverables(4) and (5) if time allowed.
  • Final stage, Aug14th~Aug 23rd : Fix bugs, send patches, document the project and submit it to Google.

Other summer plans:

None, really. Idling on internet or playing wow if it’s counted.

Exams and other commitments:

No exams anymore. A little work involved with TA though.

If you are a Debian Developer:

Not yet.

If you are not Debian Developer:

Actually I’m the only Debianer in my whole lab(>100 students, lots of sub-labs), amazing huh?! Considering RH is not free, less packages and Ubuntu as a unstable version of Debian, there is no obvious reasons to ignore Debian. As a firm fans of Debian, I feel the need to promote the popularity of it, first in my lab and then on internet. As a relatively young Linuxer, I may not help people to solve their complicated problems but I can do tutorial jobs(like posting HOW-TOs) easily and happily. IMO, getting Debian more popular in China will be a very attractive idea since the user base in China is very large and due to this fact, more potential contributors will be led to FOSS world due to the effort Debian has made.

I was very lucky to find this project almost near the end of application. This project is a very precious chance for me in two reasons. It will provide me a environment in which I can learn a lot of interesting things and cool skills from mentors, developers and other students. I treat this project not as a assignment to finish but as a door leading to the great un-known world. Besides, the project involves Loongson 2F cpu which every Chinese people is proud of. And if i could port Debian, which is the best Linux distribution in my opinion, to Loongson, this summer will definitely be the most unforgettable summer in my life. So I’ll be very very happy contribute to this project in and after this summer.