Linux.com

Distro question (experts, please read)

Link to this post 25 Jun 11

How exactly could I begin making a distro? Not even a distro, just the most basic form on Linux, with a simple gui with only six buttons (for a touchscreen control panel). I want each of the buttons to run a program in C++. How would I do this? Where would I start? I've got great knowledge of linux/unix commands, and reasonable C++ knowledge.

Link to this post 25 Jun 11

If you want to stick to C++, then Qt is a good choice. The libraries have predefined widgets for almost everything, and defining your own widgets is also quite easy. The GUI itself can either be designed graphically (using Qt Designer), or manually (by instantiating and initializing the widgets yourself). When the GUI has been defined, you simply use the "connect" macro to map events (signals) to your own methods (slots). If you're interested, they have extensive tutorials and examples here to get you started.

Here's an example of defining your own widget in Qt, I wrote it when going through their tutorial:

class LCDRange : public QWidget
{
public:
LCDRange(QWidget *parent = NULL);
};

LCDRange :: LCDRange(QWidget *parent) : QWidget(parent)
{
// Instantiate widgets
QLCDNumber *lcd = new QLCDNumber(2);
QSlider *slider = new QSlider(Qt::Horizontal);
QVBoxLayout *layout = new QVBoxLayout;

// Initialize widgets
lcd -> setSegmentStyle(QLCDNumber::Filled);
slider -> setRange(0,99);
slider -> setValue(0);

// Connect signals to slots
connect(slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)));

// Configure layout
layout -> addWidget(lcd);
layout -> addWidget(slider);
setLayout(layout);
}

Other popular alternatives include wxwidgets and gtkmm. I've never used them before, so I can't speak for those libraries :)

[edit]
If you're interested in creating your own distribution, you should also take a look at the Linux From Scratch project. They provide a mature handbook that'll hold your hand through the entire process ;)

Link to this post 29 Jun 11

You're not trying to build a Linux Distro, you only need to get Linux+XWindow and your own application.
You're looking for a basic kernel, XWindow and a light window manager (TWM for example); then you need to use your own program and a good graphic library to complete your project. QT or GTK+ are common choices and they're not so difficult to find in every distro around.
I did something similar to your project few months ago with Slax and without KDE, I was using TWM but fluxbox or blackbox or metacity are good as well.
Instead of starting your own distro from scratch it could be a better idea to get autodetect features as well as hw recognition and kernel patches from a widespread distro and cut extra pieces (Window manager)

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board