Making Simple Linux Distro from Scratch

Поделиться
HTML-код
  • Опубликовано: 11 янв 2025

Комментарии • 447

  • @nirlichtman
    @nirlichtman  2 месяца назад +7

    - Note that if you don't get the bzImage is ready message when make finishes, it may be that the build failed, try running make without the -j flag, this can help you see the error more clearly (if you use -j it can cause the error message from the build to get mixed with the output coming from the other build threads which can be confusing since you need to scroll up until you see the error)

    • @_h1x
      @_h1x 8 дней назад

      There is also a problem with BusyBox compiling on a system with kernel above 6.8, so I'll try ToyBox now

  • @Fellintr
    @Fellintr 8 месяцев назад +186

    This ~12 minute video explained it better than the entire "Linux From Scratch" book.

    • @takodaos
      @takodaos 8 месяцев назад +30

      The difference is that as the video said, this setup isn't usable or stable for production. Linux From Scratch, if done properly, can be

    • @IunahYT
      @IunahYT 7 месяцев назад +4

      @@takodaos you can theoretically just use this busybox and init script as a bootstrapper for a fuller distro, like alpine

  • @techhoppy
    @techhoppy Год назад +305

    I have run Linux since kernel 0.99 (Slackware on floppies) and never really knew/thought about the individual bits and pieces that make up a Linux system. This is super educational. I would love to see an expanded version of this that allows for a basic Linux distro (that includes everything that you mention it would need for production) but without any of the bloat that normally comes with distros. A tiny server Linux if you will. Also, just in general, thank you for making these videos - they're awesome! I appreciate the time and effort you put into them.

    • @nirlichtman
      @nirlichtman  Год назад +56

      Thanks! That's a cool idea :) maybe also in the direction of making a minimalist distro for raspberry pi

    • @facist_monk
      @facist_monk Год назад +5

      @@nirlichtman - Yes - as is said "you stole words from my mouth", raspberry pi. now i use diet pi but I still want to see the development from start for educational means. and 1 more thing now my eyes will be looking for the files shown in your video as Linux boots up on my laptop 😆

    • @techhoppy
      @techhoppy Год назад

      @@nirlichtman Yes, that would be awesome!

    • @samoylov1973
      @samoylov1973 Год назад +2

      @@nirlichtman, thank you for the videos, that you make. A minimalist distro for raspberry pi sounds nice. Please do it, when you've got time. Waiting for it.

    • @reyuki-i
      @reyuki-i Год назад

      agreed, it would be very helpful!

  • @faithinverity8523
    @faithinverity8523 10 месяцев назад +24

    I have been studying how to do this for thirty years and this is the most coherent explanation/demonstration of how to make a bootable system that I have seen. This is a magnificent work. Thank you.

  • @OdyseeEnjoyer
    @OdyseeEnjoyer Год назад +856

    My guy really using Ubuntu on Windows Terminal with DWM to build a distro from scratch

    • @user-zn3zx6fk7u
      @user-zn3zx6fk7u Год назад +79

      i legit had to go to the bathroom bc of that

    • @Opensky-12
      @Opensky-12 Год назад +17

      Your "Guy" mabye use WSL (Windows Subsystem For Linux)

    • @huhulili9021
      @huhulili9021 Год назад +91

      ​@@Opensky-12'your "guy"' most definitely did not use WSL lmao, he literally spun up a docker container step 1

    • @Opensky-12
      @Opensky-12 Год назад +3

      @@huhulili9021 Sorry

    • @darkceptor44
      @darkceptor44 Год назад

      @@huhulili9021 docker desktop (windows) depends on wsl but it exposes the docker command to use in cmd/psh

  • @SystemTomcat
    @SystemTomcat Год назад +62

    I think this is the best educated Linux tutorial I've ever seen

    • @bones.24
      @bones.24 8 месяцев назад

      Are you lying?

    • @notaprogrammer123
      @notaprogrammer123 6 месяцев назад

      No​@@bones.24

    • @yesh420
      @yesh420 6 месяцев назад

      @@bones.24 why would he?

    • @bones.24
      @bones.24 6 месяцев назад

      @@yesh420 prophets lied, why wouldn’t he

    • @yesh420
      @yesh420 6 месяцев назад

      @@bones.24 wdym?

  • @alexviralata1356
    @alexviralata1356 Год назад +256

    Wow, so this is the way to a truly unbloated distro bliss!
    Good stuff!

    • @nonenothingnull
      @nonenothingnull Год назад +21

      real unbloated implies kernel only has necessary options to run on hardware, busybox without the extra cruft...

    • @peterreed3104
      @peterreed3104 Год назад +1

      WinXP Desktop Pure genius How long ago?

    • @alexviralata1356
      @alexviralata1356 Год назад +8

      @@nonenothingnull Bro! How deep goes the rabbit hole?!?

    • @nonenothingnull
      @nonenothingnull Год назад

      @@alexviralata1356 very, tcc instead of gcc, musl, etc..

    • @the_original_dude
      @the_original_dude Год назад +4

      ​@@nonenothingnull who cares about busybox, it's only needed for a second at the startup. The real pain is choosing only the needed kernel options, while also maximizing the performance.

  • @torspedia
    @torspedia Год назад +59

    Even though I have no interest in doing something like this myself, I found the whole process rather interesting. 🙂

  • @hgilbert
    @hgilbert Год назад +51

    my dream of creating my very own linux distro one day, is a step closer. thanks!
    i tried LFS a long time ago, but gave up half way through did something wrong didn't know what.
    but yeah a full distro from scratch how cool is that. for educational purposes too.

    • @Mempler
      @Mempler Год назад +1

      I mean, lfs is more for developers. People who already know their way around on debugging the worst and shittiest situation possible

    • @LewisCowles
      @LewisCowles Год назад +3

      @@Mempler feels like this is for a certain kind of user too. Using docker and not volume mounting /boot-files, so that you have to docker cp later...
      omitting the configuration of syslinux
      using vi, instead of cat or echo to create files.
      It's nonetheless great to have many people with different ways of achieving what they need.

    • @Mempler
      @Mempler Год назад +3

      @@LewisCowles agreed, doing lfs helped me to learn linux in depth. funnily enough, i never read the book.
      I literally just googled a shit ton and reverse engineered arch linux lol

    • @angeldude101
      @angeldude101 11 месяцев назад

      I see LFS as something that everyone serious about Linux should install once, and then never actually use it. (If you really _want_ to use it, you can, but it probably won't be very enjoyable.)

  • @DrVektor
    @DrVektor 2 месяца назад

    I can't believe it. Was it that simple? You must be the best teacher in the world. You explained everything so clearly and in such a short time, you are great.

  • @xcoder1122
    @xcoder1122 Год назад +88

    Instead of
    dd if=/dev/zero of=boot bs=1M count=50
    you can also use
    truncate -s 50M boot
    truncate changes the size of a file. If the file does not yet exist, truncate creates it. If the size is shorter than it used to be, the file is in fact just "truncated", hence the name. Yet if the size is bigger, zeros are added at the end until the file reaches the desired new size.
    Not only is the command shorter, it also has another advantage: truncate creates a sparse file on systems that support that. That may not matter in this example but it would matter if the file was 100 GB in size. In a sparse file, only blocks of that file that contain actual data also use real disk space. All blocks that are still zero filled are virtual, they don't use any disk space and they are also not actually created when you created the file, so file creation is also ultra fast, as all that really happens is that a directory entry is created for that file. Yet when the file is accessed, it will always behave to any file operation as if the file really was 100 GB in size and all filled with zeros. If you jump to the middle of the file and write some data there, only blocks covered by that data will materialize and actually consume disk space, the rest of the file stays virtual.

    • @nirlichtman
      @nirlichtman  Год назад +32

      Nice, didn't know about truncate, will be useful for my upcoming graphical Linux from scratch video, thanks!

    • @leapbtw
      @leapbtw Год назад +2

      @@nirlichtman just seen this one, can’t wait :)

    • @Yazan_Majdalawi
      @Yazan_Majdalawi Год назад +4

      First time knowing about sparse files, I love it!
      Thanks for the great comment ⚘️

    • @BoominGame
      @BoominGame 9 месяцев назад

      Very instructive thanks!

    • @IunahYT
      @IunahYT 7 месяцев назад +1

      @@nirlichtman or use something like "fallocate -l 50M image" to do it in yet another way

  • @MadMathMike
    @MadMathMike Год назад +26

    You did this in 12 minutes?! That's crazy! 🤯

    • @BoominGame
      @BoominGame 9 месяцев назад +3

      That's linux, once you go black you don;t come back.

  • @TSPxEclipse
    @TSPxEclipse Год назад +10

    Oh wow, my genius brain clicked on this video thinking you were about to build a basic operating system written in Scratch. And now I want to see someone actually try to do that.

    • @commander3494
      @commander3494 Год назад +4

      I mean, there is linux on scratch

    • @AmilieMC
      @AmilieMC 11 месяцев назад

      yeah but that's just using the linux kernel making a disto, not a new OS itself@@commander3494

    • @ghosthunter0950
      @ghosthunter0950 8 месяцев назад

      ​@@commander3494 Is that a word play on Linux from scratch?

    • @commander3494
      @commander3494 8 месяцев назад

      @@ghosthunter0950 im not sure if ifs intentional or not

    • @IunahYT
      @IunahYT 7 месяцев назад

      @@ghosthunter0950no but it's just running a compact RISC-V emulator to run a VERY RUDIMENTARY Linux implementation that does not include most of the basic system utilities, and even text editing is limited to "ed" only, not even "vi", and forget about "nano"

  • @nabir14
    @nabir14 5 месяцев назад +3

    I am working on a linux distro and your video helped a lot. Thanks.

  • @KryllyxOfficial
    @KryllyxOfficial Год назад +3

    Really cool to see this, thank you for the simple and easy to follow tutorial. I look forward to diving deeper into how this works.

  • @JonathanNelson-nelsonj3
    @JonathanNelson-nelsonj3 8 месяцев назад

    Thank you this video! I have been using Linux for years, but I am interviewing with a company that builds their own kernel for their product and I wanted to know something about the process. This helped me so much!

  • @fabiosarts
    @fabiosarts Год назад +12

    That's so cool :O
    I did LFS like three times and i always wondered how could i simplify the process to the maximum

  • @Strong256
    @Strong256 Год назад +9

    May God bless you bro😂 I needed this tutorial. I tried this at first but since i knew nothing about where to place the kernel, or about how to create and use a bootloader, the best i could do was only to make a chroot folder (and i became really good at it lol i even forged my own "terminal" and got it to work in chroot) but now im gonna be practicing this new knowledge everytime i get a chance.
    Thanks a Lot. For now all i can do is add you a new sub. 🎉

    • @nirlichtman
      @nirlichtman  Год назад +2

      Thanks! :)

    • @Strong256
      @Strong256 Год назад

      @@nirlichtman pleasure bro. One day you'll get as many views as you deserve

    • @Strong256
      @Strong256 Год назад

      @@nirlichtman also, have you tried to make a syslinux boot disk with a drive size of say 8mb/8 counts? It doesn't work. Do you possibly know any reason why?

    • @nirlichtman
      @nirlichtman  Год назад

      You mean you are trying to write syslinux on a physical disk of 8MB?

    • @Strong256
      @Strong256 Год назад

      @@nirlichtman I mean a disk file (dd if=/dev/zero of=eight bs=1M count=8) kind of thing.
      Another issue I have seen is that it loads the kernel and the initramfs but it kinda gets stuck there , even after I followed the along with your tutorial.

  • @learnwithcode4211
    @learnwithcode4211 7 месяцев назад +2

    Thanks, Nir. It was my dream to build my own distro. I printed my name on the distro. Thanks again!

  • @tobyboulton8340
    @tobyboulton8340 6 месяцев назад +9

    Having busybox errors on the install?
    Edit the .config which is produced from make menuconfig
    FIND -> CONFIG_TC=y
    CHANGE TO -> CONFIG_TC=n
    make clean, make, make install

  • @shirojuancarlos3926
    @shirojuancarlos3926 11 месяцев назад +2

    This is the absolute best tutorial on this topic. Please do a tutorial on compiling more packages for the custom operating system. Packages like GCC, sudo, nano and whatnot. And please also do videos on setting up ttys that work hand in hand with key configurations, I've set up my ttys but they don't work with key configurations. A lot of demands here but please also do a video on setting up the root user, sudo (root access) users and normal users, as well as, how to compile and set up wayland, xorg, sddm and possibly even KDE Plasma.

  • @MrXiongbaobao
    @MrXiongbaobao 2 месяца назад

    It worked ! For info, I encountered the same mount problem (failed to set up loop device) as other commenters, just copied the boot file to my host system and did the "mount boot m + copy" operations from there.

  • @Ooo0ooooO00oo
    @Ooo0ooooO00oo 11 месяцев назад +55

    Funnily enough this is also exactly how Linus Torvalds created the first version of Linux back in the days. He just fired up docker and booted some Ubuntu image

    • @gabrieldornelles9310
      @gabrieldornelles9310 8 месяцев назад +6

      I laughed so hard, just opened the video and scrolled to the comments and saw that

    • @mehdieloualy2082
      @mehdieloualy2082 5 месяцев назад

      He should have used punch cards instead

    • @xoxogamewolf7585
      @xoxogamewolf7585 4 месяца назад

      yep

    • @jsark0756
      @jsark0756 4 месяца назад +1

      @@mehdieloualy2082 I remember seeing my first punch card machine in the 80s in a room full of IBM Mainframes, I thought I was on another planet!

  • @janjuliusvannieuwenhuyze9853
    @janjuliusvannieuwenhuyze9853 11 месяцев назад +7

    Following this tutorial was easier than installing arch Linux

    • @IunahYT
      @IunahYT 7 месяцев назад +1

      Except this is not arch so it doesn't help you in the slightest

    • @CosmiTech_Cosmo
      @CosmiTech_Cosmo Месяц назад

      I mean in Arch Linux you can just type archinstall and it basically does it for your @janjuliusvannieuwenhuyze9853

  • @Dr.Schiwago
    @Dr.Schiwago 3 месяца назад

    Just awesome, clean and simple, no bells and jingles. Thanks for sharing bro!

  • @chalybesmith
    @chalybesmith Год назад +5

    Very nice video! I would enjoy more like these!

  • @24Shredder
    @24Shredder Год назад +3

    This video is gold, thanks man. Ever thought about making a video on your very custom distro using the knowledge you showed us in this video?

  • @bizulk
    @bizulk 10 месяцев назад

    Hello. If I understood correclty the ramfs is indeed for syslinux. The kernel will mount the cpio archive pointed out by syslinux to the kernel through the command linux. I remember It is also possible to embbed the cpio inside the bzImage itself (option in menuconfig).

  • @TaschenRechner22
    @TaschenRechner22 Год назад +5

    Great tutorial Nir! I have a few followup questions.
    1) You used the default kernel config file that came with the repo, instead of replacing it with your Ubuntu machine's config file. And in the default config file, the only change you made was enabling 64 bit. Would that cause any issues if you were to use this kernel in production, since it wasn't "handcrafted" for your machine?
    2) Why don't you have to run 'make modules' after you make the kernel? Does the default config file just set all modules to be compiled into the kernel?
    3) If you set some modules in the config file to be compiled external from the kernel, where would we copy those .ko module binaries so the kernel could use them? Would they need to be copied into the initramfs cpio archive? Or would they need to be placed on a real disk in a root filesystem the kernel would switch to after it goes through initramfs?
    4) Since you copied BusyBox directly into the initramfs archive, the kernel didn't need to mount any real root file system on a real disk. However, suppose we did want to use a real root fs on a real disk, and install BusyBox there instead. How would we need to change the init program and initramfs directory structure and content to make the kernel mount the real disk and change the root directory to the one on the disk?

  • @uuu12343
    @uuu12343 Год назад +7

    Its hilarious how BusyBox is basically a legitimate add-on to docker in that both are containers but BusyBox works as a "from scratch" image for Docker, more so than the docker official scratch image itself

  • @ChaiRuou
    @ChaiRuou 11 месяцев назад

    this make me recall the time we were trying with LFS distro - just doing it without understand anything :)

  • @anon_y_mousse
    @anon_y_mousse Год назад +1

    Looks like someone else also watched Rob Landley's video on a minimalist Linux. Although this is even tighter than his, even if it doesn't exit properly.

  • @NickMoore
    @NickMoore 11 месяцев назад +1

    Very cool and well communicated. Thanks!

  • @komram4396
    @komram4396 Год назад +8

    Thanks for guide.
    I wonder , how extendable this system in your opinion ? I have been through Lfs book and I can't get rid of intrusive thoughts to build a (mostly) gnuless system from a linux installation you shown. I completely understand that it doesn't make any sense, pure enthusiasm and curiosity.

    • @nirlichtman
      @nirlichtman  Год назад +2

      It is as extendable as any other distro except that you need to manually bring over the package binaries for every tool you use (or manage to get some package manager running). To make it actually usable for day to day you would probably also want to setup proper tty devices, init (and not just start the shell right away like i do in the vid - busybox also includes init built in but I didn't use it in this video) and a persistent file system to start after the initramfs

    • @TheOnlyBootlegger
      @TheOnlyBootlegger Год назад +5

      @@nirlichtman nah just write every program you need in vi like a real hacker

    • @itsoctotv
      @itsoctotv Год назад

      ​@@nirlichtmando you have some documentation or recommendations on the persistent storage thing?

    • @LtdJorge
      @LtdJorge Год назад

      @@itsoctotvYou could create a 1GB zeroes file, format it with EXT4 and mount it at boot. The first part is the same as the FAT one here, then you have to pass it to QEMU and also write an fstab that mounts it, etc.

    • @IunahYT
      @IunahYT 7 месяцев назад

      @@nirlichtmantheoretically it maybe supports a subset of Debian packages since a minimal dpkg is present on it by default

  • @alexdumais
    @alexdumais Год назад

    The step I'm not following fully is at 9:25 when you mount boot into m. What happens when you mount a file to a directory then copy those files into that mounted directory?

    • @nirlichtman
      @nirlichtman  11 месяцев назад

      The file I am mounting on the directory is a disk image I initialized as a FAT file system, after I copy those files into the mounted directory it adds those files to the FAT file system on the disk image so the Syslinux bootloader that I installed on the disk image can find the kernel and initramfs

  • @myrnstories69
    @myrnstories69 11 месяцев назад +4

    Hi i keep getting an error when mounting boot as m (mount: m: failed to setup loop device for /boot-files/boot.)

    • @djsekav
      @djsekav 11 месяцев назад

      Try it with sudo

    • @theonlyasher
      @theonlyasher 10 месяцев назад

      me too, idk why and in docker im root

  • @nonetrix3066
    @nonetrix3066 Год назад +5

    Instead of running the shell with the shell, you could just use a symlink I think?

    • @nirlichtman
      @nirlichtman  Год назад +3

      Yes, that is a good point :)

    • @abrahimzaman360
      @abrahimzaman360 Год назад +1

      How?

    • @nirlichtman
      @nirlichtman  Год назад +2

      @@abrahimzaman360 ln -s

    • @cepmadbrozzer4448
      @cepmadbrozzer4448 Год назад

      Good point if you're not going to extend script further. Which I doubt if you would like to play with your distro and extend it.

  • @Tracing0029
    @Tracing0029 11 месяцев назад

    technically with EFI stub compiled into the kernel, you can directly boot it from uefi, no bootloader needed.

  • @rajanandj1177
    @rajanandj1177 11 месяцев назад

    I wanted to customize the kernel for development boards (embedded systems)
    and this video being what i realy expects by building the ninux kernel from scratch making this video as a series that show the other options for production standards

  • @fakestiv
    @fakestiv 8 месяцев назад +1

    How did this come to be? I mean... I already knew what a bootloader, kernel, busybox and initramfs did, but I never knew (or even got close to thinking for that matter) that you could put them together just like this. Did you first come up with the idea to do the bare minimum to get a shell working as init process, then read how the initramfs worked in detail just to get the system running and finally looked for a minimalist bootloader? Just how did this pop in your mind?

  • @nourway3639
    @nourway3639 5 месяцев назад +1

    Really cool videos, may I know how did you learn these stuff. Because I am trying to learn linux kernel for a long time with no significant progress

    • @nirlichtman
      @nirlichtman  5 месяцев назад +2

      Experience and curiosity :) Check out the welcome link on my channel for suggested learning resources

  • @almostxjp
    @almostxjp Год назад +2

    Can you make a follow up video like configuring syslinux to auto boot the os and adding persistence or burning it to a iso/img

    • @nirlichtman
      @nirlichtman  Год назад +5

      Yes, that is a good idea! BTW the image in the end that I boot with qemu is a disk image you can burn also to a physical disk using dd for example

  • @aciddev_
    @aciddev_ Год назад +1

    cool! combined with something like sinit and sbase and voila - extremely small desktop linux :)

  • @ameykaran
    @ameykaran 5 месяцев назад +1

    I'm unable to mount the boot file as it fails to setup loop device for /boot-files/boot

  • @prayer4675
    @prayer4675 8 месяцев назад

    Amazing and very useful for studying Linux!

  • @ABCABC-sw8mh
    @ABCABC-sw8mh Год назад +1

    How to create an iso from the img, maybe with grub to automatically load kernel +initramfs

  • @Daniel-cc5ph
    @Daniel-cc5ph Год назад +5

    Hello NIr,
    thank you very much for all your "in-depth" and short, very well explained videos! Great!
    Do you like to do a "real" minimalistic linux system with a graphical interface with that approach? What do you think? Or is it too much to think of and better take arch linux and do a minimalistic linux with dwm, vim and so on from there?
    Thanks, shalom and best regards
    Daniel

    • @nirlichtman
      @nirlichtman  Год назад +3

      Shalom Daniel, Thanks :) I haven't tried running Xorg on this distro so I am not sure if it would work, I do skip a few things that may be necessary to make the graphical interface work (for example running a proper init and setting up the tty devices), but this is a great idea for an additional video about actually setting up a minimalist graphical linux distro from scratch

    • @benikegaming
      @benikegaming Год назад +1

      @@nirlichtman any update on this?

  • @avidlearner710
    @avidlearner710 14 дней назад

    Great video, very good and clear explanation, ty :)

  • @raghav2032
    @raghav2032 7 месяцев назад +1

    Hey you installed busybox differently but *Build Minimal Linux in 1 Hour* guy did make a static binary and linked it inside /bin/busybox
    Can I ask what is the difference which is better approach?

  • @notactulurus
    @notactulurus Год назад +1

    I know a lot of people have asked the same question, but how would I write this to a USB drive to boot it on a real machine? I've tried to use tools like dd or genisoimage, but even after a few hours, I still can't get it to work. Usually, it just says there's no bootable device, other times, it says the device doesn't support UEFI booting.

  • @simplyhexagon
    @simplyhexagon Год назад +1

    Hello! I might be doing something wrong, but I tried to boot this on an older laptop without EFI support.
    Seemingly everything seems to be fine (booting it with GRUB, actually), but after I get a few messages from the kernel printed to the screen,
    everything goes black, my pendrive (the boot device) blinks a few times and I get stuck there.
    What could possibly be the issue?

  • @Artimis.depressed
    @Artimis.depressed Год назад +3

    Can you explain how you got DWM on what I assume to be windows?

    • @nirlichtman
      @nirlichtman  Год назад

      Explanation in the welcome link on my channel description

    • @Artimis.depressed
      @Artimis.depressed Год назад

      @@nirlichtman OK thank you
      - Artimis, bird of war.

  • @soheibmemes2594
    @soheibmemes2594 Месяц назад

    idk but maybe good starting point for a small busybox/linux musl setup thingy (maybe even use an init system like openrc!)

  • @gauthamnair
    @gauthamnair 13 дней назад

    It works, however when I try to install many more applications to the initramfs folder, like Python, Vim, etc, and make an init.cpio out of it, while boot, it says init.cpio not found. Or when I try putting syslinux.cfg and specify the init.cpio there, it says init.cpio....failed.....bad file number. Can you help me on that?

  • @SystemTomcat
    @SystemTomcat Год назад +3

    I'm getting an error with mount:
    `mount: m: failed to setup loop device for /boot-files/boot.`
    EDIT - FIXED: If you get the same error, just create a loop device and try mounting the file. If mount doesn't work, use losetup (search “how to mount file using losetup”). If losetup doesn't work *after* you've tried mount, delete the loop device by rebooting and try again, but just try losetup and not mount.
    How to create a loop device:
    `$ sudo mknod -m 660 /dev/loop0 b 7 0`

    • @nirlichtman
      @nirlichtman  Год назад +1

      Interesting, do you have loop devices in the /dev directory (for example /dev/loop1)?
      mount uses a loop device when mounting a file
      Also, what distro and architecture are you using and do you get anything more with mount -v?

    • @SystemTomcat
      @SystemTomcat Год назад

      @@nirlichtman Oh, I don’t have any loop devices. I did `lsblk` and didn’t see any loop devices. I was using the ubuntu:latest image on Docker with x86_64 if that helps. I can’t run the command right now, unfortunately.

    • @SystemTomcat
      @SystemTomcat Год назад

      @@nirlichtman I fixed it! It was just as simple as creating a loop device myself.

    • @nirlichtman
      @nirlichtman  Год назад

      @@SystemTomcat Nice :)

    • @xoxogamewolf7585
      @xoxogamewolf7585 4 месяца назад

      thx

  • @TON-vz3pe
    @TON-vz3pe Год назад +1

    I have few things to request if you don't mind creating a video.
    1. Can you create a distro using a base debian or ubuntu image?
    2. Illustration of how to use systemd as a init system.
    3. And use Grub2 as the bootloader.

  • @iflyplanesthrutunnels
    @iflyplanesthrutunnels Год назад +1

    why was this recommended to me at 12:​53 AM and why am I watching this

  • @saidafzalkholkhujaev
    @saidafzalkholkhujaev Год назад +3

    windows -> wsl -> ubuntu -> dwm -> distro from scratch

  • @anand-nb4bb
    @anand-nb4bb 3 месяца назад

    I have a query. I am trying to compile a kernel for testing purposes. I don't want to add/install it to linux, just want to compile & see how much time it takes to compile.
    So regarding my query, is there a way to monitor how much time it takes like some flag or option to be given before the compile command to know how much time it took to compile. My send query is that is there something called as linking after compiling the kernel if its there can you please let me know how to do it
    Kindly help. Please reply.

  • @blackthorne-rose
    @blackthorne-rose 9 месяцев назад +1

    "mount: m: failed to setup loop device for /boot-files/boot." ???

    • @blackthorne-rose
      @blackthorne-rose 9 месяцев назад

      problem solved... did "apt upgrade" in addition to "apt update"...

  • @laureven
    @laureven 11 месяцев назад +1

    Great video. Thank You .... Only I would change one thing :) ...as a total beginner, it would be nice to see the result / what to expect on the beginning of the video, and then the explanation how to do it. For me the experience was as : command after command, and I had no idea where we are going :) ...on the end it was totally worth it :) Thank You

    • @nirlichtman
      @nirlichtman  11 месяцев назад

      Thanks for the feedback! 👍

  • @shortwaverPL
    @shortwaverPL Год назад +1

    such amazing video. Can U publish similar but to create minimal system to boot on old raspberry 1/2 ? Regards!

  • @Lucy-Luc-Lu-L
    @Lucy-Luc-Lu-L 10 месяцев назад +1

    So I've tried doing this on my M1 mac and spent an hour swearing and cussing ;-) So the problem is the arm architecture (even the menuconfig is different). It creates a slightly differnt image (Image.gz) etc. And the worst problem is the bootloader. Syslinux doesn't exist there (but there is some syslinux-common package). If you could suggest some workarounds, it'd be great. Tried playing with u-boot, but since I have very little experience with bootloaders, I didn't make much progress.
    In the end I emulated the right architecture (docker run --platform linux/amd64) and I'm doing it from scratch again. However it's visibly slower. On original architecture, the kernel compiled in 8 minutes. Now I'm way past it and it's still compiling

    • @nirlichtman
      @nirlichtman  10 месяцев назад

      A possible solution to decrease the build time is to cross compile, you can try for example buildroot which should help easily cross compiling for different archs

    • @Mikami063
      @Mikami063 9 месяцев назад

      me too, i can feel you

  • @JohnMitchellCalif
    @JohnMitchellCalif 11 месяцев назад

    super clear and interesting! Subscribed.

  • @igamblenull2258
    @igamblenull2258 Год назад +2

    Nice video!
    I wanted also to implement the switching from the initramfs to a normal ext4 partition. It took me the last 6 hours because I had to use a different bootloader (systemd boot on aarch64) and because the fucking UEFI implementation for QEMU (asahi linux) did not had a SATA driver built in, I was not able to boot from any SATA disk, which means I have to use a virtio disk to boot and the Linux kernel did not want to detect a virtio disk but an SATA disk which means, I am currently having two disks with the same img file just to be able to boot from it and mount it in Linux. Arm is nice but the next time I am doing it on my Desktop with x86 xD

    • @1deadb0b
      @1deadb0b Год назад +1

      I too managed to do this but after a few days of reading and reverse engineering the archlinux iso
      mine is the same thing as in the video up until the init file, which instead of calling /bin/sh, mounts the hdd, chroots into it and asks for login without the kernel dying if you press Ctrl+D
      its very simple and not very operational so far but I think I can easily add systemd, git and gcc, and eventually make an actual distro out of that you can add your own packages

  • @AlexBastola
    @AlexBastola Год назад

    what do you recommend i look into/do if i want to go further in making it useable?

  • @jimmyscott5144
    @jimmyscott5144 11 месяцев назад

    Have you done one about buildroot? To make custom os for customs apps light weight

  • @lonk199
    @lonk199 Год назад +2

    When doing "mount boot m" I get an error: "mount: m: mount failed: Operation not permitted." I've searched online but nothing seems to work, please help

    • @nirlichtman
      @nirlichtman  Год назад

      Have you run the docker in privileged mode?

    • @lonk199
      @lonk199 Год назад

      @@nirlichtmanwhen i try to do -privileged when running the container is says that -privileged doesn’t exist: "unknown flag: --privileged"

    • @lonk199
      @lonk199 Год назад +1

      nvm i fixed it, i ran a new container and --privileged worked this time

  • @sabirrajabov
    @sabirrajabov 7 месяцев назад

    I have a custom built distro without boot configuration. So based on this tutorial, i did convert my whole root directory into init.cpio (init script also added). And did the same boot configuration(based on distro size, i have created the boot file with count=4000 (4GB)). But when i want to run the kernel via qemu, "init.cpio...failed, no such file or directory" error occures. Does anyone have a idea? The cpio file exist i had double check.

  • @tonyflamingo6614
    @tonyflamingo6614 3 месяца назад

    3:00 i didn’t get the bzimage is ready message. What can i do?

    • @nirlichtman
      @nirlichtman  2 месяца назад

      Perhaps the build failed, try running make without the -j flag, this can help you see the error more clearly (if you use -j it can cause the error message from the build to get mixed with the output coming from the other build threads)

  • @amosnimos
    @amosnimos 2 месяца назад

    Does it have a package manager? can you install a DE and x11?

  • @zobayer1
    @zobayer1 Год назад +1

    anyone else failing with "mount: m: failed to setup loop device for /boot-files/boot." on the first mount command?

    • @nirlichtman
      @nirlichtman  Год назад +1

      Make sure you started the docker with the privileged flag

  • @ΜάκηςΣτεφάτος
    @ΜάκηςΣτεφάτος Год назад +1

    Make a video showing how to install gcc on that distro

  • @pcartisan2721
    @pcartisan2721 Год назад +1

    BRAVO, BRAVO! That was great!

  • @stevenchristenson2428
    @stevenchristenson2428 8 месяцев назад

    I had to do somth9ing very similar before to be able to boot systemd system when using a btrfs file system. I however did not use busybox as I did not need a full enviroment to work in. The system basically just needed to load up enough system to be able to read the file system and start systemd, then pivot root into the real FS. Funny enough what you did is pretty much what dracut and other programs are actually doing when they create the initramfs image.

  • @k.r.3821
    @k.r.3821 9 месяцев назад

    It would be nice to start with Docker installation. Not everybody knows what it is.

  • @PAFBEAST
    @PAFBEAST 10 месяцев назад

    hey i wanna make my own ubuntu based distro with some custom tools amd softwars which i can then install on real computer too, with custom boot logo and all, can you guide in some main points like what to learn and from where to start, waiting for reply please must guide me

  • @Reelix
    @Reelix 11 месяцев назад

    MFW your x64 kernel compiles into the arch/x86 folder ._.

  • @MasterH2005
    @MasterH2005 10 месяцев назад

    Also, do you think you could please make a tutorial video on how to compile the custom distro into an ISO file?

    • @nirlichtman
      @nirlichtman  10 месяцев назад +1

      No need to create an ISO to get this running on a real computer, since all you have to do is write the boot image to a physical disk using something like dd for example (I should have added .img to the boot image name in the video to avoid confusion)

  • @reyuki-i
    @reyuki-i Год назад +2

    6:15
    Ahh, it confuses me, much like the chicken and egg situation 😅

    • @nirlichtman
      @nirlichtman  Год назад +3

      Are you talking about the fact that I used the shell to start the shell? I am just running the shell and the first command the shell is going to run is the shell :)

  • @plasmacotton
    @plasmacotton 3 месяца назад

    the busybox make CONFIG_PREFIX step is broken...

  • @fabrilluviaofficial
    @fabrilluviaofficial 11 месяцев назад +1

    boot is not an "*.img" file. help please!

    • @nirlichtman
      @nirlichtman  11 месяцев назад +1

      Where do you get this error?

    • @fabrilluviaofficial
      @fabrilluviaofficial 11 месяцев назад

      ​@@nirlichtmanjust before you open a new cmd tab to mount it with docker, I open on file explorer (because I use wsl), and it says "archive", I open it, and don't have extension! if I change the extension, to img and iso, vmware says "no operative system founded", and when I change it to iso, I cant mount it!

    • @fabrilluviaofficial
      @fabrilluviaofficial 11 месяцев назад +1

      @@nirlichtman i get it just before of mount it with docker, I have tried to change file extension, img = doesn't work at vmware, iso = doesn't mounts, and it doesn't work at vmware

  • @metl_play
    @metl_play Год назад

    So busy box is a user space? What are alternatives, primarily interested into using apt, if applicable a basic GUI (I have my mind of what Icon set I want to use). Those options are and or conditions. Just want to know some user space alternatives and its names.

    • @metl_play
      @metl_play Год назад

      ofc I meant user space interface

    • @Person1873
      @Person1873 Год назад

      You could also use gnu coreutils or uutils (rust rewrite of coreutils)
      These are the minimal set of Unix tools to have a functional cli
      You'll also need a proper init system like runit,initrc,systemd if you want to build a modern functional os

    • @metl_play
      @metl_play Год назад

      @@Person1873 Thank you very much. I just started to stick my head into this topic. This is very useful information, as before I wasn't able to find much about it without knowing what to look for.

  • @reyuki-i
    @reyuki-i 9 месяцев назад

    If I want to use the default init from the busybox instead of the simple bash you provide, what should I prepare?

    •  9 месяцев назад

      LFS will guide you :)

    • @IunahYT
      @IunahYT 7 месяцев назад

      Just compile busybox with it and "ln -s sbin/init init" so the kernel can use it

  • @Siissioe123
    @Siissioe123 Год назад +1

    is there a way to run the boot file on vbox?

    • @nirlichtman
      @nirlichtman  Год назад

      Shouldn't be a problem, you can also boot this on a real computer, it is a bootable disk image

  • @reyuki-i
    @reyuki-i 8 месяцев назад

    So this Linux system wasn't mounted to the root filesystem and instead stuck in the initramfs?
    I notice the root filesystem is not created. Wow looks interesting, didn't know that it would work.

  • @kobodrago2758
    @kobodrago2758 11 месяцев назад

    I am gonna try once i get some time to spare. Really interesting. Can we make a distro with AI integration ?

    • @PAFBEAST
      @PAFBEAST 10 месяцев назад

      Great question

  • @chrissmith7669
    @chrissmith7669 Год назад +2

    I can’t remember the name but in the pre Linux kernel 1.00 days there used to be a single boot floppy that would ask a bunch of questions, download and compile from sources. In those days I’d boot it and answer everything in the morning then let it down load, configure, compile, and install till the next morning. Lol. Ah the good ole days

  • @AlexChen-bu2de
    @AlexChen-bu2de Год назад +2

    Slackware installer is my ideal distro 😂

  • @tonywmckinney
    @tonywmckinney 11 месяцев назад

    Anyone know why I'm getting this on the "mount boot m" step? Tried ubuntu and Debian containers.

    • @tonywmckinney
      @tonywmckinney 11 месяцев назад

      Never mind. Turns out it was a Docker issue. Once I updated Docker, it works.

  • @gogogomes7025
    @gogogomes7025 Год назад

    If you make Linux inside of a Linux what Linux was used to make the first Linux 🤔🤔🤔

  • @geography_is_important
    @geography_is_important 8 месяцев назад

    Could you theoretically install a desktop envirement and make an iso out of it. thx, btw. good video

  • @milasudril
    @milasudril Год назад

    Is this minimalistic environment sufficient to bootstrap Linux From Scratch?

  • @NaomiUsman
    @NaomiUsman Месяц назад

    Great video! Been trying to replicate on my own. I use a MacOS and I am using Multipass VM will it work the same way?

    • @nirlichtman
      @nirlichtman  Месяц назад

      Thanks! I don't know Multipass but from what I understand it helps bring up Ubuntu virtual machine, so shouldn't be a problem. Only thing is that to run QEMU you'll probably want graphics so you might want to run QEMU natively on the Mac if Multipass is CLI only. (you can also technically run QEMU without graphics by passing -nographic and a serial tty option to the kernel command line)

    • @NaomiUsman
      @NaomiUsman Месяц назад

      @@nirlichtman Thank you for the response! I'd try this and come back to let you know if it works.

  • @MasterH2005
    @MasterH2005 10 месяцев назад

    I just finished the build process, but I wanna convert the boot file to an ISO or a .img file. However, I'm afraid that when I change the file name and type, it'll erase everything, causing me to start over. Can I still change the file type within File Explorer?

    • @nirlichtman
      @nirlichtman  10 месяцев назад +1

      Yes, there is no problem to do that, the boot file is a disk image so the .img file extension fits (it is just a matter of adding the .img extension to the end of the name).

    • @rudykfox
      @rudykfox 9 месяцев назад

      @@nirlichtman Hey man. I have a little trouble. How can I fix it?
      root@f7ad6d2c8317:/distro# mount boot m
      mount: m: failed to setup loop device for /distro/boot.

    • @nirlichtman
      @nirlichtman  9 месяцев назад

      @@rudykfox have you run the docker in privileged mode?

    • @rudykfox
      @rudykfox 9 месяцев назад

      @@nirlichtman yes. I did it in privilege mode. But I little fixed this by doing it on main machine. But I have next some little troubles:
      1. 'can't open /dev/tty2: No such file or directory' ,'can't open /dev/tty3: No such file or directory' ,'can't open /dev/tty4: No such file or directory' . How to fix it from starting system?
      2. Data doesn't saves after reboot. How to make It save?
      3. After putting some compiled program files in /bin/ we have kernel panic. How can I fix It?
      Thanks in advance for your answers. I'm just new to systems programming, let alone the complete system building process

    • @nirlichtman
      @nirlichtman  9 месяцев назад

      @@rudykfox check out my video about making a graphical linux distro, over there the file system is persistent, here it volatile. You can skip my steps over there related to the graphical stuff

  • @sarkar2320
    @sarkar2320 11 месяцев назад

    Hey I have a project as a part of my OS Course called "Linux Kernel Development". Can i make this as my project. Or kernel development is far more beyond what you did in the video?

    • @nirlichtman
      @nirlichtman  11 месяцев назад

      Depends on the project criterions, on this video I did not make any modifications in the kernel code but mostly worked with it as a whole component, I have a video about adding a simple system call to the kernel, that may be more relevant. Another option is my video about making a simple kernel module.

  • @silme9417
    @silme9417 Год назад +1

    I love your video, can you make one on how to make http request for windows os?

    • @nirlichtman
      @nirlichtman  Год назад +1

      Yes, I plan on covering some winsock related stuff as well :)

  • @StevenRotelli
    @StevenRotelli 3 месяца назад

    When he said boatloader kern user space I was thinking so basically Arch, not the ez mode tho.

  • @tkobe28
    @tkobe28 8 месяцев назад +18

    Why are you using Windows though?

    • @IAmOneAnt
      @IAmOneAnt 7 месяцев назад +1

      Gotta base yourself

    • @OOTKT1469
      @OOTKT1469 4 месяца назад

      Noob

    • @rjpd09
      @rjpd09 3 месяца назад +1

      @@tkobe28 that's windows subsystem for linux

  • @mrni6502
    @mrni6502 Год назад +1

    Hey man nice job on the tutorial! Only thing im stuck on is mounting the boot file. It says that it keeps on saying that vfat is unknown. Im not sure what I did wrong.

    • @nirlichtman
      @nirlichtman  Год назад +1

      Perhaps you forgot to install the dosfstools ?

    • @mrni6502
      @mrni6502 Год назад +1

      @@nirlichtman weird thing is that I have it installed. I'll reinstall it again and check it

    • @mrni6502
      @mrni6502 Год назад +1

      @@nirlichtman yeah it still gives me that error for some reason