1) Abrir un terminal con el usuario "root" y crear el directorio de trabajo para la distribución

	su -
	mkdir -p /mnt/gentoo_uclibc/NetDAS-Distro


2) Obtener el software necesario. Esto se puede realizar de dos formas:

	a) Si tiene una distribución en una carpeta NetDAS-Distro, ejecute las siguietes instrucciones:


		Monte el dispositivo donde se encuetra alojada la carpeta NetDAS-Distro en el directorio anterior:

		a.1) Si tiene un CDROM use el siguiente comando: 

				mount /dev/cdrom /mnt/gentoo_uclibc/NetDAS-Distro

		a.2) Si tiene un pendrive use:

				mount /dev/sda1 /mnt/gentoo_uclibc/NetDAS-Distro
                               

		NOTA: Las instrucciones más detallas de como montar el dispositivo no se especifican en este documento. ni de copiar los archivos desde el pendrive.

		

	b) Si va a instalar desde internet:

		cd /mnt/gentoo_uclibc/NetDAS-Distro
		wget http://mirror.mcs.anl.gov/pub/gentoo/experimental/x86/embedded/stages/stage3-x86-uclibc-2008.0.tar.bz2
		wget ftp://ftp.ula.ve/realtime/portage-20090125.tar.bz2


3) Cambiarse al directorio de trabajo raiz donde se montará la imagen de la distribución:
	 
	cd /mnt/gentoo_uclibc

4) Desempaquetar el stage:

	tar xvjpf /mnt/gentoo_uclibc/NetDAS-Distro/stage3-x86-uclibc-2008.0.tar.bz2


5) Copiar el resolv.conf   (sistema para la resolución de nombres de red)

	cp -L /etc/resolv.conf etc/  

6) Desempaquetar la base de datos de paquetes (portage)

	cd usr
	tar xvjf /mnt/gentoo_uclibc/NetDAS-Distro/portage-20090125.tar.bz2
									 
Si esta utilizando un pendrive o un cdrom que tiene la carpeta NetDAS-Distro ejecute los siguientes comandos: 
	
	mkdir -p portage/distfiles
	cp /mnt/gentoo_uclibc/NetDAS-Distro/distfiles/* portage/distfiles    

7) Montar los directorios para hacer la distro funcional

	mount --bind /dev /mnt/gentoo_uclibc/dev/
	mount -t proc proc /mnt/gentoo_uclibc/proc/

8) Entrar al entorno de UClibc (chroot)

	chroot /mnt/gentoo_uclibc/ /bin/bash

9) Inicializar las variables de ambiente

	env-update && source /etc/profile

10) Crear el archivo /etc/make.conf 

Si esta utilizando un pendrive o un cdrom que tiene la carpeta NetDAS-Distro ejecute los siguientes comandos:

	cp /NetDAS-Distro/make.conf /etc    

Y continue con el paso siguiente, si no esta utilizando pendrive o un cdrom, edite el archivo

	nano /etc/make.conf

Y coloque las siguientes líneas

	CFLAGS="-Os -mtune=i386 -pipe"
	CXXFLAGS="-Os -mtune=i386 -pipe"
	LDFLAGS="-Wl,-O1"
	CHOST="i386-gentoo-linux-uclibc"
	FEATURES="ccache buildpkg"
	USE="minimal"
	PKGDIR="${PORTDIR}/packages/uclib"


11) Definir el perfil de la distribución

	ln -snf /usr/portage/profiles/uclibc/x86/ /etc/make.profile

12) Configurar portage para instalar los paquetes necesarios:

	mkdir -p /etc/portage

Si esta utilizando un pendrive o un cdrom que tiene la carpeta NetDAS-Distro ejecute los siguientes comandos:
	
	cp /NetDAS-Distro/pa* /etc/portage

Y continue con el paso siguiente, si no tiene el pendrive o CD ROM, ejecute los siguientes comandos para crear los archivos:

	nano /etc/portage/package.keywords 

Coloque las siguientes líneas

	=sys-apps/baselayout-2.0.0 ~x86
	=sys-apps/openrc-0.4.2 ~x86
	>=sys-fs/udev-133 ~x86

Guarde y cierre el archivo

	nano /etc/portage/package.unmask 

Coloque las siguientes líneas

		=sys-apps/baselayout-2.0.0
		=sys-apps/openrc-0.2.1-r1

Guarde y cierre el archivo
		
	nano /etc/portage/package.mask 

Coloque las siguientes líneas

		sys-apps/sysvinit

Guarde y cierre el archivo


13) Instalar el ccache

	emerge ccache

14) Como el stage por lo general se encuentra desactualizado (la versión que se utilizó
en esta receta. Ver paso 4) se debe actualizar todos los paquetes ejecutando los siguientes comandos:

	emerge --unmerge mktemp 
	FEATURES="-sandbox" emerge -1 -v coreutils 
	emerge -v binutils =sys-apps/util-linux-2.13.1.1 uclibc 
	FEATURES="keepwork" emerge -1 -v busybox
	
15) Desinstalar udev y e2fsprogs que generan problemas al instalar openrc
y otros paquetes en la mini distro

	emerge --unmerge udev sysvinit
	emerge -v openrc 
	emerge -v udev
	emerge --unmerge ss e2fsprogs com_err
	emerge -1 -v  e2fsprogs
	export DONT_MOUNT_BOOT=true
	emerge -1 -v grub
	emerge --config grub (responder /boot a la petición del directorio de instalación)
	
16) Instalar los paquetes en la mini distro

	mkdir /tinygentoo
	ROOT=/tinygentoo USE=make-symlinks emerge -vkN =sys-apps/baselayout-2.0.0 uclibc busybox =sys-apps/util-linux-2.13.1.1

17) Descargar el kernel y el RTAI 

Si esta utilizando un pendrive o un cdrom que tiene la carpeta NetDAS-Distro ejecute los siguientes comandos:

	cp /NetDAS-Distro/linux-2.6.23.tar.bz2 /usr/src
	cp /NetDAS-Distro/rtai-3.7-test1.tar.bz2 /usr/src

Si no esta utilizando pendrive o cdrom, ejecute los siguientes comandos:

	cd /usr/src
	wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.23.tar.bz2	
	wget --no-check-certificate https://www.rtai.org/RTAI/rtai-3.7-test1.tar.bz2

18) Desempaquetar el software y parchar el kernel de linux

	cd /usr/src
	tar xvjf linux-2.6.23.tar.bz2
	tar xjf rtai-3.7-test1.tar.bz2
	ln -s linux-2.6.23 linux	
	cd linux
	patch -p1 < ../rtai-3.7-test1/base/arch/i386/patches/hal-linux-2.6.23-i386-1.12-03.patch


Rescribir el archivo /usr/src/linux/include/asm-i386/serial.h para que las tarjetas multi-puerto serial puedan funcionar
(ESTO SE PROBÓ SOLAMENTE CON LA TARJETA, Con cual tarjeta?)

Si esta utilizando un pendrive o un cdrom que tiene la carpeta NetDAS-Distro copiar el archivo

	cp /NetDAS-Distro/serial.h /usr/src/linux/include/asm-i386/serial.h

Si no, edite el archivo y modifiquelo para que se vea de la siguiente forma:         #edit con nano

	/*
	 * include/asm-i386/serial.h
	 */


	/*
	 * This assumes you have a 1.8432 MHz clock for your UART.
	 *
	 * It'd be nice if someone built a serial card with a 24.576 MHz
	 * clock, since the 16550A is capable of handling a top speed of 1.5
	 * megabits/second; but this requires the faster clock.
	 */
	#define BASE_BAUD ( 1843200 / 16 )

	/* Standard COM flags (except for COM4, because of the 8514 problem) */
	#ifdef CONFIG_SERIAL_DETECT_IRQ
	#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
	#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
	#else
	#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
	#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
	#endif

	#define CTI_BAUD (7372800/16)

	#define SERIAL_PORT_DFNS                        \
	        /* UART CLK   PORT IRQ     FLAGS        */                      \
	        { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS },      /* ttyS0 */     \
	        { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS },      /* ttyS1 */     \
	        { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS },      /* ttyS2 */     \
	        { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS },     /* ttyS3 */     \
	        { 0, CTI_BAUD, 0x2A0, 7, STD_COM_FLAGS },       /* ttyS4 */     \
	        { 0, CTI_BAUD, 0x2A8, 7, STD_COM_FLAGS },       /* ttyS5 */     \
	        { 0, CTI_BAUD, 0x2B0, 7, STD_COM_FLAGS },       /* ttyS6 */     \
 	       { 0, CTI_BAUD, 0x2B8, 7, STD_COM4_FLAGS },      /* ttyS7 */     \
 	       { 0, CTI_BAUD, 0x2C0, 10, STD_COM_FLAGS },      /* ttyS8 */     \
 	       { 0, CTI_BAUD, 0x2C8, 10, STD_COM_FLAGS },      /* ttyS9 */     \
 	       { 0, CTI_BAUD, 0x2D0, 10, STD_COM_FLAGS },      /* ttyS10 */    \
 	       { 0, CTI_BAUD, 0x2D8, 10, STD_COM4_FLAGS },     /* ttyS11 */



19) Configurar el kernel de Linux  # favor documentar mejor este paso ya que existen dudas significativas en el anexo A.


	cd /usr/src/linux

Si esta utilizando un pendrive o un cdrom que tiene la carpeta NetDAS-Distro copiar el archivo de configuración  previamente preparado en el directorio del kernel:

	cp /NetDAS-Distro/config-2.6.23 ./.config

	Luego ejecute este comando guarde y salga de inmediato
	
	make menuconfig

Si no, ejecute utilice este último comando para configurar el kernel siguiendo los parámetros especificados en el
anexo A (Al final de ese documento). 

20) Compilar el kernel utilizando los siguientes comandos

		make
                make modules_install	

21) Instalar RTAI

	cd /usr/src/
	cd rtai-3.7-test1
	mv addons/drivers/16550a  addons/drivers/16550A
	make menuconfig 
		Asegurar que las siguientes opciones se encuentren de la siguiente forma:
			General  --->
			  [ ] Build RTAI testsuite
			Add-ons  --->
			  [ ] In-kernel C++ support
			  [*] Real-Time Driver Model over RTAI
			  Drivers  --->
			    [*] RTAI serial line driver
	make
	make install
	cp -a /usr/realtime/ /tinygentoo/usr/

22)Instalar los servidores de base de datos y WEB

Si se desea apache y postgres ejecutar


	ROOT=/tinygentoo USE=make-symlinks emerge -avkN apache
	ROOT=/tinygentoo USE=make-symlinks emerge -avkN postgresql
	ROOT=/tinygentoo USE=make-symlinks emerge --config =postgresql-8.0.15

O si se desea algo más liviano, usar el sqlite

	cp /usr/src/linux/include/asm/page*.h /usr/include/asm
	ROOT=/tinygentoo USE=make-symlinks emerge -vkN lighttpd
	ROOT=/tinygentoo USE=make-symlinks emerge -vkN sqlite
	cp -a /NetDAS-Distro/lighttpd/* /tinygentoo/etc/lighttpd

si tene problemas de conexion a verifique en el archivo /etc/wget/wgetrc

	http_proxy = http://<proxy_local>:<puerto_proxy_local>
	ftp_proxy = ftp://<proxy_local>:<puerto_proxy_local>

23) Cambiarse al entorno de la mini distrhttp_proxy = http://o 

	chroot /tinygentoo/ /bin/ash

24) Colocar el passwd de root

	passwd

25) Agregar un usuario regular y el usuario para lighttpd en caso de haber 
seleccionado un ambiente ligero

	addgroup -g 100 users
	mkdir -p /home/netdas
	adduser -h /home/netdas -s /bin/ash -G users netdas
	passwd netdas
	adduser lighttpd
	mkdir -p /var/log/lighttpd
	chown lighttpd:lighttpd /var/log/lighttpd

No es necesario colocarle password al usuario lighttpd debido a que a ese usuario nunca se va a ingresar.

26) Salir del entorno de la mini distro

	exit

27) Colocar el nombre de la máquina del /tinygentoo

	 echo "-->Net-Das" > /tinygentoo/etc/hostname

28) Editar el archivo /tinygentoo/etc/inittab, ejecute el siguiente comando:

        nano /tinygentoo/etc/inittab 

    y colocar las siguientes lineas:
	
	tty1::respawn:/sbin/agetty 38400 tty1
	tty2::respawn:/sbin/agetty 38400 tty2
	::restart:/sbin/init
	::ctrlaltdel:/sbin/reboot
	::shutdown:/bin/umount -a -r
	::shutdown:/sbin/swapoff -a

    Guarde y cierre el archivo.


O tambien puede copiar el archivo inittab desde la distro, con el comando:

	cp /NetDAS-Distro/inittab /tinygentoo/etc/

29) Editar el archivo /tinygentoo/etc/fstab, ejecute el siguiente comando:

	nano /tinygentoo/etc/fstab

    y colocar las siguientes líneas:

	none       /tmp           tmpfs      defaults        0 0
	none       /proc          proc       defaults        0 0
	/dev/hda1  /          	  ext2        defaults      0 1
	/dev/hda2  /mnt/dongle    ext2       noauto,ro        0 0

    Guarde y cierre el archivo


O tambien puede copiar el archivo fstab desde la distro, con el comando:

	cp /NetDAS-Distro/fstab /tinygentoo/etc/

Asegurese que tenga las misma líneas mencionadas anteriormente, verifique, guarde y cierre el archivo /tinygentoo/etc/fstab


30) Crear los siguientes directorios

	mkdir -p /tinygentoo/boot /tinygentoo/mnt/dongle /tinygentoo/proc /tinygentoo/sys /tinygentoo/dev

31) Crear el archivo /tinygentoo/init ejcutando el comando: 
 
	nano /tinygentoo/init

   y agregue el siguiente contenido:


	#!/bin/ash
	echo
	echo
	echo " Welcome to TinyGentoo."
	echo
	echo
	echo " * Setting umask.."
	e2fsck -y /dev/hda1
	mount -n -o remount /dev/hda1 /
	echo "/dev/hda1 / ext2 rw 0 0" > /etc/mtab
	umask 022
	echo " * Mounting /proc.."
	mount -t proc none /proc
	echo " * Populating /dev..."
	mount -t sysfs sysfs /sys
	echo /bin/mdev > /proc/sys/kernel/hotplug
	mdev -s
	if [ ! -d /dev/pts ]; then mkdir /dev/pts; fi
	mount -t devpts devpts /dev/pts
	echo " * Creating needed devices.."
	echo " * Starting init.."
	exec <dev/console >dev/console 2>&1
	mkdir -p /dev/shm
	ln -sf /dev/tty0 /dev/c0
	ln -sf /dev/tty1 /dev/c1
	ln -sf /dev/tty2 /dev/c2
	ln -sf /dev/tty3 /dev/c3
	ln -sf /dev/tty4 /dev/c4
	ln -sf /dev/tty5 /dev/c5
	ln -sf /dev/tty6 /dev/c6
	hostname Net-Das
	/home/netdas/bin/start-netdas.sh
	exec chroot . /sbin/init
	echo " *** Starting init failed! ***"
	echo " * Trying to start a shell.."
	exec /bin/ash

   Guarde y cierre el archivo

O tambien puede copiar el archivo init desde la distro, con el comando:

	cp /NetDAS-Distro/init /tinygentoo/	

32) Darle permisos de ejecución

	chmod 755 /tinygentoo/init 

33) Copiar los módulos al directorio de entorno de la mini distro

	mkdir -p /tinygentoo/lib/modules
	cp -a /lib/modules/* /tinygentoo/lib/modules/
	cd /usr/realtime/modules
	mkdir -p /tinygentoo/lib/modules/2.6.23/kernel/drivers/rtai
	install -m 0644 *.ko /tinygentoo/lib/modules/2.6.23/kernel/drivers/rtai
	rm -rf /usr/realtime/modules /usr/share/ca-certificates /tinygentoo/usr/lib/libcrypto.a
	

34) Copiar el kernel 

	cd /usr/src/linux
	cp arch/i386/boot/bzImage /tinygentoo/vmlinuz-tinygentoo

35) Crear el directorio /tinygentoo/grub/

	mkdir /tinygentoo/boot/grub/


36) Crear el archivo /tinygentoo/boot/grub/menu.lst y colocar las siguientes líneas

	timeout 3
	title TinyGentoo
	kernel /vmlinuz-tinygentoo root=/dev/hda1 init=/init lapic
    
     Guarde y cierre el archivo.

O tambien puede copiar el archivo init desde la distro, con el comando:

	cp /NetDAS-Distro/menu.lst /tinygentoo/boot/grub/

Verifique que el archivo menu.lst tengas las misma líneas que se mencionaron anteriormente.


37) Copiar los archivos necesarios para el cargador del sistema operativo (grub)

	cp /boot/grub/stage* /boot/grub/e2fs_stage1_5 /tinygentoo/boot/grub/
	cd /tinygentoo
	ln -sf ./boot/grub/ /tinygentoo/grub


38) Editar el archivo /tinygentoo/etc/mdev.conf con el siguiente contenido



	# Symlinks:
	# Syntax: %s -> %s
	MAKEDEV -> ../sbin/MAKEDEV
	/proc/core -> kcore
	fd -> /proc/self/fd
	mcdx -> mcdx0
	radio -> radio0
	ram -> ram1
	sbpcd -> sbpcd0
	sr0 -> scd0
	sr1 -> scd1
	sr10 -> scd10
	sr11 -> scd11
	sr12 -> scd12
	sr13 -> scd13
	sr14 -> scd14
	sr15 -> scd15
	sr16 -> scd16
	sr2 -> scd2
	sr3 -> scd3
	sr4 -> scd4
	sr5 -> scd5
	sr6 -> scd6
	sr7 -> scd7
	sr8 -> scd8
	sr9 -> scd9
	stderr -> fd/2
	stdin -> fd/0
	stdout -> fd/1
	vbi -> vbi0
	vcs -> vcs0
	vcsa -> vcsa0
	video -> video0
	# Devices:
	# Syntax: %s %d:%d %s
	# devices user:group mode
	null 0:0 777
	zero 0:0 666
	grsec 0:0 660
	urandom 0:0 444
	console 0:5 0600
	fd0 0:11 0660
	hdc 0:6 0660
	kmem 0:9 000
	mem 0:9 0640
	port 0:9 0640
	ptmx 0:5 0660
	sda* 0:6 0660
	sdb* 0:6 0660
	hda* 0:6 0660
	tty 0:5 0660
	tty0* 0:5 0660
	tty1* 0:5 0660
	tty2* 0:5 0660
	tty3* 0:5 0660
	tty4* 0:5 0660
	tty5* 0:5 0660
	tty6* 0:5 0660
	ttyS* 0:20 640

   Guarde y cierre el archivo.

O tambien puede copiar el archivo mdev.conf desde la distro, con el comando:

	cp /NetDAS-Distro/mdev.conf /tinygentoo/etc/

39) Copiar el directorio "netdas" que contiene los archivos fuentes de los protocolos de NetDAS

	cp -a /NetDAS-Distro/netdas /home/netdas

40) Compilar los archivos para la plataforma:

	export PATH=$PATH:/usr/realtime/bin
	cd /home/netdas
	make
	cp -a /home/netdas/bin /home/netdas/htdocs /home/netdas/cgi-bin /home/netdas/etc /tinygentoo/home/netdas
	chmod u+s /tinygentoo/home/netdas/bin/slave_modbusip
	
	
	
41) Editar el archivo /etc/passwd y cambiar el SHELL para root ( el valor debe ser /bin/ash)

		chroot /tinygentoo /bin/ash
	
	Cargar el editor 

		vi /etc/passwd 

	Cambiar la siguiente linea 
		root:x:0:0:root:/root:/bin/bash
	por 
		root:x:0:0:root:/root:/bin/ash

	chown -R lighttpd:lighttpd /home/netdas/etc
	chown -R lighttpd:lighttpd /home/netdas/htdocs
	chown -R lighttpd:lighttpd /home/netdas/cgi-bin
	chmod a+xrs /home/netdas/cgi-bin/confcgi
	mkdir /root

	cd /var/www/localhost
	rm -R *
	ln -s /home/netdas/cgi-bin
	ln -s /home/netdas/htdocs

	exit
	
42) Editar el archivo /tinygentoo/etc/lighttpd/lighttpd.conf y colocar la variable var.basedir al valor /home/netdas sustituyendo el que trae por defecto:
	
	var.basedir = "/home/netdas"

    O tambien puede copiar el archivo lighttpd.conf desde la distro, con el comando:

	cp /NetDAS-Distro/lighttpd/lighttpd.conf /tinygentoo/etc/lighttpd/


43) Crear el archivo start-netdas.sh en /tinygentoo y colocar los programas de arranque de la plataforma Net-DAS, por ejemplo:

	a) Si tiene una distribución en una carpeta NetDAS-Distro, ejecute las siguietes instrucciones:

		cp /NetDAS-Distro/start-netdas.sh /tinygentoo/home/netdas/bin

	b) Si bajo la distribución via web, ejecute las siguietes instrucciones:

		b.1) Crear el archivo start-netdas.sh, en el directorio /tinygentoo/home/netdas/bin, con la siguiente instrucción:

			nano  start-netdas.sh

		b.2) Agregar las siguiente lineas

			#!/bin/ash
			echo "Starting Net-DAS initial programs"
			lighttpd -f /etc/lighttpd.conf

		b.3) Guardar el archivo y salir del editor nano.

44) Crear el archivo /tinygentoo/usr/share/udhcpc/default.script 

	Si tiene una distribución en una carpeta NetDAS-Distro, ejecute las siguietes instrucciones:

		mkdir -p /tinygentoo/usr/share/udhcpc/
		cp /NetDAS-Distro/default.script  /tinygentoo/usr/share/udhcpc/default.script

	Si no, editelo: 

		nano /tinygentoo/usr/share/udhcpc/default.script

	Agregue el siguiente contenido:


		#!/bin/sh
		# udhcpc script edited by Tim Riker <Tim@Rikers.org>
		# Modified to include timeout options by Rob Flickenger <rob@metrix.net>
	
		[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
	
		RESOLV_CONF="/etc/resolv/dhcp"
		OPTIONS="timeout:1 retry:1"
	
        	[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
		[ -n "$subnet" ] && NETMASK="netmask $subnet"
	
		case "$1" in
		deconfig)
		/sbin/ifconfig $interface 0.0.0.0
		;;

		renew|bound)
		/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
	
		if [ -n "$router" ] ; then
		echo "deleting routers"
		while route del default gw 0.0.0.0 dev $interface > /dev/null 2>&1; do
		:
		done
	
		for i in $router ; do
		route add default gw $i dev $interface
		done
		fi
	
		echo -n > $RESOLV_CONF
		[ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
		[ -n "$OPTIONS" ] && echo options $OPTIONS >> $RESOLV_CONF
		for i in $dns ; do
		echo adding dns $i
		echo nameserver $i >> $RESOLV_CONF
		done
		;;
		esac
		exit 0

	Guardar el archivo y salir del editor nano


45) Agregar la siguiente línea en el archivo /tinygentoo/etc/profile

	export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/realtime/lib


********************************** CONSTRUCCIÒN  DEL PENDRIVE ******************************
	
1) Inserte el pen driver en el puerto usb.
   Ejecute el comando mount para ver con que nombre reconoce el pen drive el so ejem: /dev/sda
   Desmounte el pendrive si se monta automaticamente.
  Limpiar la tabla de particiones del dispositivo de almacenamiento  y crear el espacio 
requerido para la instalación

        dd if=/dev/zero of=/dev/sdb bs=1 count=512
        fdisk /dev/sdb

    n=new particion
    p=primary partition

	Partition number=1
	first cylinder=1
	last cylinder=+32M
    w=save particion

2) Crear una tabla de particiones con, al menos, una partición


3) Crear los sistemas de archivos

        mke2fs /dev/sdb1


4) Copiar la mini distro al pendrive

	mkdir /mnt/dongle
	mount /dev/sdb1 /mnt/dongle
	cd /tinygentoo
	rm -rf /tinygentoo/usr/include /tinygentoo/usr/realtime/share/doc /tinygentoo/var/db/pkg
	cp -a * /mnt/dongle
	umount /mnt/dongle
	

5) Instalar grub en el pendrive

	grub
	grub> device (hd0) /dev/sdb
	grub> root (hd0,0)
	grub> setup (hd0)
	grub> quit

6) Borrar el archivo /boot/grub/e2fs_stage1_5 del pendrive

	mount /dev/sdb1 /mnt/dongle
	rm /mnt/dongle/grub/e2fs_stage1_5
	umount /mnt/dongle



****************************** ANEXOS *********************************
# cual opcion debo usar la 1 o la dos?????????????????? o ambas
ANEXO A                                                                         #significa que las opciones que esten tildadas con [*] deben ser destildas a excepcion de las                                                                             # que explicitamente  estan tildadas?????????????????????

1) Configuración del kernel para RTAI

    Processor Type and Features -> 
      [*] Generic x86 support - Better kernel performance on x86 architecture CPU's.
      [*] Preempt The Big Kernel Lock - Reduces latency of the kernel on desktop computers.
      [*] Interrupt pipeline - Prevent data disturbances
      [*] Math emulation - Emulates co-processor for loading point operations on old CPU's.
      [*] MTRR support
      [*] Compact VDSO support

    Kernel Hacking ->
      [ ] Compile the kernel with frame pointers

2) Configuración del kernel para Linux embeded

 Code maturity level options  ­­­> 
  [*] Prompt for development and/or incomplete code/drivers
 General setup  ­­­> 
  [*] Enable 16­bit UID system calls   
  [*] Optimize for size
  [*] Configure standard kernel features (for small systems)   ­­­>   
Note: if you are using uClibc 0.9.28 or older, you need to enable 16bit UID interfaces in the Linux kernel. This has 
been fixed in svn so newer uclibc's will use the 32 bit interfaces. 
You don't want HIGHMEM if you haven't 1G or more RAM. 
 Processor type and features ­­­> 
  (4GB) High Memory Support
  [*] MTRR (Memory Type Range Register) support
  [ ] Symmetric multi­processing support 
Enable this if you want normal hard disk support 
  Device Drivers ­­­> 
   ATA/IDE/MFM/RLL support  ­­­> 
    < > ATA/IDE/MFM/RLL support
What we need for reading from the USB stick to work: 
   SCSI support  ­­­> 
    <*> SCSI support
    <*>   SCSI disk support
Of course we need the following because we run with an initrd root filesystem: 
   Block devices  ­­­> 
   <*> RAM disk support
   (16) Default number of RAM disks
   (4096) Default RAM disk size (kbytes)
   [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
For networking remember to select the driver for the chipset of your NIC. Use lspci to find out what you've got. I have 
on­board nForce2 and some cheap PCI card with an RTL­8139 chip.  
   Network device support  ­­­> 
    < > Dummy net driver support
    Ethernet (10 or 100Mbit)  ­­­> 
     [*] Ethernet (10 or 100Mbit)
     [*]   EISA, VLB, PCI and on board controllers
      <m>     nForce Ethernet support (EXPERIMENTAL)
      <m>     RealTek RTL­8139 PCI Fast Ethernet Adapter support  
Keyboard support might be nice: 
   Input device support  ­­­> 
    [*]   Keyboards
'Cos we'd like to be able to actually do something (enabled and hidden by default if CONFIG_EMBEDDED is not set): 
   Character devices  ­­­> 
    [*] Virtual terminal
    [*]   Support for console on virtual terminal
    [*] Unix98 PTY support
We don't want X stuff: 
    < > /dev/agpgart (AGP Support)
    < > Direct Rendering Manager 
Use lspci ­v | grep HCI to see what ?HCI drivers you want. lspci is part of sys­apps/pciutils  
   USB support  ­­­> 
    <*> Support for USB
    <*>   EHCI HCD (USB 2.0) support (EXPERIMENTAL)
    <*>   UHCI Alternate Driver (JE) support
    <*>   OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support
    <*>   USB Mass Storage support
For rw access to a partiton on the USB stick that is accessable from Windows too select VFAT. 
  File systems  ­­­> 
   <M> DOS FAT fs support
   <M>   VFAT (Windows­95) fs support 
   [*] /proc file system support
   Native Language Support  ­­­> 
    <*> NLS ISO 8859­1  (Latin 1? Western European Languages) (NEW) 
  Console drivers  ­­­> 
  [*] VGA text console
   [*] Video mode selection support



ANEXO B:

Generación de imagen del entorno de desarrollo:

NOTA: EJECUTAR ESTAS INSTRUCCIONES FUERA DEL ENTORNO DE DESARROLLO

	cd /mnt/
	tar cvpf gentoo_uclibc.tar gentoo_uclibc/
	bzip2 -9 gentoo_uclibc.tar

 trabajo
