Changes between Version 42 and Version 43 of InitrdClienteSecondFileSystem


Ignore:
Timestamp:
May 30, 2011, 7:26:42 PM (13 years ago)
Author:
adv
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • InitrdClienteSecondFileSystem

    v42 v43  
    2424Mas info sobre "Using UnionFS: BusyBox and SquashFS together"  http://lwn.net/Articles/219827/
    2525
    26 == Instalación ==
    27 No realizar el proceso en un sistema en procucción.
    28 Se ha testado con éxito en la ubuntu server 32 bits 10.04, 10.04.2 y 10.10
    2926
    30 NOTA:  el instalador está en "http://www.opengnsys.es/browser/trunk/client/boot-tools/"
    31 {{{
    32 mv /opt/opengnsys/tftpboot/ogclient /opt/opengnsys/tftpboot/ogclient-old;
    33 svn checkout http://www.opengnsys.es/svn/trunk/client /tmp/opengnsys_installer/opengnsys/client/;
    34 find /tmp/opengnsys_installer/ -name .svn -type d -exec rm -fr {} \; 2>/dev/null;
    35 /tmp/opengnsys_installer/opengnsys/client/boot-tools/ogClientGeneratorV2.sh;
    36 }}}
    37 
    38 DEBUG en el proceso de instalación:
    39 {{{
    40 Continuar sin instalar grub  -> yes
    41 Congigura el console-data
    42 Introduce la clave pub de nuestro servidor(ejecutor del instalador) en el cliente. En el caso de que ya exista un .pub nos pregunta si generar uno nuevo o mantener (N)
    43 Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N)  ->   Y
    44 
    45 }}}
    46 
    47 
    48 El proceso que se ha indicado a continuación, genera los elementos del cliente OpenGnsys, basados en la versión de ubuntu que tengamos instalados (mismo kernel y distribución).
    49 
    50 /opt/opengnsys/tftpboot/ogclient/
    51  {{{
    52 ./ogvmlinuz   (el kernel)
    53 ./oginitrd.img  (el initrd)
    54 ./ogclient.img   (el sistema raiz, accesible como disco virtual usando schroot desde el host que lo generó, para ser actualizado)
    55 ./ogclient.sqfs  (el sistema raiz, comprimido para ser usado por los clientes OpenGnsys)
    56 }}}
    57 
    58 
    59 === Las fases de la instalación ===
    60  * Fase 1. Instalación en el equipo donde se ejecuta la instalación de software necesario.
    61  * Fase 2. Asignación de valores, como la versión del kernel, basados en los datos del S.O que ejecuta el instalador, que serán utilizados para generar el cliente.
    62  * Fase 3. Creación del sistema raiz (ogclient.img). Primero se crea un disco duro virtual, y se particiona -ogCleint2nFile()-. En la primera partición se genera un sistema operativo con la herramienta deboobstrap -ogClient2ndFs()-, con parametros basados en la fase2.
    63  * Fase 4. Se configura el acceso al sistema raiz (ogclient.img) para ser usado con la herramienta schroot  -ogClientSchrootConf()-
    64  * Fase 5. Se configura o se incluyen los elementos especiales de opengnsys (engine, QTEmbbedbed, pci.ids, browser, ogAdmClient).   -ogClient2ndSVN()-
    65  * Fase 6. Ampliación del sistema raiz -- instalación de software con apt, compilación de algunas herramientas, importación de la clave ssh desde el SO que lo generó.
    66  * Fase 7. Generación del initrd.
    67  * Fase 8. Generación del sistema raiz en sqfs.
    68 
    69 == Incorporación del fichero .sqfs (proceso instalación de OpenGnsys) en un fichero .img para su posterior modificación ==
    70 NOTA: este subapartado no está terminado de documentar
    71 
    72 NOTA: este procedimiento se ha comprobado en una ubuntu server 10.04 32bits.
    73 
    74 {{{
    75 export OGCLIENTBASEDIR=/var/lib/tftpboot/ogclient/;
    76 export OGCLIENTFILE=${OGCLIENTBASEDIR}ogclient.img;
    77 export OGCLIENTMOUNT=${OGCLIENTBASEDIR}ogclientmount;
    78 export OGCLIENTSIZEMB=1900;
    79 export OGCLIENTLABEL=ogClient;
    80 
    81 mkdir -p $OGCLIENTMOUNT;
    82 dd if=/dev/zero of=$OGCLIENTFILE bs=1048576 count=$OGCLIENTSIZEMB;
    83 DISKLOOP=$(losetup -f);
    84 losetup $DISKLOOP $OGCLIENTFILE;
    85 echo -e "n\np\n1\n\n\nt\n83\nw" | fdisk $DISKLOOP;
    86 losetup -d $DISKLOOP ;
    87 PARTLOOP=$(losetup -f);
    88 losetup -o 32256 $PARTLOOP $OGCLIENTFILE && mkfs.ext3 -b 4096 -L $OGCLIENTLABEL $PARTLOOP;
    89 losetup -d $PARTLOOP ;
    90 losetup -d $PARTLOOP ;
    91 
    92 mount | grep $OGCLIENTMOUNT || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256;
    93 
    94 unsquashfs  -d /opt/opengnsys/tftpboot/ogclient/ogclientmount/ -f /opt/opengnsys/tftpboot/ogclient/ogclient.sqfs ;
    95 umount $OGCLIENTMOUNT;
    96 echo "fin";
    97 
    98 
    99 
    100 cp /etc/schroot/schroot.conf /etc/schroot/schroot.conf.`getDateTime`
    101 cat << EOF > /etc/schroot/schroot.conf
    102 [IMGogclient]
    103 type=loopback
    104 file=/var/lib/tftpboot/ogclient/ogclient.img
    105 description=ogclient ubuntu luc IMGi
    106 priority=1
    107 users=root
    108 groups=root
    109 root-groups=root
    110 mount-options=-o offset=32256
    111 root-users=root
    112 [DIRogclient]
    113 type=directory
    114 directory=/var/lib/tftpboot/ogclient/ogclientmount
    115 description=ogclient ubuntu lucid DIR
    116 priority=2
    117 users=root
    118 groups=root
    119 root-groups=root
    120 root-users=root
    121 EOF
    122 cp /etc/schroot/mount-defaults /etc/schroot/mount-defaults.`getDateTime`
    123 cat << EOF > /etc/schroot/mount-defaults
    124 # mount.defaults: static file system information for chroots.
    125 # Note that the mount point will be prefixed by the chroot path
    126 # (CHROOT_PATH)
    127 #
    128 # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    129 proc            /proc           proc    defaults        0       0
    130 #procbususb      /proc/bus/usb   usbfs   defaults        0       0
    131 #/dev            /dev            none    rw,bind         0       0
    132 /dev/pts        /dev/pts        none    rw,bind         0       0
    133 /dev/shm        /dev/shm        none    rw,bind         0       0
    134 #/home          /home           none    rw,bind         0       0
    135 /tmp            /tmp            none    rw,bind         0       0                                                               
    136 EOF
    137 
    138 
    139 }}}
    140  
    141 
    142 
    143 == Modificaciones al cliente ==
    144 
    145 === Pasos previos: ===
    146 {{{
    147 mkdir -p /tmp/opengnsys_installer/opengnsys/client/boot-tools;
    148 svn checkout http://www.opengnsys.es/svn/trunk/client/boot-tools /tmp/opengnsys_installer/opengnsys/client/boot-tools;
    149 source /tmp/opengnsys_installer/opengnsys/client/boot-tools/ogClientManager.lib
    150 }}}
    151 
    152 
    153 === Generar un nuevo initrd, con nuestras "locales", y almacenarlos en el /opt/opengnsys/tftpboot/ogclient/ ===
    154 {{{
    155 #Solicitamos que se monte el sistema root (img), y configuere los locales.
    156 schroot -c IMGogclient  -- /root/ReconfigureLocales.sh
    157 #Solicitamos que se monte el sistema root (img), y cree el initrd y el kernel
    158 ogClientInintrd host
    159 #almacenara el kernel y el initrd en /var/lib/tftpboot/ogclient/{ogvmlinuz oginitrd.img}
    160 }}}
    161 
    162 
    163 === Copiar nuevos archivos al sistema raiz del cliente (ogclient.img) ===
    164 
    165 Cualquier archivo extra, que queramos añadir al sistema raiz del cliente, tenemos el directorio /tmp compartido entre el SO y el ogclient.
    166 {{{
    167 #Accedemos a la consola shell del  sistema root del cliente (img)
    168 schroot -c IMGogclient
    169 #Realizamos todas las modificaciones que queramos. el directorio /tmp es compartido tanto por nuestro ordenador, como por el sistema root del cliente (img)
    170 cp /tmp/ficheroOGSERVER.txt  /home/opengnsys/ficheroEnOGclient.txt
    171 # Salimos del sistema root del cliente (img)
    172 exit
    173 }}}
    174 
    175 
    176 === Generar un nuevo initrd, con un nuevo proceso de inicio de OpenGnsys ===
    177 {{{
    178 schroot -c IMGogclient
    179 #editamos el proceso de inicio
    180 vi /etc/initramfs-tools/scripts/oginit
    181 #editamos las funciones del proceso de inicio
    182 vi /initramfs-tools/scripts/ogfunctions
    183 # o copiamos uno actualizado.
    184 cp /tmp/oginit /etc/initramfs-tools/scripts/oginit
    185 # o añadimos uno inicio alternativo
    186 cp /tmp/oginit2 /etc/initramfs-tools/scripts/oginit2
    187 
    188 exit
    189 
    190 ogClientInitrd host
    191 
    192 
    193 }}}
    194 
    195 
    196 
    197 === Instalar nuevas herramientas en el sistema raiz del (ogclient.img) ===
    198 
    199 {{{
    200 schroot -c IMGogclient
    201 apt-get install python3
    202 exit
    203 }}}
    204 
    205 
    206 === Generar un nuevo sistema raiz en formato sqfs (ogclient.sqfs)  ===
    207 {{{
    208 ogClient2ndSqfs
    209 }}}
    210 
    211 
    212 
    213 
    214 === Integrar drivers de tarjetas de red  ===
    215 http://www.opengnsys.es/wiki/InitrdClienteNetModules
    216 
    217 
    218 
    219 == Parametros usados por el kernel ==
    220 * http://www.opengnsys.es/browser/trunk/client/boot-tools/kernelParameterOG.es.txt
    221 
    222 
    223 == SVN del código ==
    224 * http://www.opengnsys.es/browser/trunk/client/boot-tools/
    225 
    226 Proceso de inicio:
    227 * http://www.opengnsys.es/browser/trunk/client/boot-tools/clientstructure/etc/initramfs-tools/scripts
    228 * http://www.opengnsys.es/browser/trunk/client/boot-tools/clientstructure/etc/inittab
    229 
    230 modificaciones del initrd.
    231 * http://www.opengnsys.es/browser/trunk/client/boot-tools/clientstructure/etc/initramfs-tools/hooks
    232 
    233 
    234 == Notas sobre uso con samba ==
    235 http://www.opengnsys.es/browser/branches/eac-hidra-uma/Testing/etc/smb.conf.txt
    236 
    237 
    238