Customizing linux kernel for new board - linux-kernel

I'm porting/customizing linux kernel for our board. I will base on atmel evolution board configuration, and I need to overwrite some startup routines and add our drivers.
Is there any document, link, forum where I can get information how to make it in Linux way ?
Which files can I overwrite, and which shall I create from scratch ?
Is this a Board Support Package question ?
Thank you

I doubt that there is short and simple answer to your question. To accomplish this task you should more or less good understand Linux as distribution (kernel + boot scripts + user space software) work together and how make them be a friends.
I could recommend you book, which I found extremely useful as embedded Linux engineer: Embedded Linux Primer: A Practical Real-World Approach (2nd Edition) I am quite confident it will answer most of your questions.

I think that's it. Short, nice, fresh:
http://free-electrons.com/blog/elce-2012-slides-porting-linux-to-new-arm-soc/

Related

Linux on Dragonboard APQ8074

I have a DragonBoard APQ8074 with SnapDragon 800. I am able to successfully build Android and run some OpenCL related apps on this.
I am currently trying to build a linux kernel and load either Ubuntu or Fedora on this board.
It wouldbe really helpful if anyone could point me to suitable posts or guides.
I did look into Freedreno, it is really a good starting point, but i am still unable to understand the part of initrd/ramdisk img file.
Also the bootloader (similar to u-boot i assume), i am not clear which parts of it i need to update, if at all necessary.
Thanks in advance.
regard,
Anup.
This might help http://whiteboard.ping.se/Android/Android. There's a few sections there that might be handy. I also found this other article that helped me understand intrd and intramfs a bit better if that helps. http://www.linux.com/learn/linux-career-center/114923-the-kernel-newbie-corner-qinitrdq-and-qinitramfsq-some-unfinished-business

UEFI BootLoader

I am looking at developing a simple (to start with) UEFI Boot loader to load a ELF image, and was wondering if anyone had a good entry point into maybe any existing projects, or examples that I can use to get started out with.
In addition I was wondering if any one had any experience in getting virtual box to run an EFI application. I have set up a VM with EFI mother board but can seam to create an EFI System Partition for it to load out of (without using an OS), all I can achieve is the UEFI command line.
You might try taking a look at the GRUB or elilo source code. These are also good because they support loading ELF images. You might also look to the EDK2, there is a lot of good code there, and it's easy to build EFI executable images with it.
When referencing the UEFI, I also like to use Phoenix's wiki. I find the boot services entry to be especially useful.
Hope this helps at least a little!
I recently became interested in bootloaders too. I'm still a newbie in this field, but I found this interesting step-by-step tutorial to code a "Hello World" bootloader. Hope it gives you or anyone else with the same question a starting point for developing your bootloader.
GRUB installation on UEFI is possible by means of grub-mkimage. ELF binaries are known to be similarly masqueraded as complying UEFI's PE32+ requirement. If some C developers will refactor the code as done by https://www.kernel.org/doc/Documentation/efi-stub.txt and then generalize mkimage's that code as a separate tool for the sake of multibooters without PE32+ kernel loaders for every OS...
Just imagine
ld -b input-format -o <output>.efi --oformat=output-format objfile ...

How to debug hacked Linux Kernel code

I am newbie in this filed.
I don't have no good way to debug it. Just build it, reboot and run.
Any hint is very appreciated!
Depending on what you are hacking, it might be better to use UML (User Mode Linux). If you're messing with non-hardware dependent code, then I think it will help a great deal.
UML allows you to compile the kernel as an ordinary user mode program, and run it as any other application on your system. Because it runs like a regular application, you can very easily debug it with gdb, or any other debugger of choice.
Here's a good start for UML
I'd recommend you to start from reading 4th chapter ("Debugging Techniques") of classical Linux Device Drivers book.

The possibility of creating an OS independent GUI software

Greetings , I have a few questions that need experts' help to demystify it.
Question:
1.)Can a GUI be created without using any framework or API like GDI and DirectX??
2.)How microsoft develop the GUI environment for his OS??
3.)Is it possible that I could get knowledge about creating a GUI which run during booting without relying on an OS??Does it require any special tools which we do not own at home but is available in microsoft??
4.)Any book recommended for me to know more about GUI development of OS like windows and linux??
Thanks for spending time reading my question , your help is much appreciated
I'm not an expert on this field but to my knowledge:
Without considering your question #3, Yes, use a programming language (PL), but if you consider PL's as framework then NO, or even if it's possible, it is certainly not practical. Even Assembly (machine language) is a programming language.
To help understand the answer to this question, I suggest you read what an operating system is and how it is created. MS Windows (depending on the version) is written using PL: C, C++, C#, and Assembly. They used what we consider now as "low-level" programming to create their GUI's.
I find this question conflicting, I believe you need an OS to run a GUI. Because an operating system is responsible for connecting your hardware together (e.g. where to output the display, where to get the inputs like keyboard and mouse, etc). If you want, create an OS yourself but again, I find this very impractical. What you can do is start learning how to create GUI from Linux or even build your own minimalistic OS from Linux from Scratch. I recommended Linux because it's free and mature (relatively stable, has tons of documentation and internet references)!
I can't recommend any specific book, but types of book: Programming Languages and Operating Systems. Also, you can find all the resources you need on the internet. You just need to know exactly what questions you are looking an answer for.
But if you simply want to create a GUI that can run on most Operating Systems, this has been the aim of Java. Java uses a virtual machine to do this. Of course there are other options too, you can research about it. If it's already available that suits your needs and it's legally free, use it. It will save you a lot of effort. :)

Which is easier to write drivers for? Windows or LInux?

I am trying to learn a little about driver development and my question is, which OS has an easier API to develop drivers with? Windows or Linux?
Remember that I am new to this.
Thanks
If you are doing this for learning (I guess its your case), then go for Linux, you will have a more general ideal on how an OS works, you will interact with low level implementation straight to the core.
If you are just writing a driver for a device, I recommend using Visual Studio under Windows, it has a lot of features that will really help on your devel.
I am pretty sure you'll get lots of Windows vs Linux war here, unfortunately.
On Windows, you'll get pretty good development tools, with some awkward stuff, but that you can get along with easily. API is documented provided you have access to a Windows Developer account. Remote debugging is supported and it helps a lot for these kernel stuff that are triggering BSOD so quickly.
On Linux, you'll need to get your hands more dirty. Rubini's "Linux Device Drivers" is a very good starting point. Openness will bring you more flexibility, and more understanding of what is happening.
This tutorial might be helpful.
It is about writing a simple device driver for linux.
My personal idea is Linux. You can see the entire code other than an API.
I think Windows is good.
Because it has a rich set of API's which is easier to use

Resources