3

Disclaimer: This is my first time delving into the embedded Linux world (Ubuntu and Debian), despite being a Linux user for some time and having used distros such as Raspbian, Armstrong(beaglebone) and embedded debian. The title may also seem generic, but I really couldn't think of a better one, I've gone to and from work, I've been reading a lot for the past few hours and it's waaaaay past my bed time to get my full beauty sleep, which I will not get a chance again until tuesday, so ... I apologize for grammar/syntaxe/formatting errors.

Background

How are packages like Debian, Armstrong, Ubuntu, OpenWRT, etc, built? I mean, I know that when you download the image to a board like a BeagleBone Black you need to build u-boot, the kernel as well as the packages and what differentiates these distros from one another are the packages (I could be wrong here, please correct me).

I have been reading on how to build these distros (Armstrong and OpenWRT to be precise) and all of them just tell me to download their repository and run their configuration scripts in order to get the distro running. And so, this lead me to think: " (1) What would happen if I had a custom board that does not fall under the configuration of BeagleBone, Raspberry Pi or any other well known board? (2) What did the creators of said boards do the first time they created a unique board? (3) How did they make their own distro? (4) Is it possible to make my own distro by installing any packages I want and make them different from the others?"

As you see there are 4 different questions, so I'll use the next paragraphs to explain myself, if necessary.

(1) What would happen if I had a custom board that does not fall under the configuration of BeagleBone, Raspberry Pi or any other well known board?

Ok. I tried reading the scripts they run in order to build the distro, but they are too long, it's very late and it has gotten me nowhere, I'm completely lost. By what I've been reading, I imagine that these scripts download u-boot, the kernel and the packages, build them and put them inside the same image (I have read how to "do it manually" with just the bootoader and kernel). I imagine that there are some configuration files, some where the board is described and all that but I can't be sure. Am I in the correct path?

(2)What did the creators of said boards do the first time they created a unique board?

Up until you may be thinking, "ok, just find a board that looks like your board, modify the files and get on with it". In the real world that's what I would do, but now I want to learn and I'll only learn if I carve all this knowledge into my head. The thing is, that there are several configuration files (by what I've studied from u-boot and the kernel) and everything in my body tells to read Embedded Linux Primer, 2nd edition, before asking this. If the answer to this is just too in depth, the please, tell me to read a book, but if not, could anybody help me?

(3)How did they make their own distro?

(4)Is it possible to make my own distro by installing any packages I want and make them different from the others?

I know that there is a lot of development behind distros, and by no means it is my intention to denigrate (is this the right word? English's not my native language, according to the definition it seems ok, but somehow feels "blargh" when used here) the development made by all these teams. It's just a question, could I build the bootloader, kernel, a few other random programs and packages and call it my own distro? If so, how do I build the package image into my distro?

If I'm developing a well-known distro from scratch, without using their scripts, would I build the bootloader, the kernel and everything that the well-known distro uses and then bind it in an image? Would I just build u-boot and the kernel and then install all the other sources and build my new linux image from that?

EDIT: I pefer leaving the text above so that new readers can get an idea of my line of thought. I find it difficult to express myself with few words and make it a "relatable question". So I put a header below that are the most objective questions I can think at the moment. I also edited a bit of the text and gave it a title. I just strike through the previous questions because they seem valid, albeit with a wide variety of good answers, because it may help others with my same questions. If needed I can just delete them.

Jump to the questions

There are a few questions I'd like to get an answer and Im trying to be as objective as possible with them

  1. Can I build a distro like OpenWRT from source code by downloading u-boot, the kernel and specific OpenWRT sources? I mean if I can do it without using their provided scripts. If I use their scripts I know I can modify some configurations and port it to my own "unique" dev board. Could yocto be my starting point?

  2. How can I configure my own unique dev board? Is it ok if I just compile u-boot and the kernel and install some programs on it later? Is it production ready?

  3. Many said something about Linux from scratch. The main argument against it I found was that it was horrible for production. Instead of telling me why it's horrible for production, could you please tell me how can I make my setup "good" for production?

morcillo
  • 967
  • 4
  • 17
  • 47
  • 2
    It sounds like your question is mostly not about "making a distro", but about *porting* a distro to a new target. They're pretty different processes. One is about *design*, the other is "mere" technical work. – hobbs Sep 10 '16 at 04:22
  • 1
    @hobbs It started being "just" a porting issue, but there are so many tutorials and walkthroughs to make things work that you barely need to think, unless you are developing an entirely new board unlike any other configurations available. In the end it came to building a distro from scratch, even if it is a weel known distro, but without using their scripts, I mean by downloading all the sources and creating the image from that – morcillo Sep 10 '16 at 21:59
  • 1
    I think the main thing that makes a distro "production-ready" is that it has dozens or even hundreds of programmers working to develop safe and sane configurations for the hundreds of packages included in the distro as well as keeping those hundreds of packages up-to-date and figuring out the proper version dependencies. If it's only you on this project and you don't want to use the packages and repositories of an existing distro, you may have to limit the number of pieces of outside software that you bring in. – Mark Plotnick Sep 10 '16 at 23:28
  • 1
    @MarkPlotnick Ok .... that makes a lot of sense, Thank you – morcillo Sep 11 '16 at 00:07
  • 1
    Do you really want a "distro" (with updates via packages), or just a kernel and root filesystem? (I've noticed that newbies often replace the term "rootfs" with "distro" as if they're synonyms.) – sawdust Sep 14 '16 at 02:46
  • @GhostCat Sorry it took me such a long time to accept it ... I thought I did a long time ago when it was posted, but yesterday, when I was reviewing all my questions I noticed that I hadn't given you the answer. Sorry again – morcillo Jul 31 '18 at 17:21
  • No problem. Late accepts feel nice to, they don't need real work, just posting a comment :-) – GhostCat Jul 31 '18 at 17:51

2 Answers2

3

Nowadays, one of the first first "stops" would be the Yocto toolkit which helps you building your distribution content. But of course, that is just one example of such a tool, and there many more out there.

In 2016, nobody would be doing a distro "manually from scratch" any more.

GhostCat
  • 127,190
  • 21
  • 146
  • 218
  • 1
    Doing it manually from scratch is still a good learning experience. Check out "linux from scratch". Not recommended for production. – Frank Meerkötter Sep 10 '16 at 06:21
  • 2
    @Frank_Meerkötter I didn't know about the yocto. I'll give it a try. I relly want to learn instead of doing things manually, and according to what yu said, it is a good starting point to learn – morcillo Sep 10 '16 at 22:02
2

yocto would do most of the work for you. Did you have a look into lfs http://www.linuxfromscratch.org/ Its also possible to install set of packages into a chroot environment and create a file system. Additional work would be required to install grub or any bootloader to make this a bootable image though.

plasmixs
  • 156
  • 5
  • Linux from scratch. This is the second instance of this I've come accross in this thread. From what I saw online it's kinda outdated and not suited for production, so I just assumed that it wasn't available anymore. The thing is that I don't want a toolkit o do it for me, I'd like to understand how it all comes together by doing it manually, with the least amount of scripts possible. For example, downloading the source for OpenWRT, u-boot and the kernel and then create an image with that – morcillo Sep 10 '16 at 22:05
  • I would suggest that you read the manuals @ .http://www.linuxfromscratch.org/lfs/ They give you lots of insight into this process of building a 'distro'. You may not opt to build one unless you have loads of time to spare. But believe me you would not regret reading it once. In LFS you start with from step 0 i.e setting up a compiler in order to start compiling the packages which would form the distro eventually. – plasmixs Sep 11 '16 at 08:06