Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on the Plurall project.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
#   (find-eev-quick-intro)
#   http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/plurall.e>
#           or at <http://angg.twu.net/e/plurall.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######






# «.thinstation»		(to "thinstation")
# «.devil-linux»		(to "devil-linux")
# «.devil-linux-lfs»		(to "devil-linux-lfs")
# «.mailing-lists»		(to "mailing-lists")
# «.itens-desenvolvimento»	(to "itens-desenvolvimento")
# «.diagrama»			(to "diagrama")
# «.downloading-the-iso»	(to "downloading-the-iso")
# «.opening-the-iso»		(to "opening-the-iso")
# «.2007aug29-ricardo»		(to "2007aug29-ricardo")
# «.network-boot-floppy»	(to "network-boot-floppy")
# «.fdisk»			(to "fdisk")
# «.losetup-o»			(to "losetup-o")
# «.mke2fs-blocks-count»	(to "mke2fs-blocks-count")
# «.loop-fdisk-mke2fs»		(to "loop-fdisk-mke2fs")
# «.plurall-iso-as-partition»	(to "plurall-iso-as-partition")
# «.isolinux»			(to "isolinux")
# «.compact-flash-dmesg»	(to "compact-flash-dmesg")
# «.compact-flash-dd»		(to "compact-flash-dd")
# «.compact-flash-grub»		(to "compact-flash-grub")
# «.compressed-flash-images-angg»	(to "compressed-flash-images-angg")

# «.unpack-hdc-grub0.gz»	(to "unpack-hdc-grub0.gz")
# «.check-hdc-grub0.gz-offsets»	(to "check-hdc-grub0.gz-offsets")
# «.copy-plurall.iso-to-hdc2»	(to "copy-plurall.iso-to-hdc2")
# «.mount-hdc1»			(to "mount-hdc1")
# «.mount-hdc2»			(to "mount-hdc2")
# «.extract-vmlinuz»		(to "extract-vmlinuz")
# «.extract-initrd»		(to "extract-initrd")
# «.mount-initrd»		(to "mount-initrd")
# «.extract-linuxrc»		(to "extract-linuxrc")
# «.compare-linuxrc-linuxrc2»	(to "compare-linuxrc-linuxrc2")
# «.tarcp-initrd-to-initrd2»	(to "tarcp-initrd-to-initrd2")
# «.umount-initrd»		(to "umount-initrd")
# «.mkinitrd-initrd2»		(to "mkinitrd-initrd2")
# «.prepare-hdc1-boot-dir»	(to "prepare-hdc1-boot-dir")
# «.umount-hdc1»		(to "umount-hdc1")
# «.umount-hdc2»		(to "umount-hdc2")
# «.run-qemu-on-hdc»		(to "run-qemu-on-hdc")
# «.copy-hdc-to-plurallflash.img»  (to "copy-hdc-to-plurallflash.img")
# «.copy-plurallflash.img-to-pen-drive»  (to "copy-plurallflash.img-to-pen-drive")

# «.problem-with-menu.lst»	(to "problem-with-menu.lst")
# «.problem-with-mkcramfs»	(to "problem-with-mkcramfs")
# «.in-the-initrd-shell»	(to "in-the-initrd-shell")
# «.ramroot»			(to "ramroot")
# «.hddimg»			(to "hddimg")





#####
#
# Thinstation
# 2007aug27
#
#####

# «thinstation»  (to ".thinstation")
# http://thinstation.sourceforge.net/CF-HOWTO.html
# http://thinstation.sourceforge.net/docs/build.conf.example
# http://thinstation.sourceforge.net/faq.html
# http://thinstation.sourceforge.net/wiki/index.php/ThDocs
# http://thinstation.sourceforge.net/wiki/index.php/ThDownload#TOM
# http://thinstation.sourceforge.net/wiki/index.php/ThIndex
# http://thinstation.sourceforge.net/wiki/index.php/ThLinks
# http://thinstation.sourceforge.net/wiki/index.php/ThMailing
# https://lists.sourceforge.net/lists/listinfo/thinstation-general

# (find-fline "~/.psne.log")
# (find-sh "grep -i thin ~/.psne.log | sort")
# (code-c-d "thinstationsite" "$S/http/thinstation.sourceforge.net/")
# (find-thinstationsitefile "")
# (find-thinstationsitew3m "faq.html")
# (find-thinstationsitew3m "faq.html" "thinstation.conf-<MAC ADDRESS>")

# (find-w3m "$S/http/thinstation.sourceforge.net/faq.html" "To build your own image")

# http://ufpr.dl.sourceforge.net/sourceforge/thinstation/Thinstation-2.2.tar.gz
#*
rm -Rf ~/bigsrc/Thinstation-2.2
tar -C ~/bigsrc/ -xzf \
  $S/http/ufpr.dl.sourceforge.net/sourceforge/thinstation/Thinstation-2.2.tar.gz
cd     ~/bigsrc/Thinstation-2.2

#*
# (code-c-d "thinstation" "~/bigsrc/Thinstation-2.2/")
# (find-thinstationfile "")
# (find-thinstationfile "build")
# (find-thinstationfile "build" "$TOOLSDIR/mknbi/mkelf-linux")




#####
#
# thinstation-src
# 2007sep03
#
#####

# Acho que não preciso disso...
# O script "build" não está aqui, está no "Thinstation-2.2".

# http://ufpr.dl.sourceforge.net/sourceforge/thinstation/thinstation_src-2.2.tar.bz2
#*
rm -Rf ~/bigsrc/thinstation_src-2.2
tar -C ~/bigsrc/ -xjf \
  $S/http/ufpr.dl.sourceforge.net/sourceforge/thinstation/thinstation_src-2.2.tar.bz2
cd     ~/bigsrc/thinstation_src-2.2

#*
# (code-c-d "thinstationsrc" "~/bigsrc/thinstation_src-2.2/")
# (find-thinstationsrcfile "")
# (find-thinstationsrcfile "root/.bash_history")
# (find-thinstationsrcfile "RUNME")
# (find-thinstationsrcfile "bin/start.sh")

* (eepitch-shell)
cd ~/bigsrc/thinstation_src-2.2/
find * | sort > /tmp/thinstation-src.lst
# (find-fline "/tmp/thinstation-src.lst")
# (find-sh "grep build /tmp/thinstation-src.lst")





#####
#
# mknbi (from the debian sources)
# 2007sep03
#
#####

# «mknbi-deb-src»
# http://ftp.debian.org/debian/pool/main/m/mknbi/
# http://ftp.debian.org/debian/pool/main/m/mknbi/mknbi_1.4.4-1.dsc
# http://ftp.debian.org/debian/pool/main/m/mknbi/mknbi_1.4.4-1.diff.gz
# http://ftp.debian.org/debian/pool/main/m/mknbi/mknbi_1.4.4.orig.diff.gz

* (eepitch-shell)
psne http://ftp.debian.org/debian/pool/main/m/mknbi/mknbi_1.4.4-1.dsc
psne http://ftp.debian.org/debian/pool/main/m/mknbi/mknbi_1.4.4-1.diff.gz
psne http://ftp.debian.org/debian/pool/main/m/mknbi/mknbi_1.4.4.orig.tar.gz

#*
rm -Rv ~/usrc/mknbi/
mkdir  ~/usrc/mknbi/
cd $S/http/ftp.debian.org/debian/pool/main/m/mknbi/
cp -v mknbi_1.4.4* ~/usrc/mknbi/
cd     ~/usrc/mknbi/
dpkg-source -sn -x mknbi_1.4.4-1.dsc
cd     ~/usrc/mknbi/mknbi-1.4.4/
dpkg-buildpackage -us -uc -b -rfakeroot     |& tee odb

#*
# (find-fline "~/usrc/mknbi/")
* (eepitch-shell)
cd ~/usrc/mknbi/
sudo dpkg -i *.deb

#*
# (code-c-d "mknbi" "~/usrc/mknbi/mknbi-1.4.4/")
# (find-mknbifile "")
# (find-mknbifile "README")
# (find-mknbifile "Elf.pm")
# (find-mknbifile "Nbi.pm")
# (find-mknbifile "luabuild/")
# (find-mknbifile "scripts/")
# (find-mknbifile "scripts/mkfd-nbi.sh")









#####
#
# Devil Linux
# 2007aug27
#
#####

# «devil-linux»  (to ".devil-linux")
# http://www.devil-linux.org/home/index.php
# http://ufpr.dl.sourceforge.net/sourceforge/devil-linux/devil-linux-1.2.13-i686-SMP-server.tar.bz2
#*
rm -Rf ~/bigsrc/devil-linux-1.2.13-i686-SMP/
tar -C ~/bigsrc/ -xvjf \
  $S/http/ufpr.dl.sourceforge.net/sourceforge/devil-linux/devil-linux-1.2.13-i686-SMP-server.tar.bz2
cd     ~/bigsrc/devil-linux-1.2.13-i686-SMP/

#*
* (eepitch-shell)
sudo umount /tmp/devilinitrd/
sudo umount /tmp/devilboot

#*
mkdir /tmp/devilboot/
sudo mount -o ro,loop ~/bigsrc/devil-linux-1.2.13-i686-SMP/bootcd.iso \
      /tmp/devilboot/
zcat  /tmp/devilboot/boot/initrd.gz > /tmp/devilinitrd.img
mkdir /tmp/devilinitrd/
sudo mount -o ro,loop /tmp/devilinitrd.img \
      /tmp/devilinitrd/

#*
# (code-c-d "devil" "~/bigsrc/devil-linux-1.2.13-i686-SMP/")
# (code-c-d "devilboot"   "/tmp/devilboot/")
# (code-c-d "devilinitrd" "/tmp/devilinitrd/")
# (find-devilfile "")
# (find-devilfile "install-on-usb")
# (find-devilfile "custom-cd")
# (find-devilbootfile "")
# (find-devilbootfile "isolinux.cfg")
# (find-devilbootfile "boot/message")
# (find-devilbootfile "boot/")
# (find-devilinitrdfile "")
# (find-devilinitrdfile "linuxrc")

cd /tmp/devilboot/ && sudo find | sort > /tmp/devilboot.lst
cd /tmp/plurall/   && sudo find | sort > /tmp/plurall.lst
# (find-fline "/tmp/devilboot.lst")
# (find-fline "/tmp/plurall.lst")

# (find-bgprocess "tkdiff /tmp/devilboot.lst /tmp/plurall.lst")


mkdir /tmp/plurall/
sudo mount -o ro,loop ~/PLURALL/plurall_freenx_0.9.5_rc3.iso \
  /tmp/plurall/
  
# (find-sh0 "ls -lH ~/PLURALL/plurall_freenx_0.9.5_rc3.iso")
# (find-status   "genisoimage")
# (find-vldifile "genisoimage.list")
# (find-udfile   "genisoimage/")
# (find-status   "mkisofs")
# (find-vldifile "mkisofs.list")
# (find-udfile   "mkisofs/")
# (find-man "1 mkzftree")
# (find-man "8 mkisofs" "compressed")
# (find-man "8 isosize")





#####
#
# devil-linux-lfs
# 2007sep03
#
#####

# «devil-linux-lfs»  (to ".devil-linux-lfs")
# Não use este bloco! Antes do Ricardo me mostrar como é que ele
# criava uma imagem do Plurall a partir de um Devil Linux eu tentei
# pegar uma imagem qualquer do site do Devil Linux e abrí-la pra ver
# se eu descobria alguma coisa... E não descobri muito não :-/.

# ftp://ftp.devil-linux.org/pub/devel/sources/lfssystem-for-DL-1.3.4_and_up/lfssystem-SVN-20070314-cleaned.tar.bz2
#*
rm -Rfv /tmp/devil/
mkdir  /tmp/devil/
tar -C /tmp/devil/ -xvjf \
  $S/ftp/ftp.devil-linux.org/pub/devel/sources/lfssystem-for-DL-1.3.4_and_up/lfssystem-SVN-20070314-cleaned.tar.bz2

#*
# (code-c-d "devil" "/tmp/devil/lfssystem/")
# (find-devilsh "find * | sort")

# 2007sep03






#####
#
# mailing lists
# 2007aug24
#
#####

# «mailing-lists»  (to ".mailing-lists")
http://listas.plurall.net/listinfo.cgi/usuarios-plurall.net
http://listas.plurall.net/private.cgi/usuarios-plurall.net/




# (find-fline "/etc/fstab")

* (eepitch-shell)
mkdir /tmp/cdrom/
mount /tmp/cdrom/
cd /tmp/cdrom
sudo find > /tmp/of
umount /tmp/cdrom

* (eepitch-shell)
R
cat /dev/hdd > /dvds/plurall-0.9.5.rc3.iso
exit
#*
mkdir /tmp/plurall/
sudo mount -o ro,loop /dvds/plurall-0.9.5.rc3.iso /tmp/plurall/
cd /tmp/plurall/

#*
du -c
du -c | sort -n

# (find-fline "/tmp/plurall/")

sudo umount /tmp/plurall/


# (find-fline "/tmp/of")







#####
#
# Implementing Thin clients with Thinstation (Leandro Calumby)
# 2007aug22
#
#####

# http://listas.plurall.net/private.cgi/usuarios-plurall.net/
# http://listas.plurall.net/private.cgi/usuarios-plurall.net/2007-August/000001.html
# (find-fline    "~/PLURALL/")
# (find-xpdfpage "~/PLURALL/Implementing-thin-clients.pdf")
# (code-xpdf      "implthincl" "~/PLURALL/Implementing-thin-clients.pdf")
# (code-pdftotext "implthincl" "~/PLURALL/Implementing-thin-clients.pdf")
# (find-implthinclpage 1)
# (find-implthincltext)


      How-to implemenging Thin clients with Thinstation   Leandro Calumby

            Implementing Thin clients with Thinstation

  6.1.1.     Thinclients (Etherboot)

  Creating the thin-client boot-disk

     1.   Open a DOS window
     2.   Go inside the 'BootDisk\' folder
     3.   Insert a clean and formatted floppy in your drive
     4.   Launch:
                rawrite2 -d A -f ebnet522.dsk

6.2. Linux Server

  6.2.1      Requirements programs


  6.2.2      Configuring DHCP Server

     1. Edit the /etc/dhcpd.conf file to configure DHCP Server.
             subnet 192.168.0.0 netmask 255.255.255.0 {
               range 192.168.0.100 192.168.0.250;
               default-lease-time 86400;
               max-lease-time 86400;
               option routers 192.168.0.254;
               option ip-forwarding on;
               option broadcast-address 192.168.0.255;
               option subnet-mask 255.255.255.0;
               option domain-name-servers <DNS server IP>, <DNS
             server IP>;
               next-server <application server IP>;
             filename </tftpboot/thinstation.nbi>  path of the
             thinstation.nbi file
             }
     2. Start DHCP Server "/etc/init.d/dhcpd start"

  6.2.3      Configuring TFTP Server

     1. Create a directory for the files: "mkdir /tftpboot"
     2. Set owner for this directory "chown nobody:nobody
        /tftpboot"
     3. Edit the file "/etc/xinetd.d/tftp"
             service tftp
             {
                              socket_type      = dgram
                   protocol      = udp
                   wait          = yes
--------
            How-to implemenging Thin clients with Thinstation   Leandro Calumby
                         user          =   root
                         server        =   /usr/sbin/in.tftpd
                         server_args   =   -c -s /tftpboot
                         disable       =   no
                         per_source    =   11
                         cps           =   100 2
                  }
        4. Restart xinetd service "/etc/init.d/xinetd restart"

     6.2.4       Configuring XDMCP Server

        1.   Edit the /etc/X11/xdm/Xaccess file
        2.   Uncomment the line that contains "*".
        3.   Edit the /etc/X11/xdm/xdm-config file
        4.   Change the port to 177 on last line.

     6.2.5       Configuring thinstation.conf for XDMCP

        1. Uncomment these lines:
                SESSION_0_TYPE="x"
                                                    put here the
                SESSION_0_SERVER= "<server IP>"
             application server IP address
                SESSION_0_OPTIONS=
                X_FONT_SERVER="<font server name>:7100"  put here the
             font server
        2. Setting these lines to configure to terminal Display:
                 X_RESOLUTION="800x600"
                    X_COLOR_DEPTH=8
                 X_HORIZSYNC="30-64"
                    X_VERTREFRESH="56-87"

   6.3. Windows 2000 Server or Windows 2003 Server

     6.3.1.      Requirements programs:

     To implementation this solution, is necessary to add programs in
the Windows 2000 Server.

             DHCP Server

             Remote installation Service

             Terminal Service

--------
    How-to implemenging Thin clients with Thinstation   Leandro Calumby

6.3.2.   Basic configuration of a DHCP Server

Adding a DHCP server

  1. Open DHCP console using (Start/Programs/Administrative
     Tools/DHCP)
  2. Click in "Action" menu and select "Add Server"
  3. On the window "Add server" click "Browse"
  4. On the window "Select Computer" click "Advanced"
  5. On the window "Select Computer" click "Find Now"
  6. Select DHCP server and click "OK"
  7. Click "Ok" in all windows

6.3.3.   Configuring new scope

  1. Right-click Server icon and select "New Scope" from de fly-
     out menu.
  2. The "scope new" window opens. Give the scope a name
     and description that can help you identify it when it
     displays in the console and click "Next"
  3. The "IP Address Range" window opens. Enter an address
     range and subnet mask for the scope and click "Next"
  4. On "Add Exclusions" window click "Next"
  5. On "Lease Duration" window click "Next"
  6. On "Configure DHCP Options" windows mark "Yes, I want
     configure these options now" and click "Next"
  7. On "Router" window, insert the Default Gatway from your
     network and click "Add", after click "Next".
  8. On "Domain Name and DNS Servers" window, insert the
     DNS Server IP from your network and click "Add", after
     click on "Next".
  9. On "WINS Server" window click "Next".
  10.       On "Activate Scope" window mark "Yes, I want to
     activite this scope now" and click on "Next"
  11.       Click on "Finish" to finish scope configuration.
--------
    How-to implemenging Thin clients with Thinstation   Leandro Calumby

6.3.4.   Configuring DHCP Server for remote-boot (TFTP)

  1. On DHCP (Start/Programs/Administrative Tools/DHCP)
     select the server, and select the scope created and click
     give a Right-click on folder "Scope Options" and chose the
     option "Configure Options"
  2. Select option "066 Boot Server Host Name". Enter the IP of
     the Application Server.
  3. Select option "067 Bootfile Name". Enter the name of boot
     file "thinstation.nbi".

6.3.5.   Installing and configuring TFTP Server

  1. Click (Start | Settings | Control Panel | Add and Remove
     programs)
  2. Click "Add/Remove windows components" to start
     "Windows Components Wizard".
  3. Select "Remote Installation"
  4. Click "Finish" to finish.
  5. Restart the computer after installation.
  6. After installation, click (Start | Programs | Administrative
     Tools | Services).
  7. Verify if "Trivial FTP service" started.
  8. Copy the files "thinstation.nbi" and "thinstation.conf" to
     folder "C:\tftproot".

6.3.6.   Installing Windows 2000 Terminal Service

  1. Click (Start | Settings | Control Panel | Add and Remove
     programs)
  2. Click "Add/Remove windows components" to start
     "Windows Components Wizard".
  3. Select "Terminal Server" and click "Next"
  4. Click "Next" to continue
  5. On "terminal Server Setup" window select "Application
     Server" and click "Next"
  6. On "Windows Permission" window select "Compatible User
     Permissions with Windows 2000"
  7. Restart the computer.
--------
    How-to implemenging Thin clients with Thinstation   Leandro Calumby

6.3.7.   Configuring Thinstation.conf Windows Terminal Server

  1. Uncomment these lines:
          SESSION_1_TYPE="rdesktop"
                                                 put here the
          SESSION_1_SERVER= "<server IP>"
          application server IP address
          SESSION_1_OPTIONS=
  2. Setting these lines to configure to terminal Display:
          X_RESOLUTION="800x600"
          X_COLOR_DEPTH=8
          X_HORIZSYNC="30-64"
          X_VERTREFRESH="56-87"
--------





#####
#
# Itens em desenvolvimento atualmente
# 2007aug24
#
#####

# «itens-desenvolvimento»  (to ".itens-desenvolvimento")

Itens em Desenvolvimento Atualmente:
Programação combinada em 1/8/2007:
Dado, Ricardo, Eduardo e Raul

1 - Flash/IDE no Servidor de Boot
     (Ricardo vai detalhar...... )

2 - Etherboot especial em Flash/IDE nos terminais
     (Ricardo vai detalhar...... - syslinux/grub - eb-net.lil)

3 - Local Storage Mount nos Terminais
     Incluir NFS na imagem NBI,
     descobrir como os automounters montam pen drives
     fazer cada terminal avisar pra maquina central os mounts e umounts
     associar o usuario logado num terminal ao "nome" do terminal

4 - Script setup Plurall
     Fazer uma variacao mais simples do script em dialog que configura o
     Devil Linux; gravar a configuracao numa imagem de floppy na flash

5 - Plurall Client com mais drivers
     (Ricardo vai fazer junto com todo mundo - mexer na configuracao
     da thinstation e gerar uma nova imagem thinstation.nbi mas não
     deve incluir ainda a detecção automática dos modelos de placas)

Depois:

  - Boot EPROM Etherboot
  - Local audio nos terminais
  - ubuntu custom installer



Features Wish List:

    * Opção para terminais sem login/password
    * Storage Local nos terminais

Pen Drives
CDRW
HD Local (not-so-thin client :)

    * WiFi LAN protegida e encriptada (hoje é aberta/pública)
    * Instalador custom pro Ubuntu com configurações Plurall

IP fixo pra Eth0
Português

    *



#####
#
# Diagrama
# 2007aug24
#
#####

# «diagrama»  (to ".diagrama")
# (find-orgfile "plurall.org")

					       ____________
			  mundo       	      |	       	   | [CD|HD|Flash com:]
                     	 exterior ------------|	 Servidor  | Plurall	  
                     			      |	 de boot   |  DHCP server 
                                              |	           |  TFTP server
   _______________              ________      |	           |  /config/
  |               |            |        |-----|		   |   thinstation.nbi
  |  Servidor de  |------------| switch |     |            | 
  |  Aplicação    |            |________|     |____________|   
  |               |              |    \\________________
  |               |    __________|_    \____________    \____________
  |               |   |            |   |            |   |            |
  |               |   |  Terminal  |   |  Terminal  |   |  Terminal  |
  |               |   |    (T1)    |   |    (T2)    |   |    (T3)    |
  |_______________|   |____________|   |____________|   |____________|
   (HD com:)           
    Ubuntu 6.06        Thinstation
     XDMCP               XDMCP
     Freenxserver        Freenx
                         X
                         rdesktop
                         samba


/config/thinstation.nbi
# (find-fline "/tmp/plurall/config/")

/usr/bin/plsetup   <- não achei






#####
#
# plurall.org (an org-mode file containing notes)
# 2007aug24
#
#####

# (find-fline "/edrx@angg.twu.net:")
* (eepitch-eshell)
cp -v /edrx@angg.twu.net:/home/twu/users/edrx/plurall.org /tmp/
Scp    edrx@angg.twu.net:/home/twu/users/edrx/plurall.org /tmp/
# (find-orgfile "plurall.org")




#####
#
# downloading the iso
# 2007aug24
#
#####

# «downloading-the-iso»  (to ".downloading-the-iso")
# www.plurall.net
# http://www.plurall.net/joomla-10/index.php?option=com_vfm&Itemid=21&do=view&file=plurall_freenx_0.9.5_rc3.iso
# http://www.plurall.net/joomla-10/index.php?option=com_vfm&Itemid=21&do=download&file=plurall_freenx_0.9.5_rc3.iso

* (eepitch-shell)
cd /tmp/
wget 'http://www.plurall.net/joomla-10/index.php?option=com_vfm&Itemid=21&do=download&file=plurall_freenx_0.9.5_rc3.iso'

# (find-node "(wget)Invoking")

mkdir ~/PLURALL/
# plurall_freenx_0.9.5_rc3.iso





#####
#
# opening the iso
# 2007aug24
#
#####

# «opening-the-iso»  (to ".opening-the-iso")
# (find-fline "~/PLURALL/" "plurall_freenx_0.9.5_rc3.iso")
# ~/PLURALL/plurall_freenx_0.9.5_rc3.iso

* (eepitch-shell)
sudo umount /tmp/plurall/
mkdir /tmp/plurall/
sudo mount -o ro,loop ~/PLURALL/plurall_freenx_0.9.5_rc3.iso /tmp/plurall/

# (find-fline "/tmp/plurall/")
# (find-fline "/tmp/plurall/config/")
# (find-sh "cd /tmp/plurall/; find * | sort")
# (find-sh "cd /tmp/plurall/; find * | sort | grep nbi")
# (find-sh "cd /tmp/plurall/; find * | sort | grep tftp")

cd /tmp/plurall/
cp -v config/thinstation.nbi ~/PLURALL/

* (eepitch-shell)
cd ~/PLURALL/
file thinstation.nbi
# thinstation.nbi: ELF 32-bit LSB executable, Intel 80386, version 1
#   (embedded), statically linked, stripped

mkdir /tmp/thinstation/
sudo mount -o ro,loop ~/PLURALL/thinstation.nbi /tmp/thinstation/
# ^ nao funcionou

# (find-fline "/tmp/plurall/config/etc.tar.bz2" "etc/tftpd/thinstation.conf.network")

rm -Rv ~/PLURALL/etc/
tar -C ~/PLURALL/ -xvjf /tmp/plurall/config/etc.tar.bz2

# (find-fline "~/PLURALL/etc/tftpd/thinstation.conf.network")

# (code-c-d "plet" "~/PLURALL/etc/tftpd/")
# (find-pletfile "thinstation.conf.network")
# (find-pletfile "thinstation.conf.network" "192.168.100.201")





#####
#
# Notas de uma conversa com o Ricardo (na sala do Dado)
# 2007aug29
#
#####

# «2007aug29-ricardo»  (to ".2007aug29-ricardo")
# http://sourceforge.net/project/showfiles.php?group_id=34096
# (find-fline "c:/home/zip/")
# devil-linux-1.2.13-i486.tar
# http://ufpr.dl.sourceforge.net/sourceforge/devil-linux/devil-linux-1.2.13-i686-SMP-server.tar.bz2
# http://ufpr.dl.sourceforge.net/sourceforge/devil-linux/

 (eepitch-eshell)
cd /home/
mv -v /home/zip/devil-linux-1.2.13-i486.tar
/home/zip/devil-linux-1.2.13-i486.tar.gz
cd /home/
/home/unxutils/tar -xzf /home/zip/devil-linux-1.2.13-i486.tar.gz

cd /home/zip/
/home/unxutils/gunzip devil-linux-1.2.13-i486.tar.gz
ls

unxutils/tar -xf /home/zip/devil-linux-1.2.13-i486.tar
# ^ putz, era bz2

Dentro do .tar.bz2 do devil:
 iso
 custom-cd  (script, na raiz)
 install-on-usb


os terminais estao usando etherboot em disquete
o ricardo diz que tem etherboot pra HD
o ricardo usou o devil 1.2.8 para i586


* 2007jun29: network_boot_floppy
* 2007jun29: thinstation
# (find-es "plurall" "thinstation")
# thinstation contribs
# http://ufpr.dl.sourceforge.net/sourceforge/thinstation/network_boot_floppy+cd+hd_540.zip
Ler o Readme

* 2007jun29: geração de NBIs
# http://ufpr.dl.sourceforge.net/sourceforge/thinstation/Thinstation-2.2.tar.gz
Script: build
 gera coisas no diretorio boot-images/etherboot/
   cria um thinstation.nbi

thinstation.nbi.zpxe

temos etherboot em floppy
perguntar deppois por mais links pro etherboot hackeado (que corta o
 final .zpxe)

# http://osdir.com/ml/network.thinstation.devel/2004-06/msg00106.html





#####
#
# network-boot-floppy
# 2007sep03
#
#####

# «network-boot-floppy»  (to ".network-boot-floppy")
# http://ufpr.dl.sourceforge.net/sourceforge/thinstation/network_boot_floppy+cd+hd_540.zip
#*
rm -Rv   ~/usrc/netbootfloppy/
mkdir    ~/usrc/netbootfloppy/
unzip -d ~/usrc/netbootfloppy/ \
  $S/http/ufpr.dl.sourceforge.net/sourceforge/thinstation/network_boot_floppy+cd+hd_540.zip
cd       ~/usrc/netbootfloppy/

#*
# (code-c-d "netbootfloppy" "~/usrc/netbootfloppy/")
# (find-netbootfloppyfile "")
# (find-netbootfloppyfile "Readme.txt")

# http://www.etherboot.org/wiki/index.php

# http://listas.plurall.net/listinfo.cgi/dev-plurall.net
# http://listas.plurall.net/private.cgi/dev-plurall.net/





#####
#
# fdisk
# 2007sep19
#
#####

# «fdisk»  (to ".fdisk")

# (find-esgrep "grep -nH -e fdisk *.e")
* (eepitch-shell)
R
sudo fdisk /dev/hda
p
m
u
p
q
exit

echo -e    "p\nq" | sudo fdisk /dev/hda
echo -e "u\np\nq" | sudo fdisk /dev/hda

# http://en.wikipedia.org/wiki/Mbr
# http://www.win.tue.nl/~aeb/partitions/partition_tables-2.html
# http://bochs.sourceforge.net/doc/docbook/user/loop-device-usage.html
# http://en.wikipedia.org/wiki/Extended_Boot_Record
# (find-man "8 losetup")
# (find-man "8 mount")
# (find-man "8 mount" "\nTHE LOOP DEVICE")
# (find-node "(coreutils)dd invocation")
# (find-sh "echo -e 'u\\np\\nq' | sudo fdisk /dev/hda")

#   /dev/hda1   *         63    62492849    31246393+  83  Linux
#   /dev/hda2       62492850    63488879      498015   82  Linux swap / Solaris
* (eepitch-shell)
sudo dd if=/dev/hda of=/tmp/foo bs=512 skip=63 count=20
file /tmp/foo
# -> /tmp/foo: Linux rev 1.0 ext3 filesystem data (needs journal recovery) (large files)
sudo dd if=/dev/hda of=/tmp/foo bs=512 skip=62492850 count=20
file /tmp/foo
# -> /tmp/foo: Linux/i386 swap file (new style) 1 (4K pages) size 124502 pages

# (find-man "8 mke2fs")
# (find-man "8 mke2fs" "blocks-count")


# sudo fdisk -C 4 /tmp/test.img


# (find-man "8 fdisk")
# 64 heads * 32 sectors * 512 bytes/sector = 1MB (per cylinder)
# (* 64 32 512)

* (eepitch-shell)
dd if=/dev/zero of=/tmp/test.img bs=1M count=17
sudo fdisk -C 17 -H 64 -S 32 /tmp/test.img
n
p
1

4
n
p
2

17
p
u
p
m
v
w

# (find-sh "echo -e 'u\\np\\nq' | sudo fdisk /tmp/test.img")
# 64 heads, 32 sectors/track, 0 cylinders, total 0 sectors
# Units = sectors of 1 * 512 = 512 bytes
#         Device Boot      Start         End      Blocks   Id  System
# /tmp/test.img1              32        8191        4080   83  Linux
# /tmp/test.img2            8192       34815       13312   83  Linux

sudo losetup -d $(cat /tmp/test.dev1)   2>&1 > /dev/null
sudo losetup -d $(cat /tmp/test.dev2)   2>&1 > /dev/null
sudo losetup -f | tee /tmp/test.dev1
sudo losetup -o   $[32*512] $(cat /tmp/test.dev1) /tmp/test.img
sudo losetup -f | tee /tmp/test.dev2
sudo losetup -o $[8192*512] $(cat /tmp/test.dev2) /tmp/test.img

sudo dd if=$(cat /tmp/test.dev1) of=/dev/foo1 bs=1024 count=4080 
sudo dd if=$(cat /tmp/test.dev2) of=/dev/foo2 bs=1024 count=13312 
sudo dd if=$(cat /tmp/test.dev2) of=/dev/foo2 bs=1024 count=13000

sudo mke2fs -b 1024 $(cat /tmp/test.dev1)  4080
y
mke2fs -b 1024 $(cat /tmp/test.dev2) 13312

# (find-man "8 mke2fs")
# (find-man "8 losetup")


-blocksize 1024 -size $[4080*2]


cat /tmp/test.dev1


losetup test.dev2 -o $[8192*512]
-blocksize 1024 -size $[13312*2]


losetup 



#####
#
# understanding losetup -o
# 2007sep25
#
#####

# «losetup-o»  (to ".losetup-o")
# (find-man "8 losetup" "--offset, -o offset")

* (eepitch-shell)
rm -v /tmp/test.img
dd if=/dev/zero of=/tmp/test.img bs=1M count=17
sudo losetup -f | tee /tmp/test.dev1
sudo losetup -o $[16*1024*1024] $(cat /tmp/test.dev1) /tmp/test.img
sudo losetup $(cat /tmp/test.dev1)
sudo dd if=/dev/zero of=$(cat /tmp/test.dev1) bs=1024 count=1024 ;# ok
sudo dd if=/dev/zero of=$(cat /tmp/test.dev1) bs=1024 count=1025 ;# error
sudo losetup -d $(cat /tmp/test.dev1)   2>&1 > /dev/null         ;# release loop

# ^ It works exactly as I expected: trying to write slightly more than
# 1MB starting at the offset 16MB of a 17MB device gives an error.



#####
#
# understanding mke2fs
# 2007sep25
#
#####

# «mke2fs-blocks-count»  (to ".mke2fs-blocks-count")
# (find-man "8 mke2fs")

* (eepitch-shell)
rm -v /tmp/test.img
dd if=/dev/zero of=/tmp/test.img bs=1M count=17
sudo losetup -f | tee /tmp/test.dev1
sudo losetup -o $[1*1024*1024] $(cat /tmp/test.dev1) /tmp/test.img
sudo dd if=/dev/zero of=$(cat /tmp/test.dev1) bs=$[1024*1024] count=16
sudo mke2fs -b 1024 -v $(cat /tmp/test.dev1) $[16*1024]
sudo losetup -d $(cat /tmp/test.dev1)   2>&1 > /dev/null         ;# release loop




#####
#
# fdisk and mke2fs on a loop device
# 2007sep25
#
#####

# «loop-fdisk-mke2fs»  (to ".loop-fdisk-mke2fs")
# (find-es "grub" "grub2-on-test.img")

* (eepitch-shell)
# Create a zeroed HD image with 20MB
rm -v /tmp/test.img
dd if=/dev/zero of=/tmp/test.img bs=1M count=20

# Create two primary partitions: 1st=4M, 2nd=16MB
sudo fdisk -C 20 -H 64 -S 32 /tmp/test.img
n
p
1

4

n
p
2

20
u
p
w

# Some notes about how to get the offsets for "losetup -o",
# and the sizes of the partitions for mke2fs...
# (find-sh "echo -e 'u\\np\\nq' | sudo fdisk /tmp/test.img")
# 64 heads, 32 sectors/track, 0 cylinders, total 0 sectors
# Units = sectors of 1 * 512 = 512 bytes
#         Device Boot      Start         End      Blocks   Id  System
# /tmp/test.img1              32        8191        4080   83  Linux
# /tmp/test.img2            8192       40959       16384   83  Linux
# Sizes, in 512-byte blocks:
# (list "/tmp/test.img1" (+   -32  8191 1) (*  4080 2))
# (list "/tmp/test.img2" (+ -8192 40959 1) (* 16384 2))

# Associate the full image to a loop device
# (grub-setup may need this)
sudo losetup -f | tee             /tmp/test.dev0
sudo losetup                $(cat /tmp/test.dev0) /tmp/test.img

# Associate the first partition to a loop device,
# clear it, make an ext2 filesystem there, mount it.
sudo losetup -f | tee             /tmp/test.dev1
sudo losetup -o $[512*32]   $(cat /tmp/test.dev1) /tmp/test.img
sudo dd if=/dev/zero     of=$(cat /tmp/test.dev1) bs=1024 count=4080
sudo mke2fs -b 1024      -v $(cat /tmp/test.dev1)               4080
mkdir                                             /tmp/dev1
sudo mount -o loop          $(cat /tmp/test.dev1) /tmp/dev1

# Associate the second partition to a loop device,
# clear it, make an ext2 filesystem there, mount it.
sudo losetup -f | tee             /tmp/test.dev2
sudo losetup -o $[512*8192] $(cat /tmp/test.dev2) /tmp/test.img
sudo dd if=/dev/zero     of=$(cat /tmp/test.dev2) bs=1024 count=16384
sudo mke2fs -b 1024      -v $(cat /tmp/test.dev2)               16384
mkdir                                             /tmp/dev2
sudo mount -o loop          $(cat /tmp/test.dev2) /tmp/dev2

df



# Now copy the grub files to /tmp/dev1/boot/grub/
# and install grub on MBR of the HD image.
# (Big mess - just notes that don't work)
R
mkdir /tmp/dev1/boot/
mkdir /tmp/dev1/boot/grub/
# ********
# (find-es "grub")
# (find-es "grub" "grub2")
# (find-es "grub" "device.map")
# (find-es "grub" "grub2-on-test.img")

* (eepitch-shell)
cd ~/usrc/grub2/
      ./grub-install /tmp/test.img --root-directory=/tmp/dev1/
sh -x ./grub-install /tmp/test.img --root-directory=/tmp/dev1/  |& tee osxgi
exit
R
sh -x ./grub-install /tmp/test.img --root-directory=/tmp/dev1/ --modules=ext2 |& tee osxgi
cat > /tmp/grub-probe.sh <<'%%%'
#!/bin/sh
if test "x$1" = "x--target=fs";      then echo ext2; exit; fi
if test "x$1" = "x--target=partmap"; then echo pc; exit; fi
exec ./ulocal/sbin/grub-setup $*
%%%
chmod 755 /tmp/grub-probe.sh
sh -x ./grub-install /tmp/test.img --root-directory=/tmp/dev1 --grub-probe=/tmp/grub-probe.sh |& tee osxgi2

# ******
# (find-grub2file "util/i386/pc/grub-setup.c")
# (find-grub2file "util/i386/pc/grub-setup.c" "OS device file")
# (find-grub2file "util/i386/pc/grub-setup.c" "Do the real work.")
# (find-grub2file "partmap/pc.c")
./grub-setup --help

# --grub-probe=


# (find-grub2file "")
# (find-grub2file "grub-install")
# (find-grub2file "osxgi")
# (find-grub2file "osxgi" "grub-probe --target=fs")
# (find-grub2file "util/grub-probe.c")
# (find-fline "/tmp/dev1/")
# (find-fline "/tmp/dev1/boot/grub/")
# (find-sh "mount")

# (find-grub2file "osxgi")
# ++ /home/edrx/usrc/grub2/ulocal/sbin/grub-probe --target=partmap --device-map=/tmp/dev1//boot/grub/device.map /tmp/dev1//boot/grub
# + /home/edrx/usrc/grub2/ulocal/bin/grub-mkimage --output=/tmp/dev1//boot/grub/core.img --prefix=/boot/grub ext2 _chain
# + /home/edrx/usrc/grub2/ulocal/sbin/grub-setup --directory=/tmp/dev1//boot/grub --device-map=/tmp/dev1//boot/grub/device.map /tmp/test.img

cd ~/usrc/grub2/
./ulocal/sbin/grub-probe --target=fs      --device-map=/tmp/dev1/boot/grub/device.map /tmp/dev1/boot/grub
./ulocal/sbin/grub-probe --target=partmap --device-map=/tmp/dev1/boot/grub/device.map /tmp/dev1/boot/grub
# (find-fline "/tmp/dev1/boot/grub/device.map")

* (eepitch-shell)
cd ~/usrc/grub2/
cat > /tmp/device.map <<'%%%'
(fd0)  /dev/fd0
(hd0)  /dev/hda
%%%
./ulocal/sbin/grub-probe --target=fs --device-map=/tmp/device.map /tmp/dev1/boot/grub
# -> "ext2"
mkdir -p /tmp/foo/boot/grub/
exit
R
./ulocal/sbin/grub-probe --target=partmap --device-map=/tmp/device.map /tmp/foo/boot/grub
# -> "pc"

gdb ulocal/sbin/grub-probe


./grub-install $(cat /tmp/test.dev0) --root-directory=/tmp/dev1/
./grub-install $(cat /tmp/test.dev0) --device-map=/tmp/device.map --root-directory=/tmp/dev1/

# (find-grub2file "")
# (find-grub2file "grub-install")

# (find-status   "grub")
# (find-vldifile "grub.list")
# (find-udfile   "grub/")
rm -v /tmp/device.map
echo "(hd0)   $(cat /tmp/test.dev0)" | tee /tmp/device.map
echo quit \
  | /sbin/grub --batch --device-map=/tmp/device.map
cat  /tmp/device.map
# (hd0)   /dev/hda
sudo losetup -d             $(cat /tmp/test.dev0) 2>&1 > /dev/null



# Umount, release loop devices
sudo umount                                       /tmp/dev1
sudo umount                                       /tmp/dev2
sudo losetup -d             $(cat /tmp/test.dev2) 2>&1 > /dev/null
sudo losetup -d             $(cat /tmp/test.dev1) 2>&1 > /dev/null
sudo losetup -d             $(cat /tmp/test.dev0) 2>&1 > /dev/null





#####
#
# notes about mounting the plurall iso as a partition
# 2007oct08
#
#####

# «plurall-iso-as-partition»  (to ".plurall-iso-as-partition")
# (find-fline "~/PLURALL/" "/dvds/plurall-0.9.5.rc3.iso")
# (find-sh "echo -e 'u\\np\\nq' | sudo fdisk /dev/hda")
# /dev/hda7       375535503   376049519      257008+  83  Linux
# At persephone the 256MB partition is hda7.

* (eepitch-shell)
R
cat /dev/hda7 > /tmp/fooo
laf -L ~/PLURALL/plurall_freenx_0.9.5_rc3.iso /tmp/fooo
# cat ~/PLURALL/plurall_freenx_0.9.5_rc3.iso > /dev/hda7
exit

* (eepitch-shell)
mkdir /tmp/plu
sudo mount -o ro /dev/hda7 /tmp/plu
# (find-sh "mount")

# (find-fline "/tmp/plu")
# (find-fline "/tmp/plu/boot/")
# (find-fline "/tmp/plu/boot/f2.txt" "initrd=/boot/initrd.gz init=/linuxrc")

# (find-fline "/tmp/")
# (find-man "1 ls")





#####
#
# isolinux
# 2007oct29
#
#####

# «isolinux»  (to ".isolinux")
# (find-esgrep "grep -nH -e isolinux *.e")
# (find-status   "syslinux")
# (find-vldifile "syslinux.list")
# (find-udfile   "syslinux/")
# (find-udfile "syslinux/isolinux.doc.gz")
# (find-udfile "syslinux/isolinux.doc.gz" "mkisofs -o <isoimage>")
# (find-udfile "syslinux/syslinux.doc.gz")
# (find-udfile "syslinux/syslinux.doc.gz" "++++ CONFIGURATION FILE ++++")
# (find-fline "/usr/lib/syslinux/")
# (find-fline "/usr/lib/syslinux/" "isolinux.bin")
# (code-c-d "etch" "/dvds/etch/")
# (find-etchfile "isolinux/")
# (find-etchfile "isolinux/isolinux.cfg")
# (find-udfile "syslinux/syslinux.doc.gz" "\nDISPLAY filename")
# (find-udfile "syslinux/syslinux.doc.gz" "\nDEFAULT kernel options...")
# (find-udfile "syslinux/syslinux.doc.gz" "\nLABEL label")
# (find-etchfile "install.386/")
#*
rm -Rfv /tmp/iso/
mkdir   /tmp/iso/
cd      /tmp/iso/
mkdir isolinux/

cp -v /usr/lib/syslinux/isolinux.bin   isolinux/
cp -v /dvds/etch/install.386/vmlinuz   .
cp -v /dvds/etch/install.386/initrd.gz .

cat > isolinux/isolinux.cfg <<'%%%'
# Comment
DEFAULT default
LABEL default
  kernel /vmlinuz
  append vga=normal initrd=/initrd.gz -- 
PROMPT 1
%%%

cd /tmp/
mkisofs -o iso.img \
	-b isolinux/isolinux.bin -c isolinux/boot.cat \
	-no-emul-boot -boot-load-size 4 -boot-info-table \
	iso/

#*
# (find-man "qemu")
qemu -m 64 -cdrom /tmp/iso.img

#*

# (find-udfile "syslinux/isolinux.doc.gz" "mkisofs -o <isoimage>")

To create an image, create a directory called "isolinux" (or, if you
prefer, "boot/isolinux") underneath the root directory of your ISO
image master file tree.  Copy isolinux.bin, a config file called
"isolinux.cfg" (see syslinux.doc for details on the configuration
file), and all necessary files (kernels, initrd, display files, etc.)
into this directory, then use the following command to create your ISO
image (add additional options as appropriate, such as -J or -R):

	mkisofs -o <isoimage> \
		-b isolinux/isolinux.bin -c isolinux/boot.cat \
		-no-emul-boot -boot-load-size 4 -boot-info-table \
		<root-of-iso-tree>

(If you named the directory boot/isolinux that should of course be
-b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat.)

# http://en.wikipedia.org/wiki/Linux_startup_process





#####
#
# description of the 256 compact flash on an IDE adaptor at dmesg
# 2007dec03
#
#####

# «compact-flash-dmesg»  (to ".compact-flash-dmesg")
# (find-sh "dmesg")
# (find-sh "dmesg" "hdc:")
# (find-sh "dmesg" "hdc:" "\nhdc:")
# (find-sh "dmesg" "hdc:" "\nhdc:" "\nhdc:")

ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
PIIX4: IDE controller at PCI slot 0000:00:04.1
PIIX4: chipset revision 1
PIIX4: not 100% native mode: will probe irqs later
    ide0: BM-DMA at 0xd800-0xd807, BIOS settings: hda:DMA, hdb:pio
    ide1: BM-DMA at 0xd808-0xd80f, BIOS settings: hdc:DMA, hdd:pio
(...)
Probing IDE interface ide1...
hdc: TRANSCEND, ATA DISK drive
ide1 at 0x170-0x177,0x376 on irq 15
(...)
hdc: max request size: 128KiB
hdc: 504000 sectors (258 MB) w/1KiB Cache, CHS=500/16/63, DMA
 hdc: hdc1

# (* 512 1024)
# -> 524288


# «compact-flash-dd»  (to ".compact-flash-dd")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
mkdir /tmp/hdc1/
sudo mount -o ro /dev/hdc1 /tmp/hdc1/
# (find-fline "/tmp/hdc1/")
# (find-sh "mount")
# /dev/hdc1 on /tmp/hdc1 type vfat (ro)
# (find-sh "df")
# Filesystem           1K-blocks      Used Available Use% Mounted on
# /dev/hdc1               251320         0    251320   0% /tmp/hdc1
sudo umount /dev/hdc1

sudo cat /dev/hdc > /tmp/hdc
gzip -c6 /tmp/hdc > /tmp/hdc.gz
gzip -c6 /tmp/hdc > /tmp/hdc-vfat-orig.gz
cp -iv /tmp/hdc-vfat-orig.gz ~/PLURALL/

# (find-fline "/tmp/")
# -rw-r--r--  1 edrx edrx 258048000 Dec  4 00:44 hdc
# (find-sh "factor 258048000")
# (* 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 5 5 5 7)
# (* (* 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2) (* 3 3 5 5 5 7))
# (* (* 2 2 2 2 2 2 2 2 2 2) (* 2 2 2 2 2) (* 3 3 5 5 5 7))
# (* (* 2 2 2 2 2 2 2 2 2 2) (* 2 2 2 2 2     3 3 5 5 5 7))
# (* 1024 252000)

sudo fdisk /dev/hdc
p
*;; Disk /dev/hdc: 258 MB, 258048000 bytes
*;; 16 heads, 63 sectors/track, 500 cylinders
*;; Units = cylinders of 1008 * 512 = 516096 bytes
*;;
*;;    Device Boot      Start         End      Blocks   Id  System
*;; /dev/hdc1   *           1         499      251464+   6  FAT16
*;; Partition 1 has different physical/logical endings:
*;;      phys=(1010, 15, 63) logical=(498, 15, 63)
d 1
p
n
p
1
1
500
p
m
l
t
6
p
*;; Disk /dev/hdc: 258 MB, 258048000 bytes
*;; 16 heads, 63 sectors/track, 500 cylinders
*;; Units = cylinders of 1008 * 512 = 516096 bytes
*;; 
*;;    Device Boot      Start         End      Blocks   Id  System
*;; /dev/hdc1               1         500      251968+   6  FAT16
d 1
n
p
1
1
+16M
p
n
p
2
33
500
p
m
q

# (find-man "1 dd")
sudo dd bs=1k count=252000 if=/dev/zero of=/dev/hdc

sudo fdisk /dev/hdc
*;; Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
*;; Building a new DOS disklabel. Changes will remain in memory only,
*;; until you decide to write them. After that, of course, the previous
*;; content won't be recoverable.
*;; 
*;; Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
p
n
p
1
1
+16M
n
p
2
33
500
p
w

sudo cat /dev/hdc > /tmp/hdc
gzip -c6 /tmp/hdc > /tmp/hdc-dd0-fdisk16M+rest.gz
cp -iv /tmp/hdc-dd0-fdisk16M+rest.gz ~/PLURALL/

sudo mke2fs /dev/hdc1
sudo mke2fs /dev/hdc2

sudo cat /dev/hdc > /tmp/hdc
gzip -c6 /tmp/hdc > /tmp/hdc-dd0-fdisk16M+rest-mke2fs.gz
cp -iv /tmp/hdc-dd0-fdisk16M+rest-mke2fs.gz ~/PLURALL/

# (find-fline "/tmp/")




#####
#
# grub on the compact flash ide
# 2007dec04
#
#####

# «compact-flash-grub»  (to ".compact-flash-grub")
# (find-node "(grub)Invoking grub-install")
# (find-node "(grub)Invoking the grub shell")

cp -iv ~/PLURALL/hdc-dd0-fdisk16M+rest-mke2fs.gz /tmp/
zcat /tmp/hdc-dd0-fdisk16M+rest-mke2fs.gz > /tmp/hdc
mkdir /tmp/hdc1/
sudo mount /dev/hdc1 /tmp/hdc1/
sudo mkdir /tmp/hdc1/boot/
sudo mkdir /tmp/hdc1/boot/grub/

# The naive way (takes several minutes):
sudo grub-install --root-directory=/tmp/hdc1/ /dev/hdc

# (find-node "(grub)Invoking grub-install")
# (find-node "(grub)Device map")
# (find-node "(grub)Basic usage" "`--device-map=FILE'")
# Hm, it doesn't recognize --device-map (?)
cat > /tmp/device.map <<'%%%'
(fd0)  /dev/fd0
(hd0)  /dev/hdc
%%%
sudo grub-install --device-map=/tmp/device.map \
                  --root-directory=/tmp/hdc1/ /dev/hdc

sudo umount /dev/hdc1
sudo cat /dev/hdc > /tmp/hdc
gzip -c6 /tmp/hdc > /tmp/hdc-dd0-fdisk16M+rest-mkef2s-grub.gz
cp -v /tmp/hdc-dd0-fdisk16M+rest-mkef2s-grub.gz ~/PLURALL/
# (find-fline "/tmp/")
# (find-fline "~/PLURALL/")

# (find-fline "/tmp/hdc1/")
# (find-es "qemu")
# (find-man "qemu")
cd /tmp/
qemu -m 64 -hda /tmp/hdc



* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
sudo grub-install /dev/hdc

*;; Probing devices to guess BIOS drives. This may take a long time.
*;; Searching for GRUB installation directory ... found: /boot/grub
*;; Installation finished. No error reported.
*;; This is the contents of the device map /boot/grub/device.map.
*;; Check if this is correct or not. If any of the lines is incorrect,
*;; fix it and re-run the script `grub-install'.
*;; 
*;; (fd0)	/dev/fd0
*;; (hd0)	/dev/hda
*;; (hd1)	/dev/hdc

mkdir /tmp/hdc1/
mkdir /tmp/hdc2/
sudo mount -o ro /dev/hdc1 /tmp/hdc1/
sudo mount -o ro /dev/hdc2 /tmp/hdc2/
# (find-fline "/tmp/hdc1/")
# (find-fline "/tmp/hdc2/")
sudo umount /dev/hdc1
sudo umount /dev/hdc2

# It should use /tmp/hdc1/boot/grub/ ...




#####
#
# compressed images of the compact flash at angg
# 2007dec06
#
#####

# «compressed-flash-images-angg»  (to ".compressed-flash-images-angg")
# http://angg.twu.net/PLURALL/
# http://angg.twu.net/PLURALL/hdc-dd0-fdisk16M+rest.gz
# http://angg.twu.net/PLURALL/hdc-dd0-fdisk16M+rest-mke2fs.gz
# http://angg.twu.net/PLURALL/hdc-dd0-fdisk16M+rest-mkef2s-grub.gz
# http://angg.twu.net/PLURALL/hdc-vfat-orig.gz

# To erase the compact flash:
zcat ~/PLURALL/hdc-vfat-orig.gz > /tmp/hdc
sudo dd if=/tmp/hdc of=/dev/hdc
sudo mount -o ro /dev/hdc1 /tmp/hdc1
# (find-sh "mount" "/tmp/hdc1")
# (find-sh "df"    "/tmp/hdc1")
# (find-fline "/tmp/hdc1/")
sudo umount /tmp/hdc1




* (eexterm "A")
cd ~/PLURALL/
Scp hdc*.gz edrx@angg.twu.net:slow_html/PLURALL/

sudo umount /dev/hdc1
sudo cat /dev/hdc > /tmp/hdc
gzip -c6 /tmp/hdc > /tmp/hdc-dd0-fdisk16M+rest-mkef2s-grub.gz
cp -v /tmp/hdc-dd0-fdisk16M+rest-mkef2s-grub.gz ~/PLURALL/
# (find-fline "/tmp/")
# (find-fline "~/PLURALL/")

# (find-fline "/tmp/hdc1/")
# (find-es "qemu")
# (find-man "qemu")
cd /tmp/
qemu -m 64 -hda /tmp/hdc

# (find-es "qemu")






#####
#
# plurallflash.img (all steps)
# 2007dec07
#
#####

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
mkdir /tmp/hdc1/
mkdir /tmp/hdc2/



# «unpack-hdc-grub0.gz»  (to ".unpack-hdc-grub0.gz")
#
# (find-fline "~/PLURALL/")
# "grub0.gz" has a longer name...
zcat ~/PLURALL/hdc-dd0-fdisk16M+rest-mkef2s-grub.gz > /tmp/hdc
# (find-fline "/tmp/")



# «check-hdc-grub0.gz-offsets»  (to ".check-hdc-grub0.gz-offsets")
#
# (find-sh "echo -e 'pu\\np\\nq' | sudo fdisk /tmp/hdc")
#    Device Boot      Start         End      Blocks   Id  System
# /tmp/hdc1              63       32255       16096+  83  Linux
# /tmp/hdc2           32256      503999      235872   83  Linux

dd if=/tmp/hdc bs=512 skip=0     count=4 2> /dev/null | file - 
dd if=/tmp/hdc bs=512 skip=63    count=4 2> /dev/null | file - 
dd if=/tmp/hdc bs=512 skip=32256 count=4 2> /dev/null | file - 
# /dev/stdin: x86 boot sector;
#   partition 1: ID=0x83, starthead 1, startsector 63, 32193 sectors;
#   partition 2: ID=0x83, starthead 0, startsector 32256, 471744 sectors,
#   code offset 0x48
# /dev/stdin: Linux rev 1.0 ext2 filesystem data
# /dev/stdin: Linux rev 1.0 ext2 filesystem data

# (find-man "1 file")
# (find-fline "/usr/share/file/magic" "x86 boot sector")
# (find-fline "/usr/share/file/magic" "ext2/ext3 filesystems")



# «copy-plurall.iso-to-hdc2»  (to ".copy-plurall.iso-to-hdc2")
#
# (find-node "(coreutils)dd invocation")
# (find-fline "~/PLURALL/" "plurall.iso")
dd bs=512 seek=32256 if=$HOME/PLURALL/plurall.iso of=/tmp/hdc



# «mount-hdc1»  (to ".mount-hdc1")
# (to "umount-hdc1")
#
# (find-man "8 losetup")
# http://linux.die.net/man/8/losetup
sudo losetup -d              $(cat /tmp/hdc1.dev)
sudo losetup -f              | tee /tmp/hdc1.dev
sudo losetup -o $[512*63]    $(cat /tmp/hdc1.dev) /tmp/hdc
sudo losetup                 $(cat /tmp/hdc1.dev)
sudo mount                   $(cat /tmp/hdc1.dev) /tmp/hdc1/
# (find-fline "/tmp/hdc1/")
# (find-fline "/tmp/hdc1/boot/grub/")
# To update the boot files:    (to "prepare-hdc1-boot-dir")
# To unmount and detach the loop device: (to "umount-hdc1")


# «mount-hdc2»  (to ".mount-hdc2")
# (to "umount-hdc2")
#
sudo losetup -d              $(cat /tmp/hdc2.dev)
sudo losetup -f              | tee /tmp/hdc2.dev
sudo losetup -o $[512*32256] $(cat /tmp/hdc2.dev) /tmp/hdc
sudo losetup                 $(cat /tmp/hdc2.dev)
sudo mount -o ro             $(cat /tmp/hdc2.dev) /tmp/hdc2/
# (find-fline "/tmp/hdc2/")
# (find-fline "/tmp/hdc2/DEVIL-LINUX")
# (find-fline "/tmp/hdc2/boot/")
# (find-fline "/tmp/hdc2/boot/" "vmlinuz")
# (find-fline "/tmp/hdc2/boot/" "initrd.gz")
# To unmount and detach the loop device:
# To unmount and detach the loop device: (to "umount-hdc1")



# «extract-vmlinuz»  (to ".extract-vmlinuz")
# (find-fline "/tmp/hdc2/boot/" "vmlinuz")
cp -v /tmp/hdc2/boot/vmlinuz ~/PLURALL/


# «extract-initrd»  (to ".extract-initrd")
# (find-fline "/tmp/hdc2/boot/" "initrd.gz")
cp -v /tmp/hdc2/boot/initrd.gz ~/PLURALL/


# «mount-initrd»  (to ".mount-initrd")
zcat ~/PLURALL/initrd.gz > /tmp/initrd.img
mkdir /tmp/initrd/
sudo mount -o ro,loop /tmp/initrd.img /tmp/initrd/
# (find-sh "mount" "/tmp/initrd")
# (find-fline "/tmp/initrd/")
# (find-fline "/tmp/initrd/linuxrc")


# «extract-linuxrc»  (to ".extract-linuxrc")
cp -v /tmp/initrd/linuxrc ~/PLURALL/

# «compare-linuxrc-linuxrc2»  (to ".compare-linuxrc-linuxrc2")
# (find-angg "PLURALL/linuxrc")
# (find-angg "PLURALL/linuxrc2")
# (find-tkdiff "~/PLURALL/linuxrc" "~/PLURALL/linuxrc2")



# «tarcp-initrd-to-initrd2»  (to ".tarcp-initrd-to-initrd2")
# (find-angg ".zshrc" "tarcp")
sudo rm -Rf /tmp/initrd2/
mkdir       /tmp/initrd2/
cd          /tmp/initrd/ 
sudo tar -cf - . | sudo tar -xvf - -C /tmp/initrd2/ |& tee ~/o
cd /tmp/


#****
# (find-fline "/tmp/initrd/")
# (find-fline "/tmp/initrd2/")
# (find-fline "~/o")
# (find-sh "grep -v implausibly ~/o")



# «umount-initrd»  (to ".umount-initrd")
sudo umount /tmp/initrd/

# «mkinitrd-initrd2»  (to ".mkinitrd-initrd2")
# (find-esgrep "grep -nH -e mkinitrd *.e")
# (find-status   "initrd-tools")
# (find-vldifile "initrd-tools.list")
# (find-udfile   "initrd-tools/")
# (find-status   "cramfsprogs")
# (find-vldifile "cramfsprogs.list")
# (find-udfile   "cramfsprogs/")
# (find-man "8 mkinitrd")
# (find-man "8 mkcramfs")
sudo cp -v ~/PLURALL/linuxrc2 /tmp/initrd2/linuxrc2
sudo mkcramfs -v /tmp/initrd2/ /tmp/initrd2.img
gzip -c9                     < /tmp/initrd2.img > /tmp/initrd2.gz
# (find-fline "/tmp/")
# (find-fline "~/PLURALL/")
cp -v initrd2.img ~/PLURALL/
cp -v initrd2.gz  ~/PLURALL/



# «prepare-hdc1-boot-dir»  (to ".prepare-hdc1-boot-dir")
# (find-es "grub" "menu.lst")
# (find-node "(grub)GNU/Linux")
# (find-angg "PLURALL/menu.lst")
sudo cp -v  ~/PLURALL/menu.lst   /tmp/hdc1/boot/grub/menu.lst
sudo cp -v  ~/PLURALL/vmlinuz    /tmp/hdc1/boot/
sudo cp -v  ~/PLURALL/initrd.gz  /tmp/hdc1/boot/
sudo cp -v  ~/PLURALL/initrd2.gz /tmp/hdc1/boot/
sudo cp -v  ~/PLURALL/initrd2.img /tmp/hdc1/boot/



# «umount-hdc1»  (to ".umount-hdc1")
# (to "mount-hdc1")
sudo umount     $(cat /tmp/hdc1.dev)
sudo losetup -d $(cat /tmp/hdc1.dev)

# «umount-hdc2»  (to ".umount-hdc2")
# (to "mount-hdc2")
sudo umount     $(cat /tmp/hdc2.dev)
sudo losetup -d $(cat /tmp/hdc2.dev)

# «run-qemu-on-hdc»  (to ".run-qemu-on-hdc")
# (find-man "1 qemu")
# (find-es "qemu")
qemu -m 64 -hda /tmp/hdc

# A possible solution for the problem below:
# append "root=100 linuxrc"
# (I'm testing it)

# «copy-hdc-to-plurallflash.img»  (to ".copy-hdc-to-plurallflash.img")
cp -v /tmp/hdc ~/PLURALL/plurallflash.img


# «copy-plurallflash.img-to-pen-drive»  (to ".copy-plurallflash.img-to-pen-drive")
# (find-emount-links)
mkdir /tmp/pen/
# sudo mount -o ro /dev/sda1 /tmp/pen/
  sudo mount       /dev/sda1 /tmp/pen/

# (find-fline "~/PLURALL/")
# (find-fline "~/tmp/")
# http://angg.twu.net/PLURALL/
sudo cp -v ~/PLURALL/plurallflash.img /tmp/pen/

sudo umount /tmp/pen/



# «problem-with-menu.lst»  (to ".problem-with-menu.lst")
# «problem-with-mkcramfs»  (to ".problem-with-mkcramfs")
# (find-angg "PLURALL/menu.lst")
# I tried to append "root=/dev/hda2" to the "kernel" line or the
# "initrd2" option, but I got this:
#
# RAMDISK: Compressed image found at block 0
# Freeing initrd memory: 2621k freed
# VFS: Mounted root (cramfs filesystem).
# Mounted devfs on /dev
# cramfs: wrong magic
# FAT: bogus logical sector size 0
# kmod: failed to exec /sbin/modprobe -s -k nls_iso8859-1, errno = 2
# VFS: Mounted root (iso9660 filesystem) readonly.
# Trying to move old root to /initrd ... okay
# Mounted devfs on /dev
# Freeing unused kernel memory: 156k freed
# INIT: version 2.86 booting
# INIT: No inittab file found
#
# Enter runlevel:





# (find-sh "dmesg")
# (find-fline "/proc/cmdline")
# auto BOOT_IMAGE=Linux ro root=301





#####
#
# testing the initrds
# 2007dec17
#
#####

# (find-fline "~/PLURALL/")
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/PLURALL/
file initrd*

zcat initrd.gz > /tmp/initrd
file /tmp/initrd
mkdir /tmp/i/
mkdir /tmp/i2/
sudo mount -o ro,loop /tmp/initrd /tmp/i/
sudo mount -o ro,loop ~/PLURALL/initrd2.img /tmp/i2/
sudo umount /tmp/i/
sudo umount /tmp/i2/




#####
#
# what to do in the shell of the initrd
# 2007dec18
#
#####

# «in-the-initrd-shell»  (to ".in-the-initrd-shell")
# (find-es "plurall" "run-qemu-on-hdc")
# (find-fline "/dev/" "hda2")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
qemu -m 64 -hda   /tmp/hdc
qemu -m 64 -hda   ~/PLURALL/plurallflash.img
qemu -m 64 -cdrom ~/PLURALL/plurall.iso

# Checking for "etc.tar.bz2" on "/dev/ide/host0/bus1/target0/lun0/cd" ...
# file not found
# Looking for empty configuration media on /dev/ide/host0/bus1/target0/lun0/cd
# Please insert configuration media and press 'Enter'


mknod /dev/hda2 b 3 2
mount -o ro /dev/hda2 /cdrom/
cd /cdrom/
pivot_root . initrd
# exec /usr/sbin/chroot . /bin/sh
  exec /usr/sbin/chroot . /sbin/pre_init

# (find-man "8 pivot_root")
# (find-man "2 pivot_root")
# (find-es "init")

# (find-fline "/tmp/hdc2/isolinux.cfg")
# (find-fline "~/PLURALL/")
# (find-fline "~/PLURALL/linuxrc2" "/mount_cdrom /cdrom noreboot")
# (find-fline "~/PLURALL/linuxrc2" "pivot_root . initrd")
# (find-fline "~/PLURALL/linuxrc2" "Starting up final system...")
# (find-fline "~/PLURALL/linuxrc2" "/usr/sbin/chroot . /sbin/pre_init")
# (find-fline "/tmp/initrd2/mount_cdrom")
# (find-fline "/tmp/initrd2/mount_cdrom" "let's check all partitions")
# (find-fline "/tmp/hdc2/sbin/")
# (find-fline "/tmp/hdc2/sbin/pre_init")





#####
#
# ramroot
# 2008feb18
#
#####

# «ramroot»  (to ".ramroot")
# http://iki.fi/lindi/darcs/ramroot/
# http://iki.fi/lindi/darcs/ramroot/create-flash-image
# (find-es "cvs" "darcs")
#*
rm -Rv ~/usrc/ramroot/
cd     ~/usrc/
darcs get http://iki.fi/lindi/darcs/ramroot
tar -cvzf ~/tmp/ramroot.tgz ramroot/
cd     ~/usrc/ramroot/

#*
rm -Rv ~/usrc/ramroot/
tar -C ~/usrc/ -xvzf ~/tmp/ramroot.tgz
cd     ~/usrc/ramroot/

#*
# (code-c-d "ramroot" "~/usrc/ramroot/")
# (find-ramrootfile "")
# (find-ramrootfile "README")
# (find-ramrootfile "create-flash-image")
# (find-ramrootfile "create-flash-image" "geometry (hd0) 61 255 63")
# (find-ramrootfile "test-flash-image")
# (find-ramrootfile "test-flash-image" "tunctl")

# http://iki.fi/lindi/qemu-network.txt

# What are the C/H/S syntaxes for?...
# dd
# fdisk
# losetup
#   (esp. for partitions that are not the first;
#   and I don't know how to set up the sizes)
# grub
#   menu.lst
# qemu
#   tunctl




#####
#
# hddimg, by Andrew Brockman
# 2008apr22
#
#####

# «hddimg»  (to ".hddimg")
# (find-angg "PLURALL/hddimg")
# (find-angg "PLURALL/asciidump.c")










#  Local Variables:
#  coding:               utf-8-unix
#  End: