1.

Solve : FreeDOS to Linux boot with a custom restore CD?

Answer»

I have a arcade game. It is called Deal or No Deal and it gives out tickets when you win.  It is made by a company called ICE Game.  The motherboard went bad for second time and I can't find the same model as a replacement. ICE wants almost $1000.00 for a replacement computer.  This is a common problem with their gear and I think it goes back to the bad Capacitors that plagued many computers. 

I want to MODIFY the restore process so I can use a different motherboard.  Right now it fails when attempting to install a different motherboard when trying to install Nvidia drivers, which the new motherboard doesn't use.   I need some help with understanding the boot process and changing the drivers. 

The restore CD first builds a DOS partition and installs FreeDOS then installs Linux and then the game is installed on that.  After that it boots up in Linux and runs the game.

I have been looking at the files and I can't quite figure out or follow the process.

For example: In the ROOT directory on the restore CD there are about ten files.  One of them is a AUTORUN.INF  Is that the first thing that is looked at after the CDROM starts the boot process?  In that file is this:

icon=\FREEDOS\FREEDOS.ICO,0
label=FreeDOS Beta 9
shell\DOCFDInfo=View &FreeDOS Information Sheet
shell\DOCFDInfo\command=write \FREEDOS\DOCS\INFO.TXT
shell\DOCInstReadme=View Read&Me
shell\DOCInstReadme\command=write \FREEDOS\DOCS\README.TXT
shell\DOCInstall=&View Installation Document
shell\DOCInstall\command=write \FREEDOS\DOCS\INSTALL3.TXT
shell\DOCPrograms=View Included Programs &Details (Name, License, URL)
shell\DOCPrograms\command=write \FREEDOS\DOCS\PROGRAMS.TXT
shell\MakeBoot=Create Generic 1.44MB &Bootdisk for use with FreeDOS CD
shell\MakeBoot\command=FREEDOS\SETUP\BATCH\BOOTDISK.BAT


Is the next thing that takes place is the BOOTDISK.BAT file being run?  Here is what is in that.
echo off
cls
rem Check for memdisk existence, errorlevel 1=found ; 0=notfound
set dest=A:
if "%OS%"=="Windows_NT" goto begin
if not exist a:\freedos\ifmemdsk.com goto begin
a:\freedos\ifmemdsk.com
if errorlevel 3 goto begin
if errorlevel 1 set dest=B:
goto begin

:begin
title FreeDOS Bootdisk Builder
cls
echo Welcome to the bootdisk builder. this will create a bootdisk for you.
echo.
if not "%OS%"=="Windows_NT" goto begin2
echo Please insert a (non)empty formatted diskette in diskdrive and press a key to continue
goto emptydsk
:begin2
if not "%cdrom%"=="" CDD %cdrom%
cls
if "%dest%"=="B:" echo Please insert a (non)empty formatted diskette in your diskette drive.
if "%dest%"=="A:" echo please remove bootdisk and insert a (non)empty formatted diskette in your diskette drive
goto emptydsk

:emptydsk
pause Press a key to continue or Control-C to abort.
rem show files, trying to detect kernels.
attrib -r -h -s %dest%\*.*
cls
rem kernel files and cdromdrivers (as long as atapicdd.sys isn't performing good/stable enough)
for %%x in ( %dest%\io.sys %dest%\msdos.sys %dest%\oakcdrom.sys ) do if exist %%x attrib +r %%x
for %%x in ( %dest%\*.* ) do del %%x
rem all files in root removed, except for kernel files.
goto docopy

:docopy
if "%dest%"=="A:" \freedos\3rdparty\extract -ox \isolinux\data\fdboot.img %dest% *.*
if "%dest%"=="B:" xcopy /s /y A:\*.* %dest%
rem files are now present on diskette!
rem setup stable cdromdriver, delete recreatable files
if exist %dest%\oakcdrom.sys copy /y %dest%\oakcdrom.sys %dest%\driver\vide-cdd.sys
if exist %dest%\metakern.sys del %dest%\metakern.sys
if exist %dest%\freedos\bootsect.bin del %dest%\freedos\bootsect.bin
set kernel=kernel.sys

rem Assuming non-freedos bootsector currently installed on diskette
if not exist %dest%\io.sys goto end
%dest%\freedos\copybs.com %dest% %dest%\freedos\bootsect.bin
if not exist %dest%\freedos\bootsect.bin goto end
if not exist %dest%\freedos\meta-all.bin goto end
if not exist %dest%\freedos\metaboot.bot goto end
copy /b %dest%\freedos\meta-all.bin + %dest%\freedos\metaboot.bot + %dest%\freedos\bootsect.bin %dest%\metakern.sys
if exist %dest%\metakern.sys set kernel=metakern.sys
echo SHELL=A:\COMMAND.COM A:\ /E:1024 /P=A:\FREEDOS\FDAUTO.BAT >> %dest%\config.sys
goto end

:end
echo Kernel file: %kernel%
%dest%\freedos\SYS %dest% %dest% BOOTONLY /K %kernel%
set kernel=
goto end2
:end2


This is where I get lost.  This is where I need some help on what it is doing and what takes place next.  And I guess I keep following this until I get to the point where it loads the config files for the drivers and then modify that to use different ones. 
This process is all automated.  Even though there are things that say "Insert floppy disc"etc.  all we normally do is put the CD in the computer and turn the computer on and in about ten minutes it restores all of the files and the game from then on boots and plays when the machine is turned on.

If someone things they can help me with this I can pay some money through paypal.  I am doing this trying to save some money but I know there isn't a easy answer and it might take many messages.  Or if someone can guide me through this on the forum that would be helpful.  If it wasn't a rush I would just STUDY this stuff and figure it out eventually but I have to get this back up and running. 

On the batch file listed above, this is the first part.
rem Check for memdisk existence, errorlevel 1=found ; 0=notfound 
set dest=A:
if "%OS%"=="Windows_NT" goto begin  and here, etc.
if not exist a:\freedos\ifmemdsk.com goto begin
a:\freedos\ifmemdsk.com
if errorlevel 3 goto begin
if errorlevel 1 set dest=B:
goto begin

Could someone explain how this part works?

Thanks for any help and if this is too much for this forum is there a place I can GO with this type of question?
Thank you
Russ
Quote from: uriahsky on January 04, 2012, 04:59:17 PM

On the batch file listed above, this is the first part.
rem Check for memdisk existence, errorlevel 1=found ; 0=notfound 
set dest=A:
if "%OS%"=="Windows_NT" goto begin  and here, etc.
if not exist a:\freedos\ifmemdsk.com goto begin
a:\freedos\ifmemdsk.com
if errorlevel 3 goto begin
if errorlevel 1 set dest=B:
goto begin


Could someone explain how this part works?

I can try to explain how this is working, but I don't know where to start on helping with your overall issue.

rem Check for memdisk existence, errorlevel 1=found ; 0=notfound -> This line is a remark, it does nothing in the program itself.
set dest=A: -> This is setting the 'dest' variable that is used later in the program.
if "%OS%"=="Windows_NT" goto begin -> The variable 'OS' holds the current operating system this batch file is run in. If it is a 'Windows_NT' operating system, then it simply jumps to the :begin label.
if not exist a:\freedos\ifmemdsk.com goto begin -> This tests to see if the file exists. If it does not exist, then it jumps to the :begin label.
a:\freedos\ifmemdsk.com -> This simply starts the identified process. It gives control to that process, and will not continue until the process closes.
if errorlevel 3 goto begin -> This tests the errorlevel, which is increased anytime a process has an unexpected output, and jumps to the :begin label if true. If the ifmemdsk.com process had three unexpected outputs, then the errorlevel would equal 3. (Errorlevel is something I'm not overly familiar with, and this is from my basic understanding on errorlevels.)
if errorlevel 1 set dest=B: -> Same as above, only testing for a different errorlevel and setting a different value for the 'dest' variable if true.
goto begin -> Jumps to the :begin label.

I hope that helps. If you have any questions on the explanations, please ask. Quote from: uriahsky on January 04, 2012, 04:59:17 PM
rem Check for memdisk existence, errorlevel 1=found ; 0=notfound
set dest=A:
if "%OS%"=="Windows_NT" goto begin  and here, etc.
if not exist a:\freedos\ifmemdsk.com goto begin
a:\freedos\ifmemdsk.com
if errorlevel 3 goto begin
if errorlevel 1 set dest=B:
goto begin

It seems to change the initial value of dest to SUIT the case.

If memdisk exists and %OS% doesn't expand to Windows_NT then dest = B:
Otherwise dest = A:So it is checking for memdisk and if it is found it sets the dest variable to B and if not to A?
Then the part where %os% ==windows nt.  Is it looking somewhere for "OS" to be set as "Windows NT" or something else?    Where is "OS" going to be set? 
But either way it is basically moving the program onto the "Begin"

But then in the begin part under
if "%dest%"=="B:" echo Please insert a (non)empty formatted diskette in your diskette drive.
if "%dest%"=="A:" echo please remove bootdisk and insert a (non)empty formatted diskette in your diskette drive
These things are being done automatically.  But how?  Did I miss a start up file? It is echoing a command for the user but I never do anything during the installs.

If a computer is booted with a CDROM is it the AUTORUN.INF file that is read or could it be any of these.
Boot.Catalog
Boot000.Catalog
DFSDOS.EXE
ISOLINUX.BIN
LVM.PD1
MAKEITSO.BAT
RESTORE.DFS
PART0IMZ
VSSVER.SCC

Those are the only other files in the directory. 
The MAKEITSO.BAT consists of
isolinux\buildcd\mkisofs -o ..\explet.iso -N -l -no-iso-translate -relaxed-filenames -R -r -boot-info-table -iso-level 3 -no-emul-boot -b isolinux.bin .\
But where is this getting called?

Thanks, I have learned a few things already.
Russ
Quote from: uriahsky on January 04, 2012, 07:16:21 PM
Then the part where %os% ==windows nt.  Is it looking somewhere for "OS" to be set as "Windows NT" or something else?    Where is "OS" going to be set? 

%OS% is an embedded variable. Certain variables are made available as soon as cmd prompt is started, and %OS% is one of them. %Windir% is another one that is available in cmd prompt, and holds the file location of the windows directory. So if you installed everything on your system with default settings, %windir% will be "c:\windows", but if you installed your Windows onto a D: drive, then %windir% would be "d:\windows." %OS% holds the operating system that is detected when cmd prompt is started. Which means if it detects that a "Windows_NT" operating system (which I believe is what any version after Win 98 will have), then it will jump to begin. The big caveat on all of this is that none of these variables will be available in MS-DOS, so what should happen is Code: [Select]if "%OS%"=="Windows_NT" goto begin will expand to Code: [Select]if ""=="Windows_NT" goto begin and the program will continue by looking for ifmemdsk.com in the a: drive. What it is essentially doing is making sure that you do not try to overwrite the disk that is running the startup program.Thank you, I had no idea about the embedded variables.  I have ran through this disk a number of times and I found a way to step through all of the .bat files.  It looks like the first part loads drivers for the the CD, and does a few other things then makes about five partitions and then puts linux into one of them and then that is where the Nvidia drivers come into things.  So, I may need to focus on the Linux part to figure out how to change the Nvidia driver.


Discussion

No Comment Found