News for hackers. Stuff that matters.
Re:Busybox-based Linux distro from scratch by st_goliath on Tuesday December 01, 2020 @05:15AM (#25263973)
Nice to see a version of this process for an UEFI kernel. ~2 years ago I was playing around with a similar LFS like, home made DIY distro myself which runs on an i586 router board and a Raspberry Pi.

Sadly this guide skips all the "fun parts" of bootstrapping your own compiler toolchain first, and instead downloads a pre-built one from a third party.

Based on my project, I also decided to write a small guide similar to this one, for the Raspberry Pi 3 as a target[1], but also included the toolchain bootstrapping process[2].

[1] https://github.com/AgentD/diy-linux-guide

[2] https://github.com/AgentD/diy-linux-guide/blob/master/crossc...

Re:Busybox-based Linux distro from scratch by 0xbadcafebee on Tuesday December 01, 2020 @11:14AM (#25266455)
I agree, you learn a lot doing this! I cut my teeth on portable build systems after cross-compiling a bootstrap toolchain for SH4 CPUs so I could build a Linux distro for my Dreamcast. Way more fun working on an unusual platform and building it from scratch.
Re:Busybox-based Linux distro from scratch by oso2k on Tuesday December 01, 2020 @05:15PM (#25270744)
Hahaha. I did that too based on the LinuxDevices article. I even had a few conversations with the author.

https://linuxdevices.org/turning-the-sega-dreamcast-into-a-l...

Re:Busybox-based Linux distro from scratch by gigel82 on Tuesday December 01, 2020 @03:49AM (#25263609)
Not sure of practical applications with super-cheap sizeable flash storage available everywhere, but it's nice to know you can still build a bootable Linux system entirely from scratch using simple instructions with latest kernels.

I might just give it a try for shits and giggles; I remember trying "Linux From Scratch" a decade or so ago and it took hours / days to get to a "bootable" state.

Re:Busybox-based Linux distro from scratch by pampa on Tuesday December 01, 2020 @04:45AM (#25263845)
Getting a bootable system is quite easy actually. Build a kernel, build a static busybox, install grub. Thats almost it. Maybe build iw and wpa_supplicant, if you want wireless. You can get to a bootable system within an hour or so.

But anything beyond that is a maze of vaguely specified dependencies. LFS was a good starting point, but i havent checked it for a while and I'm not sure it kept up with all the recent(ish) developments in distro building.

Re:Busybox-based Linux distro from scratch by roblabla on Tuesday December 01, 2020 @05:39AM (#25264091)
LFS is kept up to date. It has systemd and sysvinit variants, and the latest version was published in september. Thank god for this, because it's one of the only source to get a comprehensive list of all the components running on a Linux machine.
Re:Busybox-based Linux distro from scratch by qu4z-2 on Tuesday December 01, 2020 @04:51PM (#25270450)
If you're booting from UEFI you don't even need GRUB. You can make the kernel a UEFI app, register it, and then just select it from the BIOS list (or whatever we're calling that "Press F8 during bootup" thing now)
Re:Busybox-based Linux distro from scratch by splitbrain on Tuesday December 01, 2020 @08:28AM (#25264905)
"Maybe some people know, some does not, that Linux is itself a boot loader of some kind. At least, when using UEFI and this is what I want to use, it can be loaded directly by UEFI firmware. [...] it won’t be as simple as that, for legacy BIOS."

Hmm I remember it being that easy back in the early 2000s. IIRC it was enough to copy the kernel to a floppy disk and have it boot. Well, back then the Kernel and Busybox fit easily on a single 1.5MB disk...

Re:Busybox-based Linux distro from scratch by thesuperbigfrog on Tuesday December 01, 2020 @09:54AM (#25265663)
Many years ago I ran muLinux (http://www.linfo.org/mulinux) on an old desktop that I was gifted.

It was surprisingly capable for being so tiny and eventually led me to install Slackware (https://en.wikipedia.org/wiki/Slackware) on a better machine that had a CD-ROM drive.

Re:Busybox-based Linux distro from scratch by jrwr on Tuesday December 01, 2020 @09:48AM (#25265609)
There still was a tiny bootloader happening on that floppy. I /think/ back then it was still lilo (slackware boot floppies) OR syslinux bootloaders
Re:Busybox-based Linux distro from scratch by splitbrain on Tuesday December 01, 2020 @10:07AM (#25265777)
I'm relatively sure it worked without lilo (but that's so long ago I might be wrong).

This stackoverflow question suggests support for this was explicitly dropped from the linux kernel: https://superuser.com/questions/415429/how-to-boot-linux-ker...

Re:Busybox-based Linux distro from scratch by 0xbadcafebee on Tuesday December 01, 2020 @11:20AM (#25266531)
Yep, you had to modify the kernel to set some options so that it would know what device held the initrd (and where on the disk), and then you could dd that to the floppy and dd the initrd after it. At boot time the BIOS would load the kernel from the floopy, Linux would open the fd device, adjust the device to seek to the beginning of the initrd, mount the initrd, then load and execute init.

But the later convention was to create a loopback device tied to a disk image, mkfs.minix it, mount it, copy the kernel and an initrd, and run lilo on the loopback device. Then unmount and decouple the loopback from the disk image and dd that to the floppy. It didn't really take up any extra space and made it easier to update your initrd or kernel.

Re:Busybox-based Linux distro from scratch by 0x0 on Tuesday December 01, 2020 @02:02PM (#25268557)
The BIOS only loads a 512 byte sector, never a whole kernel. So if you want to directly boot a zImage, the first 512 bytes of the zImage would need to implement floppy sector reading loops to load the rest of the kernel block by block.
Re:Busybox-based Linux distro from scratch by 0xbadcafebee on Tuesday December 01, 2020 @10:38PM (#25272989)
I think you're right, it could be I used uncompressed kernels for the first example (it's been a few years...)
Re:Busybox-based Linux distro from scratch by omanom on Tuesday December 01, 2020 @08:21AM (#25264867)
KISS Linux[1] is a similar option. Busybox-based init and coreutils (with musl by default), although all shell scripts are POSIX compliant so you can plug in pretty much whatever you want (sbase/ubase, GNU's coreutils, etc).

[1] https://k1ss.org

Re:Busybox-based Linux distro from scratch by 1vuio0pswjnm7 on Tuesday December 01, 2020 @03:40AM (#25263551)
I would think 16MB is quite big considering how small Linux will let you go. I used to make 17MB images with NetBSD without any effort toward reducing size.
Re:Busybox-based Linux distro from scratch by megous on Tuesday December 01, 2020 @03:52AM (#25263624)
Useful compressed x86_64 kernel (trimmed down config to contain only the modules that are normally loaded on my system - only built-in) is about 11MiB.

On one of my less-featured ARM boards zImage can get down to < 6MiB.

Re:Busybox-based Linux distro from scratch by varjag on Tuesday December 01, 2020 @05:43AM (#25264112)
We've had 2.6 and 3.x series ARM32 images under 2Mb on our older products. 4.x is around 6Mb indeed, but these are also on hw with more peripherals.
Re:Busybox-based Linux distro from scratch by pimlottc on Tuesday December 01, 2020 @02:59PM (#25269175)
Dang, I remember making kernels that fit in a 1.44mb floppy disk using the Linux Router Project, those were the days!

https://en.m.wikipedia.org/wiki/Linux_Router_Project

Re:Busybox-based Linux distro from scratch by ogre_codes on Tuesday December 01, 2020 @12:23PM (#25267301)
I'm not sure I'd ever want to build a setup with Busybox unless I was making a utility disk, but this was a fun read.

This brings back memories of when Linux was far more experimental. LILO was the new hotness in booting Linux (the much friendlier GRUB came later).

Also, (much) later, when Gentoo came along and you had to basically bootstrap your whole system...

Re:Busybox-based Linux distro from scratch by nisa on Tuesday December 01, 2020 @04:47AM (#25263851)
or just use openwrt.org - there is x86/x64 and uefi support and it should only need 4-5mbyte with squashfs root :)
Re:Busybox-based Linux distro from scratch by stillbourne on Tuesday December 01, 2020 @11:30AM (#25266642)
Back in the early days of openwrt that's basically what it was, if you went #freenode and asked questions about why your toolchain wouldn't cross compile correctly sometimes Erik Andersen would show up and ask about your env, distro, setup, etc.
Re:Busybox-based Linux distro from scratch by rustybolt on Tuesday December 01, 2020 @06:14AM (#25264255)
What is the difference with minimal linux live [1]?

[1] https://minimal.idzona.com/

Re:Busybox-based Linux distro from scratch by megous on Tuesday December 01, 2020 @03:54AM (#25263629)
This is somewhat like initramfs image on Arch Linux.
Re:Busybox-based Linux distro from scratch by freemint on Tuesday December 01, 2020 @05:50AM (#25264138)
If you are interested in that kind of work, i recommend you to look into the work of Rob Landley.
Re:Busybox-based Linux distro from scratch by Subsentient on Tuesday December 01, 2020 @04:08AM (#25263704)
Noobs. In 2014 I built a full blown XFCE desktop distro from tarballs and used it for 3 years.