Jump to content

How do I compile Linux from sources to make a command line?

AndrewCam100

Hello!

 

I am planning on making a Linux distro that uses Python for the UI and I need a Linux terminal as the base to start the Python script. How do I compile the kernel and a command-line to have a very small base to run my code? Is there a better way to do what I am thinking of doing?

 

 

Thanks in advance!

if day == Friday:

  Celebrate()

Link to comment
Share on other sites

Link to post
Share on other sites

for the linux source, look at kernel.org. though, what you are thinking about is probably a bit more complicated. Linux itself does not do much, if anything. you need a lot of extra tooling, usually provided by the GNU project (GNU/Linux). Look at this video to get an idea how linux works under the hood

Edit: If you just want to change your "command line", you can just specify python as the default shell for a user with

usermod -s /usr/bin/python user

 

Link to comment
Share on other sites

Link to post
Share on other sites

Arch or Tiny Core Linux sound like what you want. Getting a minimal distribution off the ground yourself is annoying and time consuming, but if you want to go with that Linux from Scratch is what you want.

The Eight Fallacies of Distributed Computing

Essentially everyone, when they first build a distributed application, makes the following eight assumptions. All prove to be false in the long run and all cause big trouble and painful learning experiences.

  1. The network is reliable
  2. Latency is zero
  3. Bandwidth is infinite
  4. The network is secure
  5. Topology doesn’t change
  6. There is one administrator
  7. Transport cost is zero
  8. The network is homogeneous

        — Peter Deutsch

Link to comment
Share on other sites

Link to post
Share on other sites

That's not how this works. If you want to make a python based desktop start from a CLI distro like Arch or even just Ubuntu Server and go from there.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, AndrewCam100 said:

I am planning on making a Linux distro that uses Python for the UI and I need a Linux terminal as the base to start the Python script. How do I compile the kernel and a command-line to have a very small base to run my code? Is there a better way to do what I am thinking of doing?

Python requires a whole bunch of extra libraries to work, starting all the way from a libc-implementation. You can't just run Python without any of the underlying stuff. Just try and compile a minimal Linux-kernel, then compile Musl or uClibc to get the basic POSIX-compliant libc-library, then implement all the other POSIX-stuff Python relies on.... Yeah, no, not something a complete novice will be able to do.

 

@Dat Guy has the right idea: go with a minimal Linux-distro instead. Gentoo is definitely a good choice and another option would be Linux From Scratch.

 

That said, it sounds to me like you have zero idea of what you're even getting into. When you say "UI", do you actually mean a UI, or do you mean a desktop-environment? Two different concepts entirely. Also, you're not specifying if it'll be a text-based one or actual pixel-graphics -- if the latter, you're opening up yet another enormous box of complications, including setting up a graphical mode, drivers, input-devices and all that! Or will you be using Wayland or Xorg or something that takes care of most of that lower-level work? Well, there's still a ton of stuff you should learn and, personally, I'd say you're starting from the wrong end of the tree -- learning how to make Freedesktop-compliant Linux GUI-apps and how to use git/svn/similar versioning system should be your starting-point.

Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to comment
Share on other sites

Link to post
Share on other sites

Thank you for the help! I will probably start with Ubuntu Server, as I am too lazy to deal with compiling Linux.

if day == Friday:

  Celebrate()

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×