r/linux 2d ago

Development Developed Boot Animation focused minimal initramfs , with Rescue Mode

Post image

Created my own initramfs tools and modloader, modstripper , pci-scanner and boot-animation software and stage 1 init system that invokes the other, where my own made tools mounted the kernel devices as tmpfs, devtmpfs, sysfs and proc with, custom modloader and cpio script, the modgenerator strips down all the unnecessary modules and blacklisted modules and selects the required modules based on the pci configuration

But I switched this to loading and stripping only using , pre-mentioned modules , it resolves the graph dependency and exports serialized module graph in order to load it in order, implemented a rescue method if any step fails

It first loads the gpu modules (in my case amdgpu radeon 740M) then starts my DRM/KMS userspace boot-animation software as bootsplash , then the nvme drive is searched using the uuid of mentioned in /etc/mountpoiny it contains the filetype too

Then finally it clears everything by deleting and then finally switch root into the systemd , finally the systemd taking over and my boot-stop service tells the bootsplash to stop by sending SIGINT to all the PIDs belonging to PGID of boot-splash,

I haven't yet implemented graphical login manager but will do so soon

I've re-implemented lot of tools and it's still unstable

Also wrote the GIF decoder to extract the frames

Initramfs size (21 MB ,(13 MB assets))

Compressed size 17 MB

59 Upvotes

18 comments sorted by

13

u/budroid 2d ago

very cool project.

Good to know there are people out there still tinkering with Linux and creating their own tools.

best of luck in making ready and stable

8

u/MarcBeard 2d ago

You know plymouth has an early initramfs hook

8

u/SBG47 2d ago

I tried to make things faster and slim , my primary focus was to make DRM available as soon as possible so no DRM master will be dropped when the gpu transitions from VGA to DRM , it causes pause in animation rendering so why not make it available as soon as possible? Other thing is module porting , as I don't need all the modules inside the initramfs to make the actual process slower

1

u/BibianaAudris 2d ago

Depending on the BIOS, most likely you don't need the DRM driver before boot animation. efifb gives you a framebuffer whose content is usually preserved by modern DRM drivers.

Also, you didn't post a project link?

1

u/SBG47 2d ago

I'll post the project when I am finished with writing the instructions on how to install all the stuff, now answering your question, GPU drivers will drop the DRM master once when loaded which will cause flickering and I didn't want that, I wanted a smooth transition

1

u/ilep 1d ago

That drawing is incredibly cute!

1

u/IngwiePhoenix 1d ago

...Paimon? For real? xD

Now I want a spinning Kokomi or something for the boot animation... I see enough of Paimon in the game already, would love something else...well, elsewhere. o.o

But this is pretty neat! Have only looked at Plymouth, never really took a look at other alternative boot splash things. o.o

2

u/SBG47 1d ago

Not kokomi but I think it would satisfy you https://youtu.be/NIneRpzsgwI?si=n7YH5E8GYDfdpTN1

-5

u/is_this_temporary 2d ago

"You" created, or Claude Code created?

6

u/SBG47 2d ago

Also this one https://youtu.be/MTfNyyaAaEA?si=mm3koWNg7zyWaGwG

It's sad I didn't log all the development period but be late then never i guess 🤷

4

u/SBG47 2d ago

It's me actually, I don't follow up other's code, So I build my own design, architecture and code , so I know what exactly I am doing, that's why "I" am quite proud of "My Work"

5

u/SBG47 2d ago

Actually I logged my few recent development videos that you can watch and , I am happy to share this one https://youtu.be/PiBe5nURr_c?si=UhAGBq8nRNUB7gjV

-1

u/SmackDownFacility 2d ago

How the fuck did you do that? You need to access ACPI tables and that happens over way below your stack. BGDR or something similar you need to fucking modify. It’s a .BMP file have you ensured you unswizzled the image properly

I am fucking baffled by how you managed to pull that off. ACPI is very strict.

3

u/SBG47 2d ago

ACPI modules aren't  loaded by my initramfs, my init is pid 1 , ACPI is used to control the hardware, clock speeds , fan controls and battery or brightness , (brightness is particularly part of amdgpu but who cares?) my initramfs contains all the necessary files The init system reads the GIF file and decompresses a frame at a time (using my LZW decoder) then, it just simply renders it using DRM/KMS dumb buffers , the part that was tricky was to create multiple GPU instances so I just scanned the dri/card* and launched each instance through my init, since this is executed using my init (fork + execv) systemd won't kill my process as it is now spawned by systemd so I need to reap the children after the boot is finished Terminating using binary name is nasty approach so what I did was to collect them in one PGID using setpgid where first child becomes leader of each process and my each animation instance has this feature of when they recieve SIGINT they stop Since I just cannot IO my initramfs as it will be deleted later by my own init, so I mapped the gif inside memory and then continued with the init Once this is done the rootfs is identified by iterating /sys/dev/block and following the symlink then opening the device reading the superblock of the partition table (if it exists) by matching EXT* magic then it will match the pre-configured host machine's rootfs uuid which was exported inside initramfs (during build phase of initramfs inside /etc/mountpoint) it will mount the rootfs as MS_RDONLY and once it's mounted every file in initramfs will be deleted in order to claim the memory ( my init moves all mount point inside the rootfs mount point (i.e. /mnt)) so then it just chroot into mnt and execs the actual sbin/init which will continue the process until the stop-boot-animation.service is reached that broadcasts SIGINT to the PGID my init stored inside /dev/anim_pgid , and that's a clean thing

-4

u/SmackDownFacility 2d ago

Yeah. You really need to cryptographically sign your driver. You’re digging way too deep into the graphical stack.

Idk which company controls driver signing on Linux, but you really need to sort a certificate out because users won’t take your driver that gets way low level without a signature.

6

u/tyami94 2d ago

there isn't driver signing on linux like there is on windows. trust is based on distro package signing.

also you don't need to touch ACPI to do this on linux. you can draw anything you want to the framebuffer as soon as your kernel is loaded. even if you haven't loaded a real graphics driver/firmware yet, since 5.14(?) you can draw straight to the UEFI framebuffer with SimpleDRM/GOP.

4

u/SBG47 2d ago

there might be misunderstanding in my explaination but I am not writing any ACPI driver or a GPU driver, I am using user-space DRM ioctl calls in order to render the buffer onto my screen there is no Underlying direct interaction to trusted-zone or kernel process, it's just simple DRM access , that's what wayland and x-server natively do. I don't need any cryptographic signature for using ACPI as I am not directly interacting with it. I am just loading the minimal kernel modules in order to access the DRM subsystems. My original motivation was to get the Sound Subsystem Working but I dropped it for a while may carry-on with it in future but here is the documentation for DRM/KMS from kernel.org
https://docs.kernel.org/gpu/drm-kms.html

-4

u/SmackDownFacility 2d ago

Even if it’s a UMD, you really need a certificate