GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Apr 23, 2014 2:27 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Running a GTK+ Program without Operating System
PostPosted: Sat Jan 05, 2013 12:19 am 
Offline

Joined: Tue Oct 30, 2012 2:25 am
Posts: 4
I wasn't sure how exactly to phrase the subject, but I think when I explain what I am trying to do and why it will be more clear.

I program machinery at work, and most of the "controllers" on the market are extremely expensive and lack processing power. The machine that I have been working on requires a lot of thinking and the first version overloaded the controller I used. I've found that I can do the processing on a computer and use a PCI card for the control. I use GTK+ to create the user interface. I've set up this system with one Windows 7 computer on one machine.

For several reasons I would like to run this machine with Linux instead of Windows. One of the reasons is that windows 7 licenses are no longer being produced, and Windows 8 is being pushed. Additionally if I used Linux, I would not have to worry about licenses because I could copy the hard drive from one machine to the next instead of having to install a separate copy of windows and all the software on each machine.

Anyway the key point to highlight is that the computers that run the machines have the sole purpose of running a single program with a GTK+ interface. What I would like to do is: when the computer starts it goes through the normal loading sequence, but when it gets to the point that the login screen would appear, instead my program starts, and that's all the user sees. This way the overhead will be greatly reduced, the machine will start faster, and the user will not need to understand anything about Linux to use it.


I have been doing research on how linux starts up, and it seems the basic sequence is GRUB -> bootloader -> everything in /etc/init.d. I have tried sifting through /etc/init.d to see what I need and what I don't, but its quite overwhelming. Also it seems like there isn't a clear order for the running of scripts. I can't find what leads to the login screen, and where the user interface is loaded.

I still need many pieces of Linux to start especially the Kernel and the scheduler. The program needs to run file operations as well as access an ftp server so it should still start networking services. I guess I'm looking for a point where I can stop the normal boot sequence and start my program.

I'm running Ubuntu 12.04 x64 with GNOME, and this will be the computer I will test this idea on.

Any advice you can give on this would be great especially if anyone has done something similar. I guess this is somewhat like running a server, however there is still going to be an interface.


Top
 Profile  
 
 Post subject: Re: Running a GTK+ Program without Operating System
PostPosted: Mon Jan 07, 2013 10:10 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 709
Location: UK
Hello,

If you are using the current Gnome desktop environment you have set your system to login to a set user account and also start up an application. I have done this in the past to automatically run video projections for a theatre show.

Under the Gnome 3 desktop select System Settings then User Accounts. From there you can select which user account you want to use for automatic login.

Under Systems Tools then Startup Applications you can then add your application to be started when you login.

You may need to install some of these applications to set-up auto loading. Once this is done all should be easy and with out you needing to mess around with scripts

_________________
E.


Top
 Profile  
 
 Post subject: Re: Running a GTK+ Program without Operating System
PostPosted: Wed Jan 09, 2013 12:20 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
You've got all the answer you need out of Errol,
I'd back up what he is saying. As GTK and your application is going to use a large amount of what is loaded by default I wouldn't stop the boot sequence but instead just disable whatever functionality you don't need. You can do this in Ubuntu, but if you have the time you might want to investigate setting up an OS that is more designed for customisation, e.g. Gentoo or Arch.

I've done a fair bit of instrumentation work; though probably not as much as yourself. Yes, it was a hatred for LabVIEW licencing practices that drove me to GTK and other things free & open source. I might be able to add a few pointers. Maybe some things will be new to you and useful.

* One of the good things about GTK is it is cross-platform in terms of software and hardware. If you write an application, there is a good chance that it will work on Windows, Linux or BSD as well as different architectures, e.g. x86, ARM or SPARC. If you are working in instrumentation this is very useful as you can readily transfer an app you have developed on your desktop to a microcontroller with a reduced instruction set. I recently bought a raspberry pi (a rather impressive $30 ARM microcomputer) and was able to port my software over to it seamlessly. I'd recommend it for tinkering around with (looks a lot cooler and more serious than using a laptop in a prototype system for showcasing your work).

* There is a project 'comedi' looking at providing drivers for a lot of commercial DAQ cards etc. If they don't have the driver you're after, get in contact with them. They might be able to help and your experiences would provide valuable feedback for the project. Comedi requires itself to be compiled into the kernel so it might be something to think of earlier rather than later. (though if you go down the gentoo path recompiling the kernel is an everyday task; bit more daunting as an Ubuntu user).

* Gtk builds upon glib to provide cross-platform support. Try to exploit the glib function calls as much as possible as every included header you can eliminate will make your application more portable, stable and future-proof. (e.g. stdio.h, stdlib.h and string.h are all unnecessary when using glib)


Top
 Profile  
 
 Post subject: Re: Running a GTK+ Program without Operating System
PostPosted: Sat Jan 12, 2013 7:26 pm 
Offline

Joined: Tue Oct 30, 2012 2:25 am
Posts: 4
Thanks for the response. I've tried to digest all you've said.

errol wrote:
Hello,

If you are using the current Gnome desktop environment you have set your system to login to a set user account and also start up an application. I have done this in the past to automatically run video projections for a theatre show.

Under the Gnome 3 desktop select System Settings then User Accounts. From there you can select which user account you want to use for automatic login.

Under Systems Tools then Startup Applications you can then add your application to be started when you login.

You may need to install some of these applications to set-up auto loading. Once this is done all should be easy and with out you needing to mess around with scripts


The first part worked great and I can login without the login screen, however I have seen many forums reference the Startup Applications, but I just can't find it. I believe it has to do with updating. I originally started with Ubuntu 10.04 using unity and now have 12.04 using Gnome, and I've heard that buntu just does not update well and becomes unstable after numerous upgrades.
Anyway after more research I found that Ubuntu isn't the right distribution for what I'm doing anyway. I need a real time operating system.


Paul Childs wrote:
You've got all the answer you need out of Errol,
I'd back up what he is saying. As GTK and your application is going to use a large amount of what is loaded by default I wouldn't stop the boot sequence but instead just disable whatever functionality you don't need. You can do this in Ubuntu, but if you have the time you might want to investigate setting up an OS that is more designed for customisation, e.g. Gentoo or Arch.

I looked at Gentoo and Arch and they have their merits, but I realized I need a real time operating system. My boss is willing to pay for Red Hat which I think will save time over using a free distribution. Also the drivers I need were tested in Red Hat which takes out some guess work.

Paul Childs wrote:
I've done a fair bit of instrumentation work; though probably not as much as yourself. Yes, it was a hatred for LabVIEW licencing practices that drove me to GTK and other things free & open source. I might be able to add a few pointers. Maybe some things will be new to you and useful.

I hate Labview as well, and not just the licensing. I don't like the design and the overhead is ridiculous. It uses c format strings so I started calling it C--

Paul Childs wrote:
* One of the good things about GTK is it is cross-platform in terms of software and hardware. If you write an application, there is a good chance that it will work on Windows, Linux or BSD as well as different architectures, e.g. x86, ARM or SPARC. If you are working in instrumentation this is very useful as you can readily transfer an app you have developed on your desktop to a microcontroller with a reduced instruction set. I recently bought a raspberry pi (a rather impressive $30 ARM microcomputer) and was able to port my software over to it seamlessly. I'd recommend it for tinkering around with (looks a lot cooler and more serious than using a laptop in a prototype system for showcasing your work).

This sounds incredible, and quite unbelievable actually. Could you maybe expand on this? Did this microcomputer use GTK+ to produce a user interface or for calculation with glib? I realized that the GTK+ portion of my code can be ported as is, which is the reason I've focused on learning GTK+ instead of Win Api or some other api in the first place. Most of the C calls are the same, but the threading is a little different, and I'll be fighting the drivers for awhile.

Paul Childs wrote:
* There is a project 'comedi' looking at providing drivers for a lot of commercial DAQ cards etc. If they don't have the driver you're after, get in contact with them. They might be able to help and your experiences would provide valuable feedback for the project. Comedi requires itself to be compiled into the kernel so it might be something to think of earlier rather than later. (though if you go down the gentoo path recompiling the kernel is an everyday task; bit more daunting as an Ubuntu user).

I looked at their website, but could not find the card I'm using. I'll try contacting them though.

Paul Childs wrote:
* Gtk builds upon glib to provide cross-platform support. Try to exploit the glib function calls as much as possible as every included header you can eliminate will make your application more portable, stable and future-proof. (e.g. stdio.h, stdlib.h and string.h are all unnecessary when using glib)

I've seen many references to these functions in the tutorials, but always used the functions in the standard c library. I had assumed that anywhere I would use GTK+, I would be using a compiler with the standard C library. Could you maybe give an example of an instance that you could use glib but now the standard C library?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot], Google Adsense [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group