Wednesday, October 17, 2007

HOW TO Build and Install XFoil on ArchLinux

Here it is an “homebrew” guide to compile and install Xfoil (the famous program to compute aerodynamics on profiles) in a raw but (surprisingly effective!) way.

Preparation

  • Download from this pagehttp://web.mit.edu/drela/Public/web/xfoil/ the source in tar.gz format I downloaded this file:http://web.mit.edu/drela/Public/web/xfoil/xfoil6.96.tar.gz
  • Unpack the tar in your favourite directory

    ~/your_dir/$ tar -xzvf xfoil6.96.tar.gz

  • Move the unpacked dir in the dir in which you want Xfoil to be installed, I put it in /opt so I entered

    /opt/Xfoil

    if you will use this directory (or other than you user's ones) all the operations below must be performed with root privileges, so should be executed with the "sudo" command
Building

Open the README file in a text editor according to the instructions provided.

Building Orr-Sommerfeld Database

  • Build Orr-Sommerfeld database in ./orrs

    $cd orrs

    and follow the directions in orrs/README that means... “do it yourself!”
  • check where you are

    $pwd

  • let's enter the directory of the sources

    $cd src

  • edit the source file osmap.f

    $nano osmap.f

  • edit the row below to set the correct path to osmap.dat (in my case)

    DATA OSFILE / '/opt/Xfoil/orrs/osmap.dat' /

    I haven't wanted to set double precision so I didn't edit the REAL*4 line
  • return to orrs/ directory

    $cd ../bin

  • edit the Makefile to setup the compilation flags according to your system

    $nano Makefile

  • change the path to libPlt.a

    PLTOBJ = /opt/Xfoil/plotlib/libPlt.a

  • change the string of the compiler to use: gfortran instead of f77

    FC = gfortran

  • comment all the lines referring to the Intel Fortran Compiler inserting "#" before each line

  • build osgen

    make osgen

  • build osmap

    make osmap.o

  • go in the previous directory

    $cd ..

  • run osgen with osmaps_ns.lst

    $bin/osgen osmaps_ns.lst

Prepare for xfoil, plotlib, and pxplot for compilation

  • go to Xfoil directory
  • enter the plot library directory

    $cd plotlib

  • edit the Makefile to match you compiler and system configuration

    $nano Makefile

  • uncomment the correct name for the library

    PLTLIB = libPlt.a
    #PLTLIB = libPlt.a

  • set the gfortran compiler instead of f77 as before
  • comment the lines referring to double-precision expecially

    DP = -r8

  • edit the file config.make which options override the ones in Makefile doing the same changes you made in Makefile, library name and compiler name
  • comment all the lines referring to compilers other than gfortran
  • comment all the lines referring to double-precision so under the g77 block of comment I had:

    FC = gfortran
    CC = gcc

    and then the whole double-precision block commented

Building xfoil, plotlib, pxplot

  • go to Xfoil directory

  • enter the bin directory

    $cd bin

  • edit the Makefile as before

    $nano Makefile

  • check that libPlt.a is correctly called in the first part of the Makefile
  • comment "FC = f77" in the default compiler section but leave uncommented all the default flags

    # FC = f77

  • change the reference to g77 with the reference to gfortran as before

    FC = gfortran

    instead of every "FC = g77"
  • comment all references to all other compilers and to double-precision
  • finally build all the programs

    $make xfoil
    $make pplot
    $make pxplot

If everything is gone well you can exec xfoil directly from the directory Xfoil/runs...
To retry compilation you just need to clean the directories with the command

$make clean

in every directory containing a Makefile.
If you want to enable a system wide link to the xfoil command you have only to create a symbolic link in one of the ./bin directories of you system.
I created a link to xfoil in /opt/bin:

$cd /opt/bin
$ln -s /opt/Xfoil/runs/xfoil xfoil

To run the xfoil command system-wide you need to include /opt/bin in the paths listed in /etc/profile.

$sudo nano /etc/profile

Change the export PATH line from:

export PATH= “/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin”

to

export PATH= “/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/opt/bin”

Ok you have just built and installed Xfoil on your Arch box!
Type xfoil and enjoy!

see ya!
bYe,
Andy

Tuesday, October 16, 2007

GRUB configuration: menu.lst

Hi, guys!
I'm here again to talk about the famous Linux bootloader. This is a little post on the basics of GRUB configuration, I hope it will be useful for some of you!

What's their name?
For the *nix newbie one of the most difficult thing to learn is to change his point of view about the way of thinking the computer. In *nix OSes almost everything is viewed as a file, including the peripherals and the mass storage devices, that are "files" to be mounted in a directory in order to access their content.
The standard names of C:, D: and so on... are replaced by a smarter way to name these storage devices... hda, hdb, hdc.... and their partitions: hda1, hda2, hda5
hda indentifies the first hard disk of the computer, its partitions are numbered from 1 to 4 for the primary partitions and from 5 for logical ones... so hda5 is the first logical partition of the first hard disk.
GRUB boot loader instead of this names has his own hard disk identification that differs only a few from the system's one. In almost every distribution the grub configuration file /boot/grub/menu.lst begins with a comment that provide information about the correspondence by these way to name the devices:

# DEVICE NAME CONVERSIONS
#
# Linux Grub
# -------------------------
# /dev/fd0 (fd0)
# /dev/hda (hd0)
# /dev/hdb2 (hd1,1)
# /dev/hda3 (hd0,2)
#

General configuration
After this and other comments useful to understand GRUB's configuration syntax, begins the general configuration section.
Here are set these options:
  • timeout (in seconds) before GRUB will launch the default menu entry

    timeout 5


  • the default entry to boot after the timeout seconds

    default 0


  • the color scheme
  • color light-blue/black ligth-cyan/blue

On my LiBook with only Archlinux installed I set these option in order not to lose boot time and not to view the flashing boot menu caused setting timeout as 0 (black text on black background):

timeout 0
default 0
color black/black black/black

Boot Entries
The first entry is identified by the number 0 and so on... for a Linux entry you have to provide the kernel and the initrd values, for a windows one you have to set: rootnoverify, makeactive and chainloader +1 options.
So this is my number 0 entry that boot Archlinux with the framebuffer support in order to have a cooler console view as I described in a post before.

title ArchLinux
root (hd0,0)
kernel /vmlinuz26 root=/dev/hda3 ro vga=792
initrd kernel26.img

There are some other-than-basics cool things to do with the menu.lst that allow you to set a background image for the GRUB menu and other cool things...
In this "basics" post there is no room for this.. maybe in the future I will post also about those "advanced features" ;-)

see ya!
bYe,
Andy

Linux: how to reset GRUB MBR

OK guys! This is the situation: you had your first hard disk with these partitions:
  • hda1 (first primary partition) Window$
  • hda2 (second primary partition) Linux
  • hda5 (first logic partition) Linux-swap
You've just reinstalled Window$, because of one of the almost billion known crashing issues ;-P
This operation has reset the MBR (Master Boot Record) of the hard disk with the standard Windows' bootloader: no GRUB menu of course... but your Linux is still there no panic!

Here you are the solution in just a few steps!

  1. Boot you computer with one of LiveCD distro of Linux.
  2. Open a terminal session.
  3. Log as root or become root

    # sudo su

  4. Open GRUB's shell
  5. # grub

    Now you are in GRUB's prompt ("grub>") and you can manage all the boot parameters as you want.
    Remember that GRUB lists your disks from hd0 to hd1 and so on... hence hda is called hd0 and hda1 becomes (hd0,1)

  6. Initialize the partition in which Windows is installed:

    grub> root (hd0,1)

    [If your windows installation/reinstallation is located in a partition other than hda1 (hd0,1) you should only change this to initialize the correct partition... i.e. for a windows installation in hda2 type "root (hd0,2)"]

  7. re-install grub in the MBR

    grub> setup (hd0)

  8. exit smoothly ;-)

    grub> quit

  9. and finally reboot the system from the shell

    # reboot

    or close your terminal window and restart the computer as usual.
Everything should be back as before, since GRUB's installation process automatically detect all the operating systems' installations on your hard disk!

see ya!
bYe,
Andy

Thursday, October 11, 2007

Walking for Peace!

Hi guys! Here I am...
almost a week later I'm posting the photos I took during last weekend when I have been at the Rally for Peace from Perugia to Assisi.
It was a very nice experience, I've met new people and enjoyed the beauties of a wonderful autumn day in Middle Italy.
We couldn't reach the end of the rally (Assisi) because we were a bit late, and the place was overcrowded. However we walked for about 15 km from a town near Perugia to S.Maria degli Angeli, a place near to Assisi.
Here you are some photos, the hero of these two days was Teo's "BlUe-kulele" that supported us in so many improvisations with my whistles and blues harp... :-)
Keep on Bluesing, Rocking and everything else... peacefully! ;-)
Hope you like these photos!
bYe,
Andy

Sunset in Todi

Todi's streets

Todi's Central Square

Todi's country

Kill'a Coffee jam session, miss you Whites :-)

The Beginning

Peace Dove

People for Peace

Umbria

Teo's "BlUe-kulele"

Assisi: a view

Tuesday, October 2, 2007

An old photo...

Hey, what's this! I found an old photo of me and my friend Teo. I suppose it was taken in May 2003, when without any beard... we went to the University exploring the new place where we were going to study the next year! :-D

Monday, October 1, 2007

Democratic works!

Yeah, these two weeks off, after I failed my last exam, have gone.
I was involved in so many things that I had no time to update this space... but I have so much to write here, so in the next days I hope to do the best to post almost everything.
I didn't update this blog because my whole time on the Internet was about to design, to edit and to manage of a whole site!
In Italy we have now the construction of the new Democratic Party, from the union of Leftist Democrats (Democratici di Sinistra [the Oak] a.k.a. DS) and Liberal Democrats (La Margherita [the Daisy] a.k.a. DL)
In almost every town, city and county there are committees for the creation of this new political subject that will include in his aim, a large part of the people from the society and from the associations.
On October 14th in Italy all the people interested in this project will be able to choose the secretary of the party and to elect the members of the Founding Congress.
Also in Rho we have formed our committee and I am part of it as a common citizen, other than the parties and free to enter as I am in this new adventure.
Since my skills with computer and a few experience with web design, I was chosen to put on-line the committee's site!
I used Drupal and I worked with graphics from the national site... the result is quite cool.
I installed modules like the Acidfree Album one that allows to post photos in a fast and easy way.
Finally I created the php-code for a block using the data in mysql tables generated and updated by the Aggregator module.
With these data I set up a block that shows the teasers of the last posts of two interesting external blogs! That's very cool, because I imported and hacked the original graphics of each blog to edit it's own post!
To see the result of my hard work check it out: http://www.partitodemocraticorho.it
Tomorrow I will begin university courses, but I hope to have the time to post now that the site I on-line and working.
On the other hand with Young Ideas group we have some things in mind to realize to gain the attention of the people about important themes. This adventure goes on and I'm very happy for this. As a first action we greeted the cyclists of the BiciPace in Rho to complain with the Mayor who has dcided not to show the Peace Flag from the Town Building anymore.
This is only an example of our future ideas and actions.
So now I'm very tired and tomorrow I have to get up early...
Good night and Stay Tuned... I've got some cool stuff (yeah also Linux stuff) to post in the next days!
bYe,
Andy