Porting Linux kernel 2.6 to new MIPS board - linux-kernel

I wanna port Linux kernel 2.6.x to new MIPS board. Unfortunatelly, I can't find good actual documentation with step by step explaination. Hope, you'll help me. Paper books are OK too.
Thank you in advance!

First, get your hands on a MIPS toolchain. You're going to need it to compile the kernel. I've used buildroot a few times, including for building a MIPS toolchain.
But buildroot offers a lot more than just that:
Buildroot can generate any or all of a
cross-compilation toolchain, a root
filesystem, a kernel image and a
bootloader image. Buildroot is useful
mainly for people working with small
or embedded systems, using various CPU
architectures (x86, ARM, MIPS,
PowerPC, etc.) : it automates the
building process of your embedded
system and eases the cross-compilation
process.
If you would like to do this process manually, I suggest you take a look at this. It's not for MIPS but it shows the generic formula (you'll probably have to find and apply MIPS patches to the Kernel before compiling it). Try buildroot, it does all of this automagically!
I must also recommend reading Jun Sun's Linux MIPS Porting Guide.

Related

Setting up cross-compiler for existing codebase on new machine

I've done all my development work for an embedded linux device (gumstix) in a linux VM and I would like to move the code base to my host Linux computer. The cross-compiler was setup prior to me inheriting the codebase, so I'm not sure how the compiler was set up. I have some questions concerning how to set up the cross-compiler.
The compiler on the VM is a arm-linux-gnueabihf-gcc.
Is the cross-compiler kernel specific? (Using linux kernel 3.17)
Is the cross-compiler target device specific; i.e. do I need to use a gumstix compiler or is the arm-linux-gnueabihf-gcc satisfactory. Does this compiler need to be configured manually.
Is there a way to see/import the configuration setting of the working VM compiler?
Does the arm-linux-gnueabihf-gcc use the same standard library source code as the gcc compiler?
I've seen varying approaches to setting up cross-compilers on web. Where can I find comprehensive information for setting up a cross-compiler (More than a how-to, but also explains why).
Thank you
The cross compiler is not kernel specific nor target device specific. It is specific to the architecture of the SoC or processor you are targeting. So if your current compiler is arm-linux-gnueabihf-gcc it implies it can compile code for ARM32 processors which have floating point support in hardware. Depending on your host Linux system, you can install a similar compiler using the package manager or you may also download it from here.
Different people probably will recommend different approaches and also on whether a particular approach is easy or difficult. Regardless I tend to recommend building the complete target image and generating an SDK for doing development using something like Yocto/Openembedded or Buildroot.
Not sure exactly what you mean by Q4.

Prebuilt MIPS cross compiler with toolchain for MS-Windows

I'm using a MIPS cross compiler on my Linux machine which works great.
Now I need to compile the same application on Windows.
I'm searching the web for some prebuilt MIPS cross compiler (with toolchain) for MS-Windows, but without success.
Since I'm not sure how to do so, I'm asking if someone knows such prebuilt toolchain? or some guide how to convert my Linux toolchain for windows if it's possible?
Thanks.
You should use Codescape MIPS SDK.
It looks like Mentor has taken away the free MIPS toolchain from the CodeSourcery distribution. Maybe one of these might still work: https://www.linux-mips.org/wiki/Toolchains.

what is target architecture in computer science?

I am a beginner in programming and wanted to download a good C compiler to practice coding. So I thought of GCC and started a small research on it. I read a Wikipedia article on it. The article mentioned something about target architecture,which I do not know. Can anyone tell me what it means, and any source I can refer for more information. Thanks in advance.
The target architecture is the architecture which the compiler creates binary files for.
Common architectures are: i386 (Intel 32-bit), x86_64 (Intel 64-bit), armv7, arm64, etc...
GCC compiles C code (after the preprocessing stage) to assembly code,
and the assembly code varies depending on the CPU architecture.
The assembly code is then "assembled" to a binary file.
Something to keep in mind:
Two binary files are not guaranteed to be compatible across different operating systems despite sharing the same architecture.
A program compiled on Ubuntu Linux (let's say with arch x86_64) won't work on Windows (with same arc x86_64).
GCC identifies architectures by "triplets", like:
x86_64-apple-darwin14.0.0
i386-pc-mingw32
i686-pc-linux-gnu
Format is:
machine-vendor-operatingsystem (not always followed though)
They contain infos on both the architecture and the operating system.

GNU ARM toolchain with hardware floating point support

I have started working on STM32F4 Discovery board and have compiled and run a few basic programs using the latest Yagarto toolchain containing the GCC 4.6.2. Lately though on several forums I have read that many toolchains including the latest Yagarto have problems when it comes to using the on-board hardware FPU. I have also read that the latest CodeSourcery toolchain does support hardware floating point, but not in the lite edition!!
While digging deep into the topic I found this toolchain which is specifically for ARM Cortex M/R controllers, and claims to have no problems when it comes to hardware FPU.
https://launchpad.net/gcc-arm-embedded
I wanted to know from users' experience, if the hardware FPU problems really exist in Yagarto? I am interested in using Yagarto because I also work on ARM7 and yagarto supports that as well. So instead of having different toolchains for different architectures, it is convineant to have one for both ARM7 and Cortex M/R.
If the FPU problems do really exist, then could anyone suggest me a good tried and tested toolchain for both ARM7 and Cortex M/R?
P.S. : I use CodeSourcery's latest GNU Linux toolchain for the BeagleBoard (Cortex A-8), havn't yet faced any issues with it.
I just wrote an article about using ARM's free GCC toolchain (GNU Tools for ARM Embedded Processors) and STLINK on Linux/Ubuntu to write/program/debug code for an STM32F4 Discovery Board (the F4 is a Cortex M4) - that may help you, the compiler does have hardware floating point support and I'm using it in my examples...
http://www.wolinlabs.com/blog/linux.stm32.discovery.gcc.html

Windows based development for ARM processors

I am a complete newbie to the ARM world. I need to be able to write C code, compile it, and then download into an ARM emulator, and execute. I need to use the GCC 4.1.2 compiler for the C code compilation.
Can anybody point me in the correct directions for the following issues?
What tool chain to use?
What emulator to use?
Are there tutorials or guides on setting up the tool chain?
building a gcc cross compiler yourself is pretty easy. the gcc library and the C library and other things not so much, an embedded library and such a little harder. Depends on how embedded you want to get. I have little use for gcclib or a c library so roll your own works great for me.
After many years of doing this, perhaps it is an age thing, I now just go get the code sourcery tools. the lite version works great. yagarto, devkitarm, winarm or something like that (the site with a zillion examples) all work fine. emdebian also has a good pre-built toolchain. a number of these places if not all have info on how they built their toolchains from gnu sources.
You asked about gcc, but bear in mind that llvm is a strong competitor, and as far as cross compiling goes, since it always cross compiles, it is a far easier cross compiler to download and build and get working than gcc. the recent version is now producing code (for arm) that competes with gcc for performance. gcc is in no way a leader in performance, other compilers I have used run circles around it, but it has been improving with each release (well the 3.x versions sometimes produce better code than the 4.x versions, but you need 4.x for the newer cores and thumb2). even if you go with gcc, try the stable release of llvm from time to time.
qemu is a good emulator, depending on what you are doing the gba emulator virtual gameboy advance is good. There are a couple of nds emulators too. GDB and other places have what appear to be ARMs own armulator. I found it hard to extract and use, so I wrote my own, but being lazy only implemented the thumb instruction set, I called mine the thumbulator. easy to use. Far easier than qemu and armulator to add peripherals to and watch and debug your code. ymmv.
Hmmm I posted a similar answer for someone recently. Google: arm verilog and at umich you will find a file isc.tgz in which is an arm10 behavioural (as in you cannot make a chip from it therefore you can find verilog on the net) model. Which for someone wanting to learn an instruction set, watching your code execute at the gate level is about as good as it gets. Be careful, like a drug, you can get addicted then have a hard time when you go back to silicon where you have relatively zero visibility into your code while it is executing. Somewhere in stackoverflow I posted the steps involved to get that arm10 model and another file or two to turn it into an arm emulator using icarus verilog. gtkwave is a good and free tool for examining the wave (vcd) files.
Above all else you will need the ARM ARM. (The ARM Architectural Reference Manual). Just google it and find it on ARM's web site. There is pseudo code for each instruction teaching you what they do. Use the thumbulator or armulator or others if you need to understand more (mame has an arm core in it too). I make no guarantees that the thumbulator is 100% debugged or accurate, I took some common programs and compared their output to silicon both arm and non-arm to debug the core.
Toolchain you can use Yagarto http://www.yagarto.de/
Emulator you can use Proteus ISIS http://www.labcenter.com/index.cfm
(There is a demo version)
and tutorials, well, google them =)
Good luck!

Resources