Build Linux distros in pure Python โ compiled to C, packaged as ISO
Project description
pylinux ๐ง
Build Linux distros in pure Python โ compiled to C, linked into an ELF kernel, packaged as a bootable ISO.
pip install pylinux-sdk
pylux new my-distro
cd my-distro
pyinlux build
pylux run
How it works
your Python source
โ
โผ (pylux.compiler โ AST โ C99)
C source files
โ
โผ (gcc cross-compiler)
.o object files
โ
โผ (ld + linker script)
kernel.elf (multiboot2, bare-metal)
โ
โผ (grub-mkrescue + xorriso)
your-distro.iso โ bootable!
โ
โผ (qemu-system-x86_64)
๐ฅ๏ธ running in VM
Commands
| Command | Description |
|---|---|
pylux new <n> |
Init project in <name>/ |
pylux build |
Full build: Python โ C โ ELF โ ISO |
pylux run |
Boot ISO in QEMU |
pylux debug |
QEMU + GDB stub on :1234 |
pylux compile |
Python โ C only |
pylux check |
Syntax-check all sources |
pylux clean |
Remove build artifacts |
pylux clean --all |
Remove artifacts + cache |
pylux add <mod> |
Scaffold a new module/driver |
pylux info |
Toolchain & project info |
pylux config show |
Dump pylux.toml |
pylux config set vm.memory_mb 1024 |
Edit a config value |
pylux log |
Tail latest build log |
pylux disasm |
objdump the kernel ELF |
pylux shell |
Cross-compile env shell |
pylux directives
Inside your .py files, special comments control the compiler:
# pylux: multiboot2 โ emit multiboot2 header in this file
# pylux: arch=x86_64 โ override target arch
# pylux: stack_size=131072 โ set kernel stack size
# pylux: c_inline โ entire file: function bodies become C stubs
# pylux: no_stack_protector โ compile with -fno-stack-protector
# pylux: io_access โ allow I/O port intrinsics
# pylux: module_type=driver โ metadata tag
# inside a function body:
# pylux: asm("movq $0, %rax")
# pylux: c_inline("*(volatile uint32_t*)0xB8000 = 0x0F48;")
# pylux: register_irq(1, my_handler)
Prerequisites
# Ubuntu / Debian
sudo apt install gcc nasm binutils grub-pc-bin xorriso qemu-system-x86
# Fedora / RHEL
sudo dnf install gcc nasm binutils grub2-tools xorriso qemu-system-x86
# Arch
sudo pacman -S gcc nasm binutils grub libisoburn qemu-system-x86
Project layout (after pylux new)
my-distro/
โโโ pylux.toml โ project config
โโโ src/
โ โโโ kernel.py โ kernel entry: kernel_main()
โ โโโ boot.py โ GDT / IDT / paging setup
โ โโโ drivers/
โ โ โโโ vga.py โ VGA text-mode driver
โ โ โโโ keyboard.py โ PS/2 keyboard
โ โ โโโ timer.py โ PIT 8254 timer
โ โโโ kstd/
โ โโโ string.py โ strlen, strcpy, itoa โฆ
โ โโโ memory.py โ kmalloc / kfree
โ โโโ io.py โ io_inb / io_outb
โโโ .pylux/
โโโ build/ โ generated C, .o files, kernel.elf, ISO
โโโ cache/
โโโ logs/
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pylinux_sdk-0.1.0.tar.gz
(3.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pylinux_sdk-0.1.0.tar.gz.
File metadata
- Download URL: pylinux_sdk-0.1.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c242c5719a515d9a07f6d817791cea75522c15c9983073749d291d5cdf21c8c
|
|
| MD5 |
8c324e13978bc9297c5d4aca44fb837d
|
|
| BLAKE2b-256 |
8bb7b2655a2d22e9478b960aad58f29e78e72169baad4b23f67c348ffc01b3dd
|
File details
Details for the file pylinux_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pylinux_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3bb1f82e2b783c351b9d99b7970e3eeec15cf4f238eaeb3d2f067ceb11f8663
|
|
| MD5 |
d1f10f10b6558878ced794164a06e05e
|
|
| BLAKE2b-256 |
8cee61eecb7343aecfddd6612c4f13e58cb3556f52764086b37026d7ce757e3e
|