Oki, here are the updated altdosemu patches against CVS as of 2008-03-17

The new files are inside the archive, that is:
unattended/linuxboot/misc:
 nt5x-install
 unatt-functions.sh
and the ntldr binaries:
unattended/linuxboot/misc/ntldrbin:
 ntldr_boot_code_install
 ntldr_boot_code_sektor0
 ntldr_boot_code_sektor12

Basically summed up:
- Faster (when using nt5x-install)
- Supports long filenames in drivers  (when using nt5x-install)
- a cure for "NTLDR not found"

install.pl  ask if you want to run the dosemu alternative (nt5x-install) or if 
you want to use the old dosemu.
To get rid of the question put one of these in unattend.txt  [_meta] section:
    ntinstall_cmd = "" # use old dosemu
    ntinstall_cmd = "nt5x-install" # use dosemu alternative (nt5x-install)

Disk geometry fixes: 
Are as default added automatically.
You can turn this of by adding these (both) in unattend.txt  [_meta] section:
    fix_disk_geo_heads = ""
    fix_disk_geo_sectors = ""


All possible new settings for unattend.txt  [_meta] section summed up:

ntinstall_cmd =  #system command to run in place of dosemu.
post_ntinstall_cmd = # system command to run after ntinstall
fix_disk_geo_heads =  #Heads to write to disk partition
fix_disk_geo_sectors = #Sectors to write to disk partition

I decided to apply eventual disk geo fixes _after_ the dosemu run, 
while in nt5x-install its done at the beginning.
The reasoning is that I dont know whats going on inside winnt, while in 
nt5x-install that is very clear and easy to move/fix.
--- unattended-cvs/install/dosbin/install.pl	2008-03-17 17:12:55.000000000 +0100
+++ unattended/install/dosbin/install.pl	2008-03-17 21:00:43.000000000 +0100
@@ -998,8 +998,20 @@
 
 $u->{'_meta'}->{'fdisk_confirm'} = 1;
 
+$u->comments ('_meta', 'ntinstall_cmd') =
+    ['System command to run in place of winnt under dosemu? (linuxboot only)'];
+$u->{'_meta'}->{'ntinstall_cmd'} =
+    sub {
+        return (yes_no_choice ('Use nt5x-install script - (DOSEMU alternative)')
+                ? 'nt5x-install'
+                : undef);
+    };
+
 $u->{'_meta'}->{'format_cmd'} =
     sub {
+        if (defined $u->{'_meta'}->{'ntinstall_cmd'}) {
+            return undef;
+        }
         return (yes_no_choice ('Format C: drive')
                 ? 'format /y /z:seriously /q /u /a /v: c:'
                 : undef);
@@ -1499,10 +1511,22 @@
             close SETTINGS
                 or die "Unable to close $settings_file: $^E";
             print "done.\n";
+            # Disk geometry is now fixed, no need to hack disk geo into the partition:
+            $u->{'_meta'}->{'fix_disk_geo_heads'} = "";
+            $u->{'_meta'}->{'fix_disk_geo_sectors'} = "";
         }
         else {
             # Non-IDE disk.  Should probably sanity-check kernel
             # geometry against legacy BIOS geometry here.  FIXME.
+            # Send partition geometry via unatted.txt so we can
+            # hack it into partition after the dosemu run.
+            # FIXME Should we ask the user before we do this?
+            if (not defined $u->{'_meta'}->{'fix_disk_geo_heads'}) {
+                $u->{'_meta'}->{'fix_disk_geo_heads'} = $bios_head;
+            }
+            if (not defined $u->{'_meta'}->{'fix_disk_geo_sectors'}) {
+                $u->{'_meta'}->{'fix_disk_geo_sectors'} = $bios_sect;
+            }
         }
     }
 }
--- unattended/linuxboot/Makefile-bf-altdosemu	2008-03-17 20:40:46.000000000 +0100
+++ unattended/linuxboot/Makefile	2008-03-17 21:08:00.000000000 +0100
@@ -790,6 +790,16 @@
 
 $(call copy_file,misc/freedos-mbr.bin,stage1/usr/lib/freedos-mbr.bin)
 
+$(call copy_file,misc/ntldrbin/ntldr_boot_code_install,stage1/usr/lib/ntldrbin/ntldr_boot_code_install)
+
+$(call copy_file,misc/ntldrbin/ntldr_boot_code_sektor0,stage1/usr/lib/ntldrbin/ntldr_boot_code_sektor0)
+
+$(call copy_file,misc/ntldrbin/ntldr_boot_code_sektor12,stage1/usr/lib/ntldrbin/ntldr_boot_code_sektor12)
+
+$(call copy_file,misc/nt5x-install,stage1/usr/bin/nt5x-install)
+
+$(call copy_file,misc/unatt-functions.sh,stage1/usr/lib/unatt-functions.sh)
+
 # Some apps (namely dosemu) need getpwnam() etc. to work
 $(call copy_file,misc/passwd,stage1/etc/passwd)
 
@@ -799,7 +809,12 @@
 		stage1/etc/master stage1/etc/modprobe.conf		\
 		stage1/etc/module-order.txt				\
 		stage1/etc/udhcpc-script stage1/etc/nsswitch.conf	\
-		stage1/etc/passwd stage1/usr/lib/freedos-mbr.bin
+		stage1/etc/passwd stage1/usr/lib/freedos-mbr.bin	\
+		stage1/usr/lib/ntldrbin/ntldr_boot_code_install         \
+		stage1/usr/lib/ntldrbin/ntldr_boot_code_sektor0         \
+		stage1/usr/lib/ntldrbin/ntldr_boot_code_sektor12        \
+		stage1/usr/lib/unatt-functions.sh                       \
+		stage1/usr/bin/nt5x-install
 
 # /etc/version
 stage1/etc/version: FORCE
--- unattended-cvs/linuxboot/misc/master	2008-03-17 17:12:55.000000000 +0100
+++ unattended/linuxboot/misc/master	2008-03-17 20:42:58.000000000 +0100
@@ -363,14 +363,6 @@
 
 echo "*** By Jove, I think we've got it!"
 
-# FIXME: Bad hack to work around dosemu bug running over network
-rm /usr/bin/dosemu.bin
-cp /z/linuxaux/usr/bin/dosemu.bin /usr/bin/dosemu.bin
-rm -f /var/lib /var/lib/dosemu /var/lib/dosemu/drives \
-    /var/lib/dosemu/drives/dosboot.img >/dev/null 2>&1
-mkdir -p /var/lib/dosemu/drives
-cp /z/linuxaux/var/lib/dosemu/drives/dosboot.img /var/lib/dosemu/drives/.
-
 # install.pl relies on these environment variables
 # (see also LEGACY_BIOS_HEAD and LEGACY_BIOS_SECT above)
 export Z_PATH Z_USER Z_PASS
@@ -391,13 +383,70 @@
     die "No active partition found!"
 fi
 
-cp /etc/dosemu/dosemu.conf /tmp
-echo \$_hdimage = \"/dev/dsk$active_part\" >> /tmp/dosemu.conf
+#load functions so we can parse /c/netinst/unattend.txt:
+[ -f /usr/lib/unatt-functions.sh ] || die "/usr/lib/unatt-functions.sh not found" 
+. /usr/lib/unatt-functions.sh
+
+ntinstall_cmd=`parse_ini_file /c/netinst/unattend.txt _meta ntinstall_cmd`
+
+if [ -z "$ntinstall_cmd" ]
+then  
+    #Run the orginal dosemu:
+
+    # FIXME: Bad hack to work around dosemu bug running over network
+    rm /usr/bin/dosemu.bin
+    cp /z/linuxaux/usr/bin/dosemu.bin /usr/bin/dosemu.bin
+    rm -f /var/lib /var/lib/dosemu /var/lib/dosemu/drives \
+       /var/lib/dosemu/drives/dosboot.img >/dev/null 2>&1
+    mkdir -p /var/lib/dosemu/drives
+    cp /z/linuxaux/var/lib/dosemu/drives/dosboot.img /var/lib/dosemu/drives/.
+
+    cp /etc/dosemu/dosemu.conf /tmp
+    echo \$_hdimage = \"/dev/dsk$active_part\" >> /tmp/dosemu.conf
+
+    # DOSEMU always exits non-zero.  FIXME.
+    dosemu.bin -f /tmp/dosemu.conf
+
+    #lets see if we should fix partition geometry - to avoid 'ntldr not found'
+    fix_disk_geo_heads=`parse_ini_file /c/netinst/unattend.txt _meta fix_disk_geo_heads`
+    fix_disk_geo_sectors=`parse_ini_file /c/netinst/unattend.txt _meta fix_disk_geo_sectors`
+    if [ -n "$fix_disk_geo_heads" ] && [ -n "$fix_disk_geo_heads" ] ; then
+        echo "fixing disk geometry .."
+        echo -e -n "\x`printf "%02X" $fix_disk_geo_heads`"|dd of=/dev/dsk$active_part bs=1 seek=26 conv=notrunc
+        echo -e -n "\x`printf "%02X" $fix_disk_geo_sectors`"|dd of=/dev/dsk$active_part bs=1 seek=24 conv=notrunc
+        echo "..done"
+    fi
+
+    echo "mount /c, we might still do some adjustments. It better be mountable now."
+    mount -t vfat /dev/dsk$active_part /c || die "Could not mount /c"
+
+    if [ -n "$fix_disk_geo_heads" ] && [ -n "$fix_disk_geo_heads" ] ; then
+        # We also need to fix disk geometry in bootsect.dat
+        bootsectfile="/c/\$win_nt\$.~bt/bootsect.dat"
+        [ -f "$bootsectfile" ] || die "$bootsectfile not found"
+        echo "fixing disk geometry in $bootsectfile .."
+        echo -e -n "\x`printf "%02X" $fix_disk_geo_heads`"|dd of=$bootsectfile bs=1 seek=26 conv=notrunc
+	echo -e -n "\x`printf "%02X" $fix_disk_geo_sectors`"|dd of=$bootsectfile bs=1 seek=24 conv=notrunc
+        echo "..done"
+    fi
+else
+    echo -e "* Running ntinstall_cmd: $ntinstall_cmd"
+    $ntinstall_cmd || die "* $ntinstall_cmd exited non-zero"
+fi
+
+# Installation is now complete, /c is mounted, some adjustments (if any) follows..
 
-# DOSEMU always exits non-zero.  FIXME.
-dosemu.bin -f /tmp/dosemu.conf
+post_ntinstall_cmd=`parse_ini_file /c/netinst/unattend.txt _meta post_ntinstall_cmd`
+if [ -n "$post_ntinstall_cmd" ] ; then
+    echo -e "* Running post_ntinstall_cmd: $post_ntinstall_cmd"
+    $post_ntinstall_cmd || die "* $post_ntinstall_cmd exited non-zero"
+fi
 
 sync
+umount /c
+
+echo "all done!"
+
 reboot
 
 exec bash

Attachment: altdosemu-2008-03-17.tar.gz
Description: application/tgz

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
unattended-devel mailing list
unattended-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unattended-devel

Reply via email to