https://wiki.archlinux.org/api.php?action=feedcontributions&user=Queezythegreat&feedformat=atomArchWiki - User contributions [en]2024-03-29T11:05:26ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Arduino&diff=138054Arduino2011-04-23T02:19:01Z<p>Queezythegreat: Added CMake alternative</p>
<hr />
<div>[[Category:Development (English)]]<br />
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments. <br />
<br />
If you have a 64 bit Arch [[Arduino_64bit|this page]] is an alternative tested method of installing Arduino which works on version 17.<br />
<br />
More information is availible on the [http://www.arduino.cc/ Arduino HomePage].<br />
<br />
== Install packages from official repositories ==<br />
<br />
Install the avr-libc, avrdude, binutils-avr and gcc-avr packages from community.<br />
<br />
* avr-libc - standard C library<br />
* avrdude - very well known programmer<br />
* binutils-avr - assembler<br />
* gcc-avr - gcc C compiler support<br />
<br />
# pacman -S avr-libc avrdude binutils-avr gcc-avr<br />
<br />
==Install arduino package from AUR==<br />
<br />
Download [http://aur.archlinux.org/packages.php?ID=8388 arduino] from the AUR and install it.<br />
<br />
mkdir arduino_build && cd arduino_build &&<br />
wget http://aur.archlinux.org/packages/arduino/arduino/PKGBUILD &&<br />
makepkg -i<br />
<br />
===Running arduino for the first time===<br />
<br />
If the file /usr/share/arduino/lib/targets/libraries/Wire/utility/twi.o does not exist arduino will try and create it. Normal users don't have permission to write there so this will fail. Run arduino as root so it can create the file, after the file has been created it can be run under a normal user.<br />
<br />
==Other info==<br />
<br />
===Accessing serial===<br />
<br />
The arduino board communicates with the PC via a serial connection or a serial over USB connection. So the user needs read/write access to the serial device file. [[Udev]] creates files in /dev/tts/ owned by group uucp so adding the user to the uucp group gives the required read/write access.<br />
<br />
gpasswd -a <user> uucp<br />
<br />
Modify ~/.arduino/preferences.txt<br />
<br />
Change serial port from COM1 to your serial port. You can find out what your serial port is with:<br />
<br />
ls /dev/ | grep "USB"<br />
<br />
This is the line to change in ~/.arduino/preferences.txt:<br />
<br />
serial.port=/dev/ttyUSB0<br />
<br />
===Working with Uno/Mega2560===<br />
The Arduino Uno and Mega2560 have an onboard USB interface (an Atmel 8U2) that accepts serial data, so they are accessed through /dev/ttyACM0 created by the cdc-acm kernel module when it is plugged in.<br />
<br />
The 8U2 firmware may need an update to ease serial communications. See [http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1286350399] for more details and reply #11 for a fix. The original arduino bbs, where you can find an image explaining how to get your Uno into DFU, is now in a read-only state. If you don't have an account to view the image, see [http://www.scribd.com/doc/45913857/Arduino-UNO].<br />
<br />
You can perform a general function test of the Uno by putting it in loopback mode and typing characters into the arduino serial monitor at 115200 baud. It should echo the characters back to you. To put it in loopback, short pins 0 -> 1 on the digital side and either hold the reset button or short the GND -> RESET pins while you type.<br />
<br />
=== Adruino Mega2560 and new gcc-avr ===<br />
<br />
If you are using gcc-avr >= 4.3.5 then there is a C++ bug in the gcc-avr toolchain which builds bad firmware for the Atmel2560 processors. gcc-avr must be rebuilt using a patch found at [http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45263]. You can read more about the problems at [http://andybrown.me.uk/ws/2010/10/24/the-major-global-constructor-bug-in-avr-gcc/].<br />
<br />
Here is the patch for gcc:<br />
<pre><br />
--- gcc-4.5.1.orig/gcc/config/avr/libgcc.S 2009-05-23 17:16:07 +1000<br />
+++ gcc-4.5.1/gcc/config/avr/libgcc.S 2010-08-12 09:38:05 +1000<br />
@@ -802,7 +802,9 @@<br />
mov_h r31, r29<br />
mov_l r30, r28<br />
out __RAMPZ__, r20<br />
+ push r20<br />
XCALL __tablejump_elpm__<br />
+ pop r20<br />
.L__do_global_ctors_start:<br />
cpi r28, lo8(__ctors_start)<br />
cpc r29, r17<br />
@@ -843,7 +845,9 @@<br />
mov_h r31, r29<br />
mov_l r30, r28<br />
out __RAMPZ__, r20<br />
+ push r20<br />
XCALL __tablejump_elpm__<br />
+ pop r20<br />
.L__do_global_dtors_start:<br />
cpi r28, lo8(__dtors_end)<br />
cpc r29, r17<br />
</pre><br />
<br />
The easiest way to rebuild gcc-avr is using ABS and makepkg.<br />
<br />
<br />
===Using a Makefile instead of the IDE===<br />
Update 2011-03-12. Arduino Is not shipping a Makefile with version (22). The Makefile from the [http://code.google.com/p/dogm128/source/browse/libraries/Dogm/examples/SpaceTrash/Makefile.uno_dogs102 dogm128] project works for me though.<br />
<br />
Instead of using the arduino IDE it's possible to use another editor and a Makefile.<br />
<br />
Set up a directory to program your Arduino and copy the Makefile into this directory. A copy of the Makefile can be obtained from [http://www.arduino.cc/en/uploads/Hacking/Makefile arduino website] or from /usr/share/arduino/hardware/cores/arduino/Makefile<br />
<br />
You will have to modify this a little bit to reflect your settings. The makefile should be pretty self explainatory. Here are some lines you may have to edit.<br />
<br />
PORT = usually /dev/ttyUSBx, where x is the usb serial port your arduino is plugged into<br />
TARGET = your sketch's name<br />
ARDUINO = /usr/share/arduino/lib/targets/arduino<br />
<br />
Depending on which library functions you call in your sketch, you may need to compile parts of the library. To do that you need to edit your SRC and CXXSRC to include the required libraries.<br />
<br />
Now you should be able to make && make upload to your board to execute your sketch.<br />
<br />
===Using Scons instead of the IDE===<br />
<br />
Using [http://www.scons.org/ scons] together with [http://code.google.com/p/arscons/ arscons] it is very easy to use to compile and upload Arduino projects from the command line. Scons is based on python and you will need python-pyserial to use the serial interface. Install everything with<br />
<br />
# pacman -S python-pyserial scons<br />
<br />
That will get the dependencies you need too. You will also need Arduino itself so install it as described above. Create project directory (eg. test), then create a arduino project file in your new directory. Use the same name as the directory and add .pde (eg. test.pde). Get the [http://code.google.com/p/arscons/source/browse/trunk/SConstruct SConstruct] script from arscons and put it in your directory. Have a peek in it and, if necessary, edit it. It's a python script. Edit your project as you please, then run<br />
<br />
$ scons # This will build the project<br />
$ scons upload # This will upload the project to your Arduino<br />
<br />
===Using CMake instead of the IDE===<br />
<br />
Using [https://github.com/queezythegreat/arduino-cmake arduino-cmake] and [http://www.cmake.org/cmake/resources/software.html CMake] you can build Arduino firmware from the command line using multiple build systems.<br />
<br />
===References===<br />
* http://www.arduino.cc/en/Hacking/CommandLine<br />
* http://bbs.archlinux.org/viewtopic.php?pid=295312<br />
* http://regomodoslinux.blogspot.com/2007/10/how-to-install-arduino-ide-in-archlinux.html</div>Queezythegreathttps://wiki.archlinux.org/index.php?title=Arduino&diff=137911Arduino2011-04-21T14:31:43Z<p>Queezythegreat: Added Arduino Mega 2560 instructions for new gcc-avr</p>
<hr />
<div>[[Category:Development (English)]]<br />
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments. <br />
<br />
If you have a 64 bit Arch [[Arduino_64bit|this page]] is an alternative tested method of installing Arduino which works on version 17.<br />
<br />
More information is availible on the [http://www.arduino.cc/ Arduino HomePage].<br />
<br />
== Install packages from official repositories ==<br />
<br />
Install the avr-libc, avrdude, binutils-avr and gcc-avr packages from community.<br />
<br />
* avr-libc - standard C library<br />
* avrdude - very well known programmer<br />
* binutils-avr - assembler<br />
* gcc-avr - gcc C compiler support<br />
<br />
# pacman -S avr-libc avrdude binutils-avr gcc-avr<br />
<br />
==Install arduino package from AUR==<br />
<br />
Download [http://aur.archlinux.org/packages.php?ID=8388 arduino] from the AUR and install it.<br />
<br />
mkdir arduino_build && cd arduino_build &&<br />
wget http://aur.archlinux.org/packages/arduino/arduino/PKGBUILD &&<br />
makepkg -i<br />
<br />
===Running arduino for the first time===<br />
<br />
If the file /usr/share/arduino/lib/targets/libraries/Wire/utility/twi.o does not exist arduino will try and create it. Normal users don't have permission to write there so this will fail. Run arduino as root so it can create the file, after the file has been created it can be run under a normal user.<br />
<br />
==Other info==<br />
<br />
===Accessing serial===<br />
<br />
The arduino board communicates with the PC via a serial connection or a serial over USB connection. So the user needs read/write access to the serial device file. [[Udev]] creates files in /dev/tts/ owned by group uucp so adding the user to the uucp group gives the required read/write access.<br />
<br />
gpasswd -a <user> uucp<br />
<br />
Modify ~/.arduino/preferences.txt<br />
<br />
Change serial port from COM1 to your serial port. You can find out what your serial port is with:<br />
<br />
ls /dev/ | grep "USB"<br />
<br />
This is the line to change in ~/.arduino/preferences.txt:<br />
<br />
serial.port=/dev/ttyUSB0<br />
<br />
===Working with Uno/Mega2560===<br />
The Arduino Uno and Mega2560 have an onboard USB interface (an Atmel 8U2) that accepts serial data, so they are accessed through /dev/ttyACM0 created by the cdc-acm kernel module when it is plugged in.<br />
<br />
The 8U2 firmware may need an update to ease serial communications. See [http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1286350399] for more details and reply #11 for a fix. The original arduino bbs, where you can find an image explaining how to get your Uno into DFU, is now in a read-only state. If you don't have an account to view the image, see [http://www.scribd.com/doc/45913857/Arduino-UNO].<br />
<br />
You can perform a general function test of the Uno by putting it in loopback mode and typing characters into the arduino serial monitor at 115200 baud. It should echo the characters back to you. To put it in loopback, short pins 0 -> 1 on the digital side and either hold the reset button or short the GND -> RESET pins while you type.<br />
<br />
=== Adruino Mega2560 and new gcc-avr ===<br />
<br />
If you are using gcc-avr >= 4.3.5 then there is a C++ bug in the gcc-avr toolchain which builds bad firmware for the Atmel2560 processors. gcc-avr must be rebuilt using a patch found at [http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45263]. You can read more about the problems at [http://andybrown.me.uk/ws/2010/10/24/the-major-global-constructor-bug-in-avr-gcc/].<br />
<br />
Here is the patch for gcc:<br />
<pre><br />
--- gcc-4.5.1.orig/gcc/config/avr/libgcc.S 2009-05-23 17:16:07 +1000<br />
+++ gcc-4.5.1/gcc/config/avr/libgcc.S 2010-08-12 09:38:05 +1000<br />
@@ -802,7 +802,9 @@<br />
mov_h r31, r29<br />
mov_l r30, r28<br />
out __RAMPZ__, r20<br />
+ push r20<br />
XCALL __tablejump_elpm__<br />
+ pop r20<br />
.L__do_global_ctors_start:<br />
cpi r28, lo8(__ctors_start)<br />
cpc r29, r17<br />
@@ -843,7 +845,9 @@<br />
mov_h r31, r29<br />
mov_l r30, r28<br />
out __RAMPZ__, r20<br />
+ push r20<br />
XCALL __tablejump_elpm__<br />
+ pop r20<br />
.L__do_global_dtors_start:<br />
cpi r28, lo8(__dtors_end)<br />
cpc r29, r17<br />
</pre><br />
<br />
The easiest way to rebuild gcc-avr is using ABS and makepkg.<br />
<br />
<br />
===Using a Makefile instead of the IDE===<br />
Update 2011-03-12. Arduino Is not shipping a Makefile with version (22). The Makefile from the [http://code.google.com/p/dogm128/source/browse/libraries/Dogm/examples/SpaceTrash/Makefile.uno_dogs102 dogm128] project works for me though.<br />
<br />
Instead of using the arduino IDE it's possible to use another editor and a Makefile.<br />
<br />
Set up a directory to program your Arduino and copy the Makefile into this directory. A copy of the Makefile can be obtained from [http://www.arduino.cc/en/uploads/Hacking/Makefile arduino website] or from /usr/share/arduino/hardware/cores/arduino/Makefile<br />
<br />
You will have to modify this a little bit to reflect your settings. The makefile should be pretty self explainatory. Here are some lines you may have to edit.<br />
<br />
PORT = usually /dev/ttyUSBx, where x is the usb serial port your arduino is plugged into<br />
TARGET = your sketch's name<br />
ARDUINO = /usr/share/arduino/lib/targets/arduino<br />
<br />
Depending on which library functions you call in your sketch, you may need to compile parts of the library. To do that you need to edit your SRC and CXXSRC to include the required libraries.<br />
<br />
Now you should be able to make && make upload to your board to execute your sketch.<br />
<br />
===Using Scons instead of the IDE===<br />
<br />
Using [http://www.scons.org/ scons] together with [http://code.google.com/p/arscons/ arscons] it is very easy to use to compile and upload Arduino projects from the command line. Scons is based on python and you will need python-pyserial to use the serial interface. Install everything with<br />
<br />
# pacman -S python-pyserial scons<br />
<br />
That will get the dependencies you need too. You will also need Arduino itself so install it as described above. Create project directory (eg. test), then create a arduino project file in your new directory. Use the same name as the directory and add .pde (eg. test.pde). Get the [http://code.google.com/p/arscons/source/browse/trunk/SConstruct SConstruct] script from arscons and put it in your directory. Have a peek in it and, if necessary, edit it. It's a python script. Edit your project as you please, then run<br />
<br />
$ scons # This will build the project<br />
$ scons upload # This will upload the project to your Arduino<br />
<br />
===References===<br />
* http://www.arduino.cc/en/Hacking/CommandLine<br />
* http://bbs.archlinux.org/viewtopic.php?pid=295312<br />
* http://regomodoslinux.blogspot.com/2007/10/how-to-install-arduino-ide-in-archlinux.html</div>Queezythegreathttps://wiki.archlinux.org/index.php?title=AIF_Configuration_File&diff=125726AIF Configuration File2010-12-22T01:09:52Z<p>Queezythegreat: </p>
<hr />
<div>== What is AIF ==<br />
<br />
The Arch Installation Framework is the backbone to the ArchLinux distribution installer. The AIF executes all of the routines used to install Arch. More information about AIF proper can be found in the ArchLinux Installation Guide.<br />
<br />
== The AIF Configuration File ==<br />
<br />
The aif command can be executed with a configuration file which defines how Arch is to be installed. This is a similar concept to Red Hat's kickstart and Debian's preseed. But the similarities end with the concept, thanks to the Arch KISS philosophy the pain involved in automated installs is swept away. AIF is written entirely in bash, and the AIF configuration file is just that, bash. All of the variables and function definitions in the AIF configuration file are sourced shortly after the install begins and applied to the install.<br />
<br />
With this in mind, the AIF configuration file is simply a representation of all of that data which can be defined in the global scope of the AIF. This means that available variables can be found in the aif source code.<br />
<br />
=== Optional Variables ===<br />
The following variables are available in the AIF configuration file:<br />
<br />
==== SOURCE ====<br />
The source variable will be either cd or net, and will define whether the packages used are locally availabe or found over the network/internet.<br />
<br />
for local files:<br />
SOURCE=cd<br />
or for a source over the network/internet<br />
SOURCE=net<br />
<br />
==== FILE_URL ====<br />
The local directory containing Archlinux packages, used if SOURCE=cd<br />
<br />
FILE_URL=file:///src/repo/pkg<br />
<br />
==== SYNC_URL ====<br />
The network location used to sync packages over the network. What is important about this variable is that it is the same line that is placed in /etc/pacman.d/mirrorlist. So it is wise to use the $repo variable:<br />
<br />
SYNC_URL=http://mirror.rit.edu/archlinux/$repo/os/x86_64<br />
<br />
==== RUNTIME_REPOSITORIES ====<br />
<br />
==== RUNTIME_PACKAGES ====<br />
<br />
==== TARGET_GROUPS ====<br />
<br />
The groups to install, like base<br />
<br />
TARGET_GROUPS=base<br />
<br />
==== TARGET_PACKAGES_EXCLUDE ====<br />
<br />
Packages to exclude from the install<br />
<br />
TARGET_PACKAGES_EXCLUDE='reiserfsprogs nano'<br />
<br />
==== TARGET_PACKAGES ====<br />
<br />
Packages to include in the install<br />
<br />
TARGET_PACKAGES='openssh vim'<br />
<br />
=== Mandatory Variables ===<br />
<br />
These variables are the hard ones, and honestly the primary reason for this wiki entry, because they, like the hard drives they configure, can be complicated<br />
<br />
==== GRUB_DEVICE ====<br />
The GRUB_DEVICE variable is a simple one, it is the device that will hold the grub mbr. This is almost always the primary hard drive.<br />
<br />
GRUB_DEVICE='/dev/sda'<br />
<br />
==== PARTITIONS ====<br />
The partitions line is used to load up sfdisk for disk carving. It is a space delimited list which begins with the device to carve up and then a set of colon delimited arguments which define the device sizes, type and options.<br />
<br />
PARTITIONS='/dev/sda 100:ext2:+ 512:swap *:ext4'<br />
<br />
Here the disk to be carved up is /dev/sda, 3 partitions will be created, /dev/sda1 will be 100 Megabytes, Linux type, and the "+" sets the grub bootable flag. /dev/sda2 is 512 Megabytes and the swap type, /dev/sda3 will take up the rest of the space, and have the type Linux.<br />
<br />
Entry syntax:<br />
DEVICE_PATH PARTITIONING_SCHEME<br />
<br />
PARTITIONING_SCHEME := PARTITION_SIZE:FILESYSTEM_TYPE[:PARTION_FLAGS] [ PARTITIONING_SCHEME ]<br />
<br />
PARTITION_SIZE := [ MEBIBYTE_SIZE | * ]<br />
FILESYSTEM_TYPE := { raw | ext2 | ext3 | ext4 | xfs | jfs | vfat | brtfs | swap | lvm-pv | lvm-vg | lvm-lv }<br />
PARTITION_FLAGS := +<br />
<br />
<br />
<br />
==== BLOCKDATA ====<br />
The BLOCKDATA variable is used to determine which partitions are formatted and how they are to be mounted. While static partitions are simple and straightforward, LVM and crypt setups on the other hand can get somewhat messy.<br />
<br />
Since AIF translates components of the variables into arguments for commands, understanding what the commands are and how the arguments are passed will greatly assist in understanding how to use the variables.<br />
<br />
Entry syntax: <br />
BLOCK_DEVICE TYPE LABEL_NAME FS_STRING<br />
FS_STRING := { FS_DESCRIPTION | no_fs }<br />
<br />
FS_DESCRIPTION := TYPE;RECREATE;MOUNT_PATH;MOUNT_LOCATION;MOUNT_OPTS;LABEL_NAME;PARAMS[|FS_DESCRIPTION]<br />
<br />
RECREATE := { yes | no } # Re-format?<br />
PARAMS := { PARAMETERS | no_params } # Formating utility parameters<br />
MOUNT_PATH := { MOUNTPOINT | no_mountpoint } # Partition mountpoint<br />
MOUNT_OPTS := { MOUNTOPTS | no_opts } # Mounting options (see: man mount)<br />
MOUNT_LOCATION := { target | runtime | no } # Where to mount partition:<br />
# target - on system being installed<br />
# runtime - on host system<br />
# no - don't mount<br />
<br />
TYPE := { raw | ext2 | ext3 | ext4 | xfs | jfs |<br />
vfat | brtfs | swap | lvm-pv | lvm-vg | lvm-lv }<br />
LABEL_NAME := { LABEL | no_label }<br />
<br />
Notes:<br />
PARAMS/MOUNT_OPTS - spaces need to be replaced with underscores (_)<br />
<br />
===== Simple File Systems =====<br />
Simple file systems can be defined on top of partitions derived from the PARTITIONS variable.<br />
<br />
A simple example:<br />
<br />
BLOCKDATA='/dev/vda1 raw no_label ext2;yes;/boot;target;no_opts;no_label;no_params<br />
/dev/vda2 raw no_label swap;yes;no_mountpoint;target;no_opts;no_label;no_params<br />
/dev/vda3 raw no_label ext4;yes;/;target;no_opts;no_label;no_params'<br />
<br />
In this scenario, /dev/vda1 is a raw block device with no label, it is to be formatted with the ext2 file system, yes verifies that it will be formatted, /boot is the mount point, target <Not sure what target means yet>, no_opts is where file system mount options are placed, no_label can be replaced with a file system label. The parameters section is used by more advanced partitioning mechanisms.<br />
<br />
===== Advanced File Systems =====<br />
This example will create a /boot partition and a LVM volume group called *system* with 5 partitions:<br />
/boot => /dev/sda1 (ext3)<br />
/ => /dev/system/root [LVM] (xfs)<br />
/home => /dev/system/home [LVM] (xfs)<br />
/tmp => /dev/system/tmp [LVM] (xfs)<br />
/var => /dev/system/var [LVM] (xfs)<br />
/usr => /dev/system/usr [LVM] (xfs)<br />
<br />
The entry has extra whitespaces in order to increase redability (all whitespaces get removed at the end).<br />
BLOCKDATA=$(echo '<br />
/dev/sda1 raw no_label ext3; yes; /boot ; target; no_opts; no_label; no_params<br />
/dev/sda2 raw no_label lvm-pv; yes; no_mountpoint; target; no_opts; no_label; no_params<br />
/dev/sda2+ lvm-pv no_label lvm-vg; yes; no_mountpoint; target; no_opts; system ; /dev/sda2<br />
<br />
/dev/mapper/system lvm-vg system lvm-lv; yes; no_mountpoint; target; no_opts; home ; 1025M<br />
/dev/mapper/system lvm-vg system lvm-lv; yes; no_mountpoint; target; no_opts; root ; 1024M<br />
/dev/mapper/system lvm-vg system lvm-lv; yes; no_mountpoint; target; no_opts; tmp ; 1024M<br />
/dev/mapper/system lvm-vg system lvm-lv; yes; no_mountpoint; target; no_opts; var ; 1024M<br />
/dev/mapper/system lvm-vg system lvm-lv; yes; no_mountpoint; target; no_opts; usr ; 2048M<br />
<br />
/dev/mapper/system-home lvm-lv home xfs; yes; /home ; target; no_opts; no_label; no_params<br />
/dev/mapper/system-root lvm-lv root xfs; yes; / ; target; no_opts; no_label; no_params<br />
/dev/mapper/system-tmp lvm-lv tmp xfs; yes; /tmp ; target; no_opts; no_label; no_params<br />
/dev/mapper/system-var lvm-lv var xfs; yes; /var ; target; no_opts; no_label; no_params<br />
/dev/mapper/system-usr lvm-lv usr xfs; yes; /usr ; target; no_opts; no_label; no_params'| sed -r 's/ *; */;/g' | tr -s ' ')</div>Queezythegreathttps://wiki.archlinux.org/index.php?title=AIF_Configuration_File&diff=125724AIF Configuration File2010-12-22T01:06:19Z<p>Queezythegreat: </p>
<hr />
<div>== What is AIF ==<br />
<br />
The Arch Installation Framework is the backbone to the ArchLinux distribution installer. The AIF executes all of the routines used to install Arch. More information about AIF proper can be found in the ArchLinux Installation Guide.<br />
<br />
== The AIF Configuration File ==<br />
<br />
The aif command can be executed with a configuration file which defines how Arch is to be installed. This is a similar concept to Red Hat's kickstart and Debian's preseed. But the similarities end with the concept, thanks to the Arch KISS philosophy the pain involved in automated installs is swept away. AIF is written entirely in bash, and the AIF configuration file is just that, bash. All of the variables and function definitions in the AIF configuration file are sourced shortly after the install begins and applied to the install.<br />
<br />
With this in mind, the AIF configuration file is simply a representation of all of that data which can be defined in the global scope of the AIF. This means that available variables can be found in the aif source code.<br />
<br />
=== Optional Variables ===<br />
The following variables are available in the AIF configuration file:<br />
<br />
==== SOURCE ====<br />
The source variable will be either cd or net, and will define whether the packages used are locally availabe or found over the network/internet.<br />
<br />
for local files:<br />
SOURCE=cd<br />
or for a source over the network/internet<br />
SOURCE=net<br />
<br />
==== FILE_URL ====<br />
The local directory containing Archlinux packages, used if SOURCE=cd<br />
<br />
FILE_URL=file:///src/repo/pkg<br />
<br />
==== SYNC_URL ====<br />
The network location used to sync packages over the network. What is important about this variable is that it is the same line that is placed in /etc/pacman.d/mirrorlist. So it is wise to use the $repo variable:<br />
<br />
SYNC_URL=http://mirror.rit.edu/archlinux/$repo/os/x86_64<br />
<br />
==== RUNTIME_REPOSITORIES ====<br />
<br />
==== RUNTIME_PACKAGES ====<br />
<br />
==== TARGET_GROUPS ====<br />
<br />
The groups to install, like base<br />
<br />
TARGET_GROUPS=base<br />
<br />
==== TARGET_PACKAGES_EXCLUDE ====<br />
<br />
Packages to exclude from the install<br />
<br />
TARGET_PACKAGES_EXCLUDE='reiserfsprogs nano'<br />
<br />
==== TARGET_PACKAGES ====<br />
<br />
Packages to include in the install<br />
<br />
TARGET_PACKAGES='openssh vim'<br />
<br />
=== Mandatory Variables ===<br />
<br />
These variables are the hard ones, and honestly the primary reason for this wiki entry, because they, like the hard drives they configure, can be complicated<br />
<br />
==== GRUB_DEVICE ====<br />
The GRUB_DEVICE variable is a simple one, it is the device that will hold the grub mbr. This is almost always the primary hard drive.<br />
<br />
GRUB_DEVICE='/dev/sda'<br />
<br />
==== PARTITIONS ====<br />
The partitions line is used to load up sfdisk for disk carving. It is a space delimited list which begins with the device to carve up and then a set of colon delimited arguments which define the device sizes, type and options.<br />
<br />
PARTITIONS='/dev/sda 100:ext2:+ 512:swap *:ext4'<br />
<br />
Here the disk to be carved up is /dev/sda, 3 partitions will be created, /dev/sda1 will be 100 Megabytes, Linux type, and the "+" sets the grub bootable flag. /dev/sda2 is 512 Megabytes and the swap type, /dev/sda3 will take up the rest of the space, and have the type Linux.<br />
<br />
Entry syntax:<br />
DEVICE_PATH PARTITIONING_SCHEME<br />
<br />
PARTITIONING_SCHEME := PARTITION_SIZE:FILESYSTEM_TYPE[:PARTION_FLAGS] [ PARTITIONING_SCHEME ]<br />
<br />
PARTITION_SIZE := [ MEBIBYTE_SIZE | * ]<br />
FILESYSTEM_TYPE := { raw | ext2 | ext3 | ext4 | xfs | jfs | vfat | brtfs | swap | lvm-pv | lvm-vg | lvm-lv }<br />
PARTITION_FLAGS := +<br />
<br />
<br />
<br />
==== BLOCKDATA ====<br />
The BLOCKDATA variable is used to determine which partitions are formatted and how they are to be mounted. While static partitions are simple and straightforward, LVM and crypt setups on the other hand can get somewhat messy.<br />
<br />
Since AIF translates components of the variables into arguments for commands, understanding what the commands are and how the arguments are passed will greatly assist in understanding how to use the variables.<br />
<br />
Entry syntax: <br />
BLOCK_DEVICE TYPE LABEL_NAME FS_STRING<br />
FS_STRING := { FS_DESCRIPTION | no_fs }<br />
<br />
FS_DESCRIPTION := TYPE;RECREATE;MOUNT_PATH;MOUNT_LOCATION;MOUNT_OPTS;LABEL_NAME;PARAMS[|FS_DESCRIPTION]<br />
<br />
RECREATE := { yes | no } # Re-format?<br />
PARAMS := { PARAMETERS | no_params } # Formating utility parameters<br />
MOUNT_PATH := { MOUNTPOINT | no_mountpoint } # Partition mountpoint<br />
MOUNT_OPTS := { MOUNTOPTS | no_opts } # Mounting options (see: man mount)<br />
MOUNT_LOCATION := { target | runtime | no } # Where to mount partition:<br />
# target - on system being installed<br />
# runtime - on host system<br />
# no - don't mount<br />
<br />
TYPE := { raw | ext2 | ext3 | ext4 | xfs | jfs |<br />
vfat | brtfs | swap | lvm-pv | lvm-vg | lvm-lv }<br />
LABEL_NAME := { LABEL | no_label }<br />
<br />
Notes:<br />
PARAMS/MOUNT_OPTS - spaces need to be replaced with underscores (_)<br />
<br />
===== Simple File Systems =====<br />
Simple file systems can be defined on top of partitions derived from the PARTITIONS variable.<br />
<br />
A simple example:<br />
<br />
BLOCKDATA='/dev/vda1 raw no_label ext2;yes;/boot;target;no_opts;no_label;no_params<br />
/dev/vda2 raw no_label swap;yes;no_mountpoint;target;no_opts;no_label;no_params<br />
/dev/vda3 raw no_label ext4;yes;/;target;no_opts;no_label;no_params'<br />
<br />
In this scenario, /dev/vda1 is a raw block device with no label, it is to be formatted with the ext2 file system, yes verifies that it will be formatted, /boot is the mount point, target <Not sure what target means yet>, no_opts is where file system mount options are placed, no_label can be replaced with a file system label. The parameters section is used by more advanced partitioning mechanisms.<br />
<br />
===== Advanced File Systems =====<br />
This example will create a /boot partion and a LVM volume group called *system* with 5 partitions:<br />
/boot => /dev/sda1 (ext3)<br />
/ => /dev/system/root [LVM] (xfs)<br />
/home => /dev/system/home [LVM] (xfs)<br />
/tmp => /dev/system/tmp [LVM] (xfs)<br />
/var => /dev/system/var [LVM] (xfs)<br />
/usr => /dev/system/usr [LVM] (xfs)<br />
<br />
The entry has extra whitespaces in order to increase redability (all whitespaces get removed at the end).<br />
BLOCKDATA=$(echo '<br />
/dev/sda1 raw no_label ext3; yes; /boot ; target; no_opts; no_label; no_params<br />
/dev/sda2 raw no_label lvm-pv; yes; no_mountpoint; target; no_opts; no_label; no_params<br />
/dev/sda2+ lvm-pv no_label lvm-vg; yes; no_mountpoint; target; no_opts; system ; /dev/sda2<br />
<br />
/dev/mapper/system lvm-vg system lvm-lv; yes; no_mountpoint; target; no_opts; home ; 1025M<br />
/dev/mapper/system lvm-vg system lvm-lv; yes; no_mountpoint; target; no_opts; root ; 1024M<br />
/dev/mapper/system lvm-vg system lvm-lv; yes; no_mountpoint; target; no_opts; tmp ; 1024M<br />
/dev/mapper/system lvm-vg system lvm-lv; yes; no_mountpoint; target; no_opts; var ; 1024M<br />
/dev/mapper/system lvm-vg system lvm-lv; yes; no_mountpoint; target; no_opts; usr ; 2048M<br />
<br />
/dev/mapper/system-home lvm-lv home xfs; yes; /home ; target; no_opts; no_label; no_params<br />
/dev/mapper/system-root lvm-lv root xfs; yes; / ; target; no_opts; no_label; no_params<br />
/dev/mapper/system-tmp lvm-lv tmp xfs; yes; /tmp ; target; no_opts; no_label; no_params<br />
/dev/mapper/system-var lvm-lv var xfs; yes; /var ; target; no_opts; no_label; no_params<br />
/dev/mapper/system-usr lvm-lv usr xfs; yes; /usr ; target; no_opts; no_label; no_params'| sed -r 's/ *; */;/g' | tr -s ' ')</div>Queezythegreat