12

I am new to kernel and embedded Linux. I have recently bought a Raspberry Pi and booted it using the Raspbian. I was fascinated by the Pi, to learn more on Embedded I have decided to make an home automation system. I wanted to use my own kernel, and stack. ie I don't want to use any of the OS.

For that I have download Kernel, target_fs, firmware, and tool-chain from the official github. I have compiled the kernel using the tool-chain.

Now I don't know how to put this to a new sdcard (formatted for a fresh start). What all things I have to take care before booting my stack? Since I have not put ssh or telnet server/Client, how can i know the boot was successful. Where can I get a ssh/telnet daemon for the pi? My aim is to boot only the kernel(or bare minimum) in the Raspberry Pi.

Jacobm001
  • 11,904
  • 7
  • 47
  • 58
CenTauR
  • 123
  • 1
  • 1
  • 4

3 Answers3

10

The kernel expects two things: a root filesystem, and an init daemon that resides on it. The init included with raspbian is a sysV style system. You are not tied to that -- other init systems commonly used with linux (remember: the kernel is linux) are systemd and upstart -- but you do need an init system of some sort.

You can also put init in an initramfs and have it built into the kernel, in which case you could get away without a root filesystem, but that seems pointless in this case.

init is the only userland application started by the kernel. Normally, it then starts processes which open ttys with a login, and then other services that may start a display manager, sshd, etc. You may not need the login, but you probably want the tty; you could also just start sshd directly instead.

Where can i get a ssh/telnet daemon for the pi?

Get it from the same place raspbian did, the upstream source. None of this stuff was written specifically for the pi. Or at least, very very little of it. It's been used on a huge variety of different systems.

If you want one pre-compiled for the pi...well, that's raspbian, etc.1

i don't know how to put this to a new sdcard

You'll have to use the pi-specific bootloader which is in the /boot partition of the raspbian image.


1. To be brutally honest, I think you are on a massively quixotic quest that, based on the knowledge implied by your question, you have virtually no hope of accomplishing this year unless you quit your job and devote yourself to learning full time, and even then your chance of failure is very high and it will take you months to reach a point where you have any chance of success. It is not simple. It is not easy. That said, even if you do fail, you will probably learn some useful things along the way. However, the time might be better spent learning to understand an existing distribution (such as raspbian) and how to use it to create your home automation system.

goldilocks
  • 60,325
  • 17
  • 117
  • 234
7

For just getting started, I think you have the wrong concept of using embedded computers (especially at the Raspberry Pi level). If you really want to build a custom OS I suggest you start at Linux from Scratch, LFS, http://www.linuxfromscratch.org/ but if you want to understand embedded computing start by Googling "embedded systems", Wikipedia, or Embedded Linux Wiki http://elinux.org/Main_Page.

Joe Zilch
  • 116
  • 1
  • 3
0

The LFS (Linux From Scratch) project is the best go-to resource for building a custom Linux distro from source code on an Intel style x86/x86-64 architecture. Pi LFS Has the up to date modifications and instructions for building on ARM.

When building a custom Linux image on any target architecture, you usually start with an existing image, make a new partition on your drive, and from the existing os, download and build the new image on to the new partition. Finally you cross your fingers and try booting into the new partition. If everything boots and runs as expected you can package up the new os image, delete the old os/partition, or generally use as desired.

This is true for the Raspberry pi. You start by booting in to Raspban on your Pi, make a new partition on the SD card, download/build the new OS, and try rebooting in to the new partition. This can all be done via GUI on the Pi, or via a headless SSH session, but the actual build is done entirely on the Pi. Depending on your internet connection, size of the new build, and RPi model this usually takes anywhere from 5-20 hours.

Building without any existing os (like when inventing a brand new chip architecture) is a real pain, and rather advanced stuff. It requires cross compiling and flashing to your chip using specialty hardware. If you want to learn more, start by learning basic bare-mettle AVR programing using an Arduino Uno and the AVRDude compiler.