I have a vision. A vision that puts you in control of your in car computing experience.
There are many superb appliances and embedded devices available for your in-car enjoyment, such as the sat navs, the dvd players, the built in games consoles. But they all share one thing in common, they are closed to you. You don't have the freedoms defined by Stallman because they are designed, intentionally or otherwise, to be hard for you to modify as you wish.
I feel deep in my heart that there is enormous potential for in-car computing. There are more possibilities than any individual or company can imagine or provide on their own. I'm sure my imagination is not big enough to list them here, so I leave the ideas for you to contemplate.
Add to this, the evidence and my experience that open source when done right produces the better engineered solution at a lower cost, and you have a compelling argument for such a system.
I have seen the freedom that open source and the GPL provide on the desktop computer, and I believe that this culture of openness and freedom for the users can be applied to the in-car computing market to the benefit of all.
My mission is to provide a basis for this innovation, and cultivate a thriving ecosystem in the way that only open systems can. And so, my vision is a range of affordable flexible and most importantly open computing devices for your car.
And so, I introduce to you in the above photo, the mark one of my in-car pc. It has no name, and the software and hardware needs some work to say the least, but in the tradition of openness on the internet, I will present here my ups and downs, successes and failures, genius and downright stupidity for your entertainment.
I have minimal spare time and numerous other projects, but there is no rush, as I think this plan will stand the test of time, and all the while hardware gets cheaper, smaller, faster and less power hungry. As I progress in fits and starts I will post photos to flickr under the tag carpc (first set) and progress updates to this blog under tag carpc.
All feedback welcome. I will announce new articles on my twitter feed, twitter.com/tim_abell, and can be contacted using the links at the bottom of my blog.
Showing posts with label project. Show all posts
Showing posts with label project. Show all posts
06 June 2008
27 October 2007
OSS Contribution Number One!
I've had my first ever patch to an open source project accepted! Yay! (Fanfare please... no? anyone? oh well.)
Ok it's a one word change to a piece of documentation, but hey it's still something.
The project is gnucash. For details take a look at the bug report I created to hold the patch. I even got a thanks :-).
Ok it's a one word change to a piece of documentation, but hey it's still something.
The project is gnucash. For details take a look at the bug report I created to hold the patch. I even got a thanks :-).
10 April 2007
running partimage in batch mode
A continuation of the partimage project.
As it would appear that stdout support doesn't work due the user interface making use of stdout, I have been figuring out how to make the program run in batch mode, with a little help from KDevelop.
My continued findings:
The help presents a fully batch mode, -B
It is not immediately obvious what "X is a challenge response string" means.
I was able to get the program to run to a limited extend after a bit of searching the internet and trial and error with the option "-B x=y".
Having stepped through the program, it transpires that where I have put "x", the program expects a pattern to match with the title and content of any messages that would otherwise have been shown to the user, and "y" is the pre-programmed response. This is in the "interface_none" section.
"x" has to match the question in the form "message title/message content" and is compared using fnmatch which allows * as a wildcard (anyone got a good reference for fnmatch?).
If the program hits a question for the user, and cannot find a matching answer in the command arguments, "CInterfaceNone::invalid_programmed_response()" fires "exit(8)" and the program dies.
So far I have been running the program as a normal user, which will inevitably fail where it attempts to work with block devices / root owned files & folders. This produces a warning in the user interface, followed by program termination.
To bypass this first "not root" warning, I successfully used this pre-programmed answer:
./partimage -B Warning*=Continue
Alternatively the following is more specific and also works:
./partimage -B Warning*root*=continue
I haven't figured out how to pass more than one predefined answer in batch mode.
The run arguments can be set in KDevelop here:
project > options > debugger > program arguments
Side note:
The program has a base class of user interface defined, and then either instantiates interface_none or interface_newt depending on command line arguments.
If not using full batch mode it helps to set "enable separate terminal for application IO" in KDevelop (project > options > debugger) so that you can see the full user interface. However if the program exits then the console closes and any output is lost.
As part of stepping through the code, I came across a macro, which makes the program harder to follow while debugging due to not being able to step through. So I figured out what it did, and wrote out its output C++ code in full:
interface_none.cpp, line 103
my expanded version:
creating a ramdisk for testing.
http://www.vanemery.com/Linux/Ramdisk/ramdisk.html
(I am on ubuntu 6.10 here, details may vary)
create and mount test ramdisk
add a test file and unmount the disk
the above, as a script:
Create & run script (as root, because it (un)mounts a file system, and creates a dir in a root owned folder):
Wierdly, partimage won't run in full batch mode without a second part to the -B switch, even if it's set up to not need to ask any questions. Supplying a dummy "x=y" seems sufficient to fool it.
Runing as root without asking for partition description works:
Restore image to a different ramdisk and check file:
Success!
Script for checking file in saved partition:
To debug in KDevelop as root (in ubuntu):
alt-F2 (run)
gksudo kdevelop
open project... (go find existing copy)
So in summary, I have made progress in understanding the ways of this useful utility, and am a step closer to making a useful contribution to the project.
The rambling nature of this post reflects the way in which one begins to understand a new program. Hopefully it's not too hard to follow, or pick out the useful pieces. All feedback gratefully appreciated.
Tim.
As it would appear that stdout support doesn't work due the user interface making use of stdout, I have been figuring out how to make the program run in batch mode, with a little help from KDevelop.
My continued findings:
The help presents a fully batch mode, -B
$ ./partimage --help
===============================================================================
Partition Image (http://www.partimage.org/) version 0.6.5_beta4 [stable]
---- distributed under the GPL 2 license (GNU General Public License) ----
Supported file systems:....Ext2/3, Reiser3, FAT16/32, HPFS, JFS, XFS,
UFS(beta), HFS(beta), NTFS(experimental)
usage: partimage [options] <action> <device> <image_file>
partimage <imginfo/restmbr> <image_file>
ex: partimage -z1 -o -d save /dev/hda12 /mnt/backup/redhat-6.2.partimg.gz
ex: partimage restore /dev/hda13 /mnt/backup/suse-6.4.partimg
ex: partimage restmbr /mnt/backup/debian-potato-2.2.partimg.bz2
ex: partimage -z1 -om save /dev/hda9 /mnt/backup/win95-osr2.partimg.gz
ex: partimage imginfo /mnt/backup/debian-potato-2.2.partimg.bz2
ex: partimage -a/dev/hda6#/mnt/partimg#vfat -V 700 save /dev/hda12 /mnt/partimg/redhat-6.2.partimg.gz
Arguments:
* <action>:
- save: save the partition datas in an image file
- restore: restore the partition from an image file
- restmbr: restore a MBR of the image file to an hard disk
- imginfo: show informations about the image file
* <device>: partition to save/restore (example: /dev/hda1)
* <image_file>: file where data will be read/written. Can be very big.
For restore, <image_file> can have the value 'stdin'. This allows
for providing image files through a pipe.
Options:
* -z, --compress (image file compression level):
-z0, --compress=0 don't compress: very fast but very big image file
-z1, --compress=1 compress using gzip: fast and small image file (default)
-z2, --compress=2 (compress using bzip2: very slow and very small image file):
* -c, --nocheck don't check the partition before saving
* -o, --overwrite overwrite the existing image file without confirmation
* -d, --nodesc don't ask any description for the image file
* -V, --volume (split image into multiple volumes files)
-VX, --volume=X create volumes with a size of X MB
* -w, --waitvol wait for a confirmation after each volume change
* -e, --erase erase empty blocks on restore with zero bytes
* -m, --allowmnt don't fail if the partition is mounted. Dangerous !
* -M, --nombr don't create a backup of the MBR (Mast Boot Record) in the image file
* -h, --help show help
* -v, --version show version
* -i, --compilinfo show compilation options used
* -f, --finish (action to do if finished successfully):
-f0, --finish=0 wait: don't make anything
-f1, --finish=1 halt (power off) the computer
-f2, --finish=2 reboot (restart the computer):
-f3, --finish=3 quit
* -b, --batch batch mode: the GUI won't wait for an user action
* -BX, --fully-batch=X batch mode without GUI, X is a challenge response string
* -y, --nosync don't synchronize the disks at the end of the operation (dangerous)
* -sX, --server=X give partimaged server's ip address
* -pX, --port=X give partimaged server's listening port
* -g, --debug=X set the debug level to X (default: 1):
* -n, --nossl disable SSL in network mode
* -S, --simulate simulation of restoration mode
* -aX, --automnt=X automatic mount with X options. Read the doc for more details
* -UX --username=X username to authenticate to server
* -PX --password=X password for authentication of user to server
===============================================================================It is not immediately obvious what "X is a challenge response string" means.
I was able to get the program to run to a limited extend after a bit of searching the internet and trial and error with the option "-B x=y".
Having stepped through the program, it transpires that where I have put "x", the program expects a pattern to match with the title and content of any messages that would otherwise have been shown to the user, and "y" is the pre-programmed response. This is in the "interface_none" section.
"x" has to match the question in the form "message title/message content" and is compared using fnmatch which allows * as a wildcard (anyone got a good reference for fnmatch?).
If the program hits a question for the user, and cannot find a matching answer in the command arguments, "CInterfaceNone::invalid_programmed_response()" fires "exit(8)" and the program dies.
So far I have been running the program as a normal user, which will inevitably fail where it attempts to work with block devices / root owned files & folders. This produces a warning in the user interface, followed by program termination.
To bypass this first "not root" warning, I successfully used this pre-programmed answer:
./partimage -B Warning*=Continue
Alternatively the following is more specific and also works:
./partimage -B Warning*root*=continue
I haven't figured out how to pass more than one predefined answer in batch mode.
The run arguments can be set in KDevelop here:
project > options > debugger > program arguments
Side note:
The program has a base class of user interface defined, and then either instantiates interface_none or interface_newt depending on command line arguments.
If not using full batch mode it helps to set "enable separate terminal for application IO" in KDevelop (project > options > debugger) so that you can see the full user interface. However if the program exits then the console closes and any output is lost.
As part of stepping through the code, I came across a macro, which makes the program harder to follow while debugging due to not being able to step through. So I figured out what it did, and wrote out its output C++ code in full:
interface_none.cpp, line 103
#define MB_2(One,Other,ONE,OTHER) \
int CInterfaceNone::msgBox##One##Other(char *title, char *text, ...) { \
char *result= lookup(title,text,"(unspecified)"); \
va_list al; \
va_start(al,text); \
message_only(#One "/" #Other, title, text, al, result); \
va_end(al); \
if (!strcasecmp(result,#One)) return MSGBOX_##ONE; \
if (!strcasecmp(result,#Other)) return MSGBOX_##OTHER; \
invalid_programmed_response(); \
return 0; \
}
MB_2(Continue,Cancel,CONTINUE,CANCEL)
MB_2(Yes,No,YES,NO)my expanded version:
//notes: have expanded out macro so I can step through it.
int CInterfaceNone::msgBoxContinueCancel(char *title, char *text, ...) {
char *result= lookup(title,text,"(unspecified)");
va_list al;
va_start(al,text);
message_only("Continue" "/" "Cancel", title, text, al, result);
va_end(al);
if (!strcasecmp(result,"Continue")) return MSGBOX_CONTINUE;
if (!strcasecmp(result,"Cancel")) return MSGBOX_CANCEL;
invalid_programmed_response();
return 0;
}
int CInterfaceNone::msgBoxYesNo(char *title, char *text, ...) {
char *result= lookup(title,text,"(unspecified)");
va_list al;
va_start(al,text);
message_only("Yes" "/" "No", title, text, al, result);
va_end(al);
if (!strcasecmp(result,"Yes")) return MSGBOX_YES;
if (!strcasecmp(result,"No")) return MSGBOX_NO;
invalid_programmed_response();
return 0;
}creating a ramdisk for testing.
http://www.vanemery.com/Linux/Ramdisk/ramdisk.html
(I am on ubuntu 6.10 here, details may vary)
$ ls -l /dev/ram*
brw-rw---- 1 root disk 1, 0 2007-04-08 20:10 /dev/ram0
brw-rw---- 1 root disk 1, 1 2007-04-08 20:10 /dev/ram1
brw-rw---- 1 root disk 1, 10 2007-04-08 20:10 /dev/ram10
brw-rw---- 1 root disk 1, 11 2007-04-08 20:10 /dev/ram11
brw-rw---- 1 root disk 1, 12 2007-04-08 20:10 /dev/ram12
brw-rw---- 1 root disk 1, 13 2007-04-08 20:10 /dev/ram13
brw-rw---- 1 root disk 1, 14 2007-04-08 20:10 /dev/ram14
brw-rw---- 1 root disk 1, 15 2007-04-08 20:10 /dev/ram15
brw-rw---- 1 root disk 1, 2 2007-04-08 20:10 /dev/ram2
brw-rw---- 1 root disk 1, 3 2007-04-08 20:10 /dev/ram3
brw-rw---- 1 root disk 1, 4 2007-04-08 20:10 /dev/ram4
brw-rw---- 1 root disk 1, 5 2007-04-08 20:10 /dev/ram5
brw-rw---- 1 root disk 1, 6 2007-04-08 20:10 /dev/ram6
brw-rw---- 1 root disk 1, 7 2007-04-08 20:10 /dev/ram7
brw-rw---- 1 root disk 1, 8 2007-04-08 20:10 /dev/ram8
brw-rw---- 1 root disk 1, 9 2007-04-08 20:10 /dev/ram9create and mount test ramdisk
# mke2fs /dev/ram0
# mkdir /media/ram0
# mount /dev/ram0 /media/ram0add a test file and unmount the disk
# echo "test data #1." >> /media/ram0/foo.txt
# umount /media/ram0the above, as a script:
#!/bin/bash
# create and mount test ramdisk
mke2fs /dev/ram0
if [ ! -d /media/ram0 ]; then
mkdir /media/ram0
fi
mount /dev/ram0 /media/ram0
#add a test file and unmount the disk
echo "test file." >> /media/ram0/foo.txt
date >> /media/ram0/foo.txt
cat /media/ram0/foo.txt
umount /media/ram0Create & run script (as root, because it (un)mounts a file system, and creates a dir in a root owned folder):
$ gedit mkram.sh
$ chmod ug+x mkram.sh
$ sudo ./mkram.shWierdly, partimage won't run in full batch mode without a second part to the -B switch, even if it's set up to not need to ask any questions. Supplying a dummy "x=y" seems sufficient to fool it.
Runing as root without asking for partition description works:
$ sudo ./partimage -d -B x=y save /dev/ram0 ram0.imgRestore image to a different ramdisk and check file:
$ sudo ./partimage -B x=y restore /dev/ram1 ram0.img.000
$ sudo mount /dev/ram1 /media/ram1
$ cat /media/ram1/foo.txt
test file.
Mon Apr 9 12:56:59 BST 2007Success!
Script for checking file in saved partition:
#!/bin/bash
# mount and check restored ramdisk
if [ ! -d /media/ram1 ]; then
mkdir /media/ram1
fi
mount /dev/ram1 /media/ram1
cat /media/ram1/foo.txt
umount /media/ram1To debug in KDevelop as root (in ubuntu):
alt-F2 (run)
gksudo kdevelop
open project... (go find existing copy)
So in summary, I have made progress in understanding the ways of this useful utility, and am a step closer to making a useful contribution to the project.
The rambling nature of this post reflects the way in which one begins to understand a new program. Hopefully it's not too hard to follow, or pick out the useful pieces. All feedback gratefully appreciated.
Tim.
30 March 2007
partimage + stdout, existing code
On first inspection it looks like some code already exists for writing an image to stdout (standard output).
image_disk.cpp, line 558
Unlike stdin for restore, stdout for save is not currently available in the command line options. I did do a build earlier where I enabled it (which I don't have any more due to my build problems). I managed to pipe an image to hexdump and seemed to be able to see some of the user interface info in the output.
It would seem the problem with the stdout option is that even in batch mode the program outputs interface data to stdout, which then corrupts the image.
I think I shall attempt to remove all the UI stuff, and make it act more like all the other unix tools. Might also try to create a reusable library out of it.
image_disk.cpp, line 558
if (strcmp(m_szImageFilename, "stdout"))
{
//... network output code hidden for clarity ...
}
else // it's stdout
{
m_fImageFile = stdout;
showDebug(1, "image will be on stdout\n");
}
Unlike stdin for restore, stdout for save is not currently available in the command line options. I did do a build earlier where I enabled it (which I don't have any more due to my build problems). I managed to pipe an image to hexdump and seemed to be able to see some of the user interface info in the output.
It would seem the problem with the stdout option is that even in batch mode the program outputs interface data to stdout, which then corrupts the image.
I think I shall attempt to remove all the UI stuff, and make it act more like all the other unix tools. Might also try to create a reusable library out of it.
26 March 2007
compiling partimage
Had a problems getting partimage to compile on one of my pcs from a fresh checkout.
The ./autogen.sh script was failing as follows
Barked up lots of wrong trees, including looking for missing libraries, gettext config etc.
Turned out to be an old version of automake.
Not sure how my other pc ended up with the right version, but this pc's version was:
Installing new version (with some help from command line auto-completion):
After updating automake, the ./autogen.sh script ran, and I could then run ./configure and make successfully, and was left with a binary for partimage in src/client/
Hurrah.
The solution came from a post by Tibor Simko on cdsware.cern.ch:
svn co https://partimage.svn.sourceforge.net/svnroot/partimage/trunk/partimage partimageThe ./autogen.sh script was failing as follows
tim@lap:~/projects/partimage$ ./autogen.sh
Running "autoreconf -vif" ...
autoreconf: Entering directory `.'
autoreconf: running: autopoint --force
autoreconf: running: aclocal -I m4 --output=aclocal.m4t
autoreconf: `aclocal.m4' is unchanged
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy
configure.ac: 16: required file `./[config.h].in' not found
Makefile.am:1: AM_GNU_GETTEXT in `configure.ac' but `intl' not in SUBDIRS
automake: Makefile.am: AM_GNU_GETTEXT in `configure.ac' but `ALL_LINGUAS' not defined
autoreconf: automake failed with exit status: 1
Done.Barked up lots of wrong trees, including looking for missing libraries, gettext config etc.
Turned out to be an old version of automake.
Not sure how my other pc ended up with the right version, but this pc's version was:
$ automake --version
automake (GNU automake) 1.4-p6Installing new version (with some help from command line auto-completion):
$ apt-get install automake[tab]
automake automake1.5 automake1.8
automake1.4 automake1.6 automake1.9
automake1.4-doc automake1.7 automaken
$ sudo apt-get install automake1.9
...
$ automake --version
automake (GNU automake) 1.9.6After updating automake, the ./autogen.sh script ran, and I could then run ./configure and make successfully, and was left with a binary for partimage in src/client/
Hurrah.
The solution came from a post by Tibor Simko on cdsware.cern.ch:
Re: problem with autoreconf when installing from cvs
* From: Tibor Simko
* Subject: Re: problem with autoreconf when installing from cvs
* Date: Thu, 18 Jan 2007 18:12:20 +0100
Hello:
On Thu, 18 Jan 2007, robert forkel wrote:
> $ autoreconf
> Makefile.am:23: AM_GNU_GETTEXT in `configure.ac' but `intl' not in SUBDIRS
> automake: Makefile.am: AM_GNU_GETTEXT in `configure.ac' but
> ALL_LINGUAS' not defined
Which version numbers of automake, autoconf, and gettext do you have?
E.g. automake versions prior to 1.9 and gettext versions prior to 0.14
will not work.
Best regards
--
Tibor Simko
13 March 2007
Today's project - partimage enhancement
me and partimage
I recently reorganised the partitions on my laptop, with the help of some invaluable OSS tools.
The laptop was split into OS partitions, with a data and swap partition at the end, but I'd starting running out of space. I have since made ubuntu my only OS at home, so no longer require multiple partitions.
My partition table ended up looking something like this: data | OS | more data | swap, and I wanted it to look like this: OS & data | swap, but without having to rebuild (again).
With another linux box available with bags of disc space, I did something like the following:
So far, I have grabbed the source from sourceforge's svn server, managed to compile the source (after being confused by a misleading error message) and installed an IDE. I started with Eclipse, as I've been using it a bit recently and really like it, but figure that perhaps the C++ devs aren't likely to be java fans and maybe they would choose something else. So I've installed KDevelop, and will be having a go with that.
I recently reorganised the partitions on my laptop, with the help of some invaluable OSS tools.
The laptop was split into OS partitions, with a data and swap partition at the end, but I'd starting running out of space. I have since made ubuntu my only OS at home, so no longer require multiple partitions.
My partition table ended up looking something like this: data | OS | more data | swap, and I wanted it to look like this: OS & data | swap, but without having to rebuild (again).
With another linux box available with bags of disc space, I did something like the following:
- from each data partition and my home folder: tar -cv datafolder | ssh otherbox "cat > laptop/datafolder.tar", which gave me a tarball of all my data
- boot into knoppix 4
- use partimage to save os parition image into filesystem of another partition
- scp osimage.img otherbox:laptop/
- fdisk to set up new partitions
- pipe the image back into partimage across the wire: ssh otherbox "cat laptop/osimage.img" | partimage .... plus some flags for batch writing to new partition
- use parted (partition editor) to stretch partition image back up to full size of new partition.
- fix grub with help from knoppix - hda(0,2) to hda(0,0) or something.
- remove references to non existent partitions from fstab
So far, I have grabbed the source from sourceforge's svn server, managed to compile the source (after being confused by a misleading error message) and installed an IDE. I started with Eclipse, as I've been using it a bit recently and really like it, but figure that perhaps the C++ devs aren't likely to be java fans and maybe they would choose something else. So I've installed KDevelop, and will be having a go with that.
Subscribe to:
Posts (Atom)