How do I compile mips gnu? - linux

I am not even sure my thread title is correct or not. Here is my story. I visited western digital website to check for a new firmware of wdtv live. I found source code of wdtv live OS is available to download. I downloaded "WDTV GPL Code" on http://support.wdc.com/product/download.asp?groupid=1003&lang=en. I extracted it and...came up with
mips-4.3.tgz
linux_kernel_2.6.22.19-19.tgz
I googled about those two archive and I guess "mips-4.3.tgz" is operating system and "linux_kernel_2.6.22.19-19.tgz" is linux kernel obviously.
In my understanding, I need to have a running linux in order to compile linux kernel. So I assume that I have to install mips-4.3.tgz somehow.
Does anyone have any idea on how to install mips??

While these instructions seem to be geared towards the Android, maybe they can be of some use.

Related

How to compile the Linux kernel to be as small as possible?

I'm working on a side project which requires me to configure and compile a tiny Linux System based on Ubuntu.
The result should be a tiny OS with the following features:
A Bootloader
A Kernel
A Process
A Thread
Miscellaneous (if possible)
A File System
Virtual memory
A Console
I read lots of documents about it, one of them being: http://users.cecs.anu.edu.au/~okeefe/p2b/buildMin/buildMin.html#toc3
I deleted the file system, and recompiled the kernel using make xconfig. I tried to deactivate modules and configurations many times, but it's not working for me.
How can I configure the kernel for the OS with only the features I listed above? What options can I disable or enable while still having a working system?
Having the Kernel very small is not important for Ubuntu, so maybe choosing Ubuntu is part of your problem. I would use as starting point what OpenWRT does. They do a good work making the Kernel small and it is easy to get started. OpenWrt Buildroot – Usage
try Linux From Scratch. It is a step by step approach on building a minimal Linux system from which you can evolve later on. http://www.linuxfromscratch.org/.
Use Gentoo Linux distribution - it's great for practicing on creation of Linux systems. Gentoo has excellent setup documentation, for example about configuring the kernel.
And Gentoo is a little easier and faster to setup than Linux From Scratch (LFS). If you want to go deeper, then LFS may be a good learning step too.

Tweaking linux kernel

I am new to linux programming & interested to tweak linux kernel(though I am not sure, what to tweak, I am planning to write drivers for particular device). To learn internal of kernel, I have started from historic kernel release (first release).
My problem is, how to test whatever changes I am doing for development, without disturbing my current os environment.(ubuntu 12, 64 bit). Is there any way like virtual box, sandbox?
Along with these, if anybody send some good approaches to learn these things, I would be really greatful.
Thank You.
If you're new to linux programming then you really don't want to be tweaking the kernel. You really want to be an advanced programmer capable of programming drivers and complex software first.
But yes there is, you can can create a virtual machine using openbox or vmware. If you're really keen on tweaking the kernel you probably want to first just try compiling and configuring the kernel and seeing if that works.
Also make sure you're well acquainted with how the kernel works and advanced OS designs in general.
Search in google fr "Kernel configuration" you u will get many links how to configure your own kernel.
And one more thing do not use a outdated version of kernel ,always use latest stable release , because a lot of code and API is changed in new versions and no book in market is updated so ,, u have to read from kernel documentation. Thats the best way to learn the most updated information about linux kernel
Yes, you can test your changes on any of the commonly available virtual machines (VMs); that way, whatever changes you make to the VM kernel won't affect native OS.
Personally, I prefer using CentOS 64 bit on VMWare Player. With this setup, I got away with minimal system maintenance while was able to focus on the actual job at hand. Once the VM is up & running, you can download and compile one of the latest stable releases from kernel.org. Instructions on compiling your downloaded version of kernel could be found here and here; however, this may require little tweaking based on your actual setup. Once the VM is running on your desired version of kernel, using a combination of cscope and ctags will help you immensely in kernel code browsing.
Finally, if you want to become a serious kernel programmer and write your own device drivers, you need to get familiar with it in the first place. Below are a few excellent references -
Linux Device Driver by Corbet, Rubini, Kroah-Hartman, 3rd edition
Linux Kernel Development by Robert Love, 3rd edition
Understanding the Linux Kernel by Bovet, Cesati
Linux kernel source (ideally placed into your /usr/src/$(DESIRED_KERNEL) path, symlinked to /usr/src/linux)
Going through these books is a tedious job and chances are that you may hit the roadblock from time to time. kernelnewbies mailing list and StackOverflow are some of the few reliable places where people would be happy to answer to your queries.
Good luck!

Best linux distribution to do Kernel Module programming

I want to do kernel module programming. But, all sources tell that linux distributions patch the original kernel and that module codes might not run on them. If this is true, what should i do.I tried making lfs using ubuntu but errors cropped up at almost every step. I saw somewhere that arch, gentoo, Ubuntu Server without any packages selected during the installation, slackware, susestudio etc. are vanilla distributions. So, can i use them for module programming?
Please suggest keeping in mind that i need a GUI in the distribution.
Can this be followed?
PS: I have a intel core i3 processor and will be running the distros on vmware workstation.
If you want to program kernel modules then it doesn't matter which distribution you choose. You will need to be able to recompile the kernel from source and install a new kernel yourself. Even just for a kernel module you'll want to be able to compile the latest kernel and develop against that, otherwise you won't be able to get the module accepted in to mainline.
An alternative if the module is not to be released is to develop against a particular kernel version. In this instance then the choice of distribution should be chosen based on the target for the module - not the development environment.
So pick a distribution based on what you like:
1) Desktops - (GNOME, KDE, other)
2) Ease of use - (Ubuntu, Fedora, etc vs Arch, Gentoo)
3) Cutting edge vs Stable (Arch, Fedora vs Ubuntu vs Debian, Red Hat, CentOS)
Then head off to kernelbewbies to learn a bit about getting started with kernel programming (where to get the source, how to compile it). Then read Greg Kroah-Hartman's excellent book on linux device drivers. The interfaces will have changed (it's written about version 2.6 of the kernel and version 3.6 is currently being worked on). It can be found online here
You'll also want to learn how to use git. And more importantly how to use git to generate a patch and email it without messing it up! I don't have a website for this but a bit of googling will help.

Best way to build cross toolchains on Mac OS X

I spent the last three weeks researching about crossdevelopment under Mac OS X. I want to achieve two separate results, but I believe they can be reached through the same path.
I want to
set up distcc to help my old Gentoo laptop using the iMac I recently got at home (OS X 10.6, 64 bit native) which I also use for iOS development, so Xcode 4 tools are already there;
develop my pet project which is an elf kernel for x86, x86_64, and arm (and I'll stop here as it's OT).
So, after a lot of that thinking thing we all do in these cases, I came up the idea that to reach the first goal I need to set up an i686-pc-linux-gnu toolchain (or is it i686-unknown-linux-gnu?) with all the appropriate versions (eg gcc-4.4) and make it callable by distcc. It seems like a reasonable task, but unfortunately there seem to be clearer tools and instructions to build toolchains for obscure archs like sparc or mips, and not a single reasonably updated resource on how to go for x86 the best way. Therefore, first question: is there anybody that succesfully build such a toolchain and feels like sharing the pain? :)
Second goal. My current workbench is made of Gentoo on an i686 laptop (yes, the same as the first goal) with all the regular development stuff, and I use QEMU to test it (its gdb integration is awesome). What I'd really like to do is to keep using the laptop while travelling (I do a lot of commuting) and continue to work and test on the iMac when I'm home (git is awesome in this respect). Hence, second question: is there anybody that have done something like this and wants to share?
I'd really appreciate any input. Seriously.
EDIT I know about MacPorts, crosstool, and crosstool-ng. I tried installing i386-elf-binutils 2.18 from MacPorts just to discover I have 2.20 in my laptop. Also I couldn't get gcc44 to produce i686-pc-linux-gnu elf objects, and using i386-elf-gcc is not an option as I need 4.4 and the packaged one is 4.3.
This is no easy task, specially because you want to cross compile for so many different platforms.
The most used approach is to run a Virtual Machine with the desired OS (e.g. VirtualBox, Parallels, VMWare Fusion) and install your workbench tools to work from it. This is very often used because it's not complex to setup and it also make it easier to write, test and debug code for/from the target system.
Of course, if you search enough you'll find all sorts of hacks/tricks to setup a toolchain on Mac OS X and compile code for other architectures:
One of these uses Buildroot, but that means that there is no official support for Mac OS X.
Another one, also interesting, offers a .dmg package with the tools needed to compile for Linux on MacOS X.
You already mentioned Gentoo, so I think you should take a look at Gentoo Prefix. Gentoo Prefix lets you install a small Gentoo system in a user defined directory (= prefix). From there, you may start a shell which lets you use portage (= Gentoo's package system) which should enable you to install the necessary tools.
I do not know in what shape Prefix on OS X today is, but I was able to install it on a friend's MacBook a year or so ago. If you are interested, I can give further details about the installation process which can be a bit tricky.

Need some advise to begin programming on ARM (with linux) platform

I will have (maybe) to work soon on ARM platform hosting a linux distribution (I don't know which distribution ..).
I know the project concerns video streaming, but I can't tell you more. Actually I only received the announe, and meet nobody yet.
I've never worked on such platform. So the idea for me is to test before the project starts.
What would you advise me to undestand how works such platform ? Internet links? Tutorials? Tools
Morevover, as I don't have any ARM processor at home (well only my iPhone ..) Which virtual machine would you advise me? (I clearly don't want to lose time installing and testing every one of them.)
I am aware of this page on wikipedia. Which one is the more appropriate running on a MacOS X 10.5/intel platform? Which linux distribution to install on the virtual machine?
I know the topic is quite wide, so any idea is welcomed! :-)
For a virtual machine that can emulate a ARM platform try QEMU. You can install a ARM-based Debian Linux distribution and tinker around with it. A google search on ARM, QEMU and Debian will get you started.
Also: Don't worry to much about the ARM CPU. You will use linux, so all the low-level stuff is already done for you. It's much more important to learn how the linux boot process works. How to install stuff ect. You will rarely (if ever) notice that you're running on a ARM device. The big difference to a PC running linux is, that the ARM will be a lot slower.
If you're looking for a real piece of hardware to play around with I suggest that you take a look at the beagleboard (www.beagleboard.org). It's cheap (around $150) and runs (among other things) various linux distributions.
With the beagleboard you'll get the whole linux cross compilation experience if you want (be warned: you'll pull your hair out).
I can't answer all of your questions, but there's a full port of Debian GNU/Linux on ARM. Works fabulously in my experience (I've tried it on a QNAP). Everything that's available in Debian works on QNAP now! So it's probably easiest to first try Debian tools and packages that come close to your project, and then continue from there.

Resources