2025-12-30 17:28:02 +09:00
2025-12-30 17:28:02 +09:00
2025-12-30 01:20:20 +00:00
2025-12-30 01:20:20 +00:00
2025-12-30 01:20:20 +00:00
2025-12-30 08:19:49 +00:00
2025-12-30 01:20:20 +00:00
2025-12-30 01:20:20 +00:00
2025-12-30 01:20:20 +00:00
2025-12-30 01:20:20 +00:00
2025-12-30 01:20:20 +00:00

Build Linux from Scratch

Prerequisites

sudo apt install qemu-system-x86 grub-pc-bin e2fsprogs

Run

gcc -static -o init/init init/init.c

dd if=/dev/zero of=disk.img bs=1M count=512 status=none
echo -e "n\np\n1\n2048\n\nw" | fdisk disk.img > /dev/null

dd if=disk.img of=part.img bs=512 skip=2048 status=none

mkfs.ext4 part.img
debugfs -w -R "mkdir /boot" part.img
debugfs -w -R "mkdir /boot/grub" part.img

debugfs -w -R "write init/init /init" part.img
debugfs -w -R "write linux/arch/x86/boot/bzImage /boot/bzImage" part.img
debugfs -w -R "write grub/grub.cfg /boot/grub/grub.cfg" part.img

dd if=part.img of=disk.img bs=512 seek=2048 conv=notrunc status=none

Or, alternatively

make

make run

ifconfig eth0 10.0.2.15
route add default gw 10.0.2.2

medit req.txt
GET / HTTP/1.0
Host: 1.1.1.1

:w
:q

nc 1.1.1.1 80 < req.txt
S
Description
No description provided
Readme
105 KiB
Languages
C 70.2%
Assembly 18.5%
Makefile 10.6%
Shell 0.6%
C++ 0.1%