vheidari / miniBox

miniBox = Linux Kernel with BusyBox taste. An experimental project :)
MIT License
1 stars 0 forks source link

Is there any way to boot baremetal? #1

Open xplshn opened 4 months ago

xplshn commented 4 months ago

Is there any way to boot this baremetal? If so, what is the procedure? (i haven't tried nothing yet. If this can run my binary manager(https://github.com/xplshn/bigdl) I am thinking of using a very bare OS with only a Linux kernel and SBASE + UBASE.).

vheidari commented 4 months ago

Hey @xplshn, yes it is possible,

but it needs a bit of work to support bare metal and boot on a physical device. To boot it on a bare metal system, we need a boot loader like GRUB or Syslinux that helps the machine hardware load our Linux kernel. We should also create an ISO image from it.

Actually, it is still far from being a real distro :) .

There are many things that we should add to it to work perfectly. For example, there isn't any network configuration for miniBox, so it cannot connect to the internet.

Regarding your question about bigdl (https://github.com/xplshn/bigdl) as a binary manager that miniBox could run, the answer is yes, miniBox could run it.

However, you should compile bigdl as a statically linked binary. When you compile it as a static binary, bigdl can run standalone without any dependency on dynamic libraries, allowing miniBox to run it without any problems.

To check bigdl on miniBox, I tried to test it on miniBox.

To add your software or binary manager like bigdl to miniBox, you can follow these steps:

  1. Cloneing miniBox : git clone https://github.com/vheidari/miniBox.git

  2. Change the directory to the Source directory.

  3. Clone your project to this directory using the command: git clone https://github.com/xplshn/bigdl.git.

  4. Change the directory to bigdl and add two bash script files: Build.sh and Clean.sh.

  5. Add the following script to Build.sh:

#!/bin/sh

# Build Project 
go build -tags netgo,osusergo 

chmod +x ./bigdl

mv ./bigdl ./bigdl.mbx 
  1. At the end, add the following script to Clean.sh:
/bin/sh  

# Clean project
rm ./bigdl.mbx

Note: Your binary should have the .mbx extension to allow miniBox to install it under /bin.

  1. Once you have created Build.sh and Clean.sh, you can go back to the root directory (./miniBox).

  2. Then Run ./miniBox.sh.

The miniBox script should compile your project and install it under /bin inside miniBox ;).

miniBox

xplshn commented 4 months ago

Great, thanks for answering! I understand that. I really only want the barest of systems, reason why I created bigdl which is kinda like a package manager but without the hassle, everything related to it is statically compiled. I should have no problems if I run miniBox inside of a Github Action, right? Another question, is Musl employed?

xplshn commented 4 months ago

And another question too, can I re-use the Alpine Linux kernel for this? Avoiding the Linux-kernel source copy and build would be great, since I will be using this in a +17~ years old machine

vheidari commented 4 months ago

Great, thanks for answering! I understand that. I really only want the barest of systems, reason why I created bigdl which is kinda like a package manager but without the hassle, everything related to it is statically compiled. I should have no problems if I run miniBox inside of a Github Action, right? Another question, is Musl employed?

bigdl is a good idea. I like the idea behind it ;).

But according to your question, if GitHub Actions can run a bash script, then it can definitely run miniBox.sh without any problems.

However, to compile the Linux Kernel and Busybox source code, you need to define and install some necessary dependencies that miniBox.sh uses, such as tar, wget, the gcc/g++ toolchain, qemu, etc., before GitHub Actions starts running miniBox.sh.

I haven't tried GitHub Actions myself, but I will soon add some bash scripts to miniBox to support GitHub Actions.

As for Musl, I'm not sure. I might test it, but for now, it's not natively supported in miniBox.

And another question too, can I re-use the Alpine Linux kernel for this? Avoiding the Linux-kernel source copy and build would be great, since I will be using this in a +17~ years old machine

And finally, you asked about Alpine Linux :). Personally, I haven't worked with it, but let me check it out to see how they configure their kernel.

xplshn commented 4 months ago

Okay, thanks! If you add GH actions that'd be great, because with musl-gcc you can make builds be reproducible, and thus provide releases upon commits too