• 0

How to build an operaing system ?


Question

Recommended Posts

  • 0

lol , look what i found in autoexec.bat

SET windir=D:\WINXP

SET winbootdir=D:\WINXP

(((((((( SET COMSPEC=D:\WINXP\COMMAND.COM ))))))))

SET PATH=D:\WINXP;D:\WINXP\COMMAND

SET PROMPT=$p$g

SET TEMP=D:\WINXP\TEMP

SET TMP=D:\WINXP\TEMP

what do you think now gameguy ?

  • 0

NT does not have any dependency on MS-DOS. As for your autoexec.bat, that is strange because it should be empty, and unless you set it up, Windows XP doesn't even parse autoexec.bat.

  • 0

Elagizy

what you said about running windows from dos going into the i386 folder etc, sound like you started the installation from dos and installed it that way, rather than booting from the cd. as for you autoexe.bat, thats probably a result of that process, from a clean install onto a blank hdd my autoexe.bat is empty!

as for testing an os to check if it will work on differewnt computers .... all computers are different, youd have to make sure your operating system could handle different types of hardware through some sort of divers or by embedding it all into one kernel (much the way bsd does things)

as for windows 95/98 AND me ... they all were based on the 9x kernel which was run in dos (yes me ran on dos but it was hidden from the user)

as for nt/2000/xp/2003 they all require the ntldr to boot the system and use one file mainly to run (ntoskrnl), THERE IS NO DOS anywhere with xp 2003 etc, trhey mainly use those files you talked about for legacy and configuration reasons

as for writting your own operating system, if you needed these questions answered your going to be in for a tough reason, to create anything usefull youll need to know assembly to bootstrap your system and id say a fair amount of c. Youd also do weel to look into compiler design!

http://www.ansanest.com/josh/ goes through the very very basic steps of creating a bootable os, all be it slow practically useless and basic!

http://cs.wwc.edu/~aabyan/464/Book/ that is a book on compiler design, if you want to look at how things go through and compile to usable code, usefull if you want to progress into a fuller featured environment

few notes

linux is the kernel of an os, the full os would be correctly referenced as GNU/linux as its the other (gnu) programs running on linux that make the os what it is, linux distributions all package different software!

dos is basically like a small kernel and a a load of applications making it useful! windows 95/98/me all used dos to boot and interact with some of the hardware

windows xp/2000/2003 uses the nt loader and nt kernel which is NOT WHERE NEAR to being dos!

freebsd openbsd and company all use one single kernel for interacting with all hardware and providing a lot of functionality, again its the packages by other authors that allow it to be usefull

if you really are stuggling to understand most of this id suggest a few things before going into fully fledged os design

1) maybe try going through something like a gentoo install/compilation to see how much that alone invloves and get a true sense of how it installs

2) maybe even try creating your own linux distribution, that alon is hard enough but not wuite as hard as making a nicly working os!

http://www.se.linuxfromscratch.org/lfs/news.html linuxfromsctach is basically a free online book showing you how to build your own distibution (like gentoo but you do EVERYTHING) that would give you an excelent insight into it all and with it youd be handling souce code so by the end its your distribution and you can see all th work thats gone into it!

3) if linux isnt your thing id say get a working freedos environment and bootable http://www.freedos.org/ or http://freedos-32.sourceforge.net/ (a 32bit kernel for freedos) then from there start by coding your own envirment for it maybe? basically doing the step microsoft did with windows 3.1 ... making something usefull of a dos environment!

http://fxr.watson.org/ is a very cool site, you can explore a few kernels for yourself to see ALL the cod3e behind the very heart of the os! linux, bsd, darwin there all there and browsable so you can see what sort of coding is done to make something usefull and worthwhile!

  • 0

I think he just confused autoexec.bat with autoexec.nt. Windows XP has an autoexec.nt and config.nt file in windows\system32 that gets run every time you run an old DOS app. The blank DOS files in the roor of the active HD are just there for legacy purposes so that any DOS apps that look for them don't crap themselves. As for Windows XP needing DOS to boot, it's not true in any sense. To elaborate on how berz explained the boot process, the boot process for XP is such (from what I know): the BIOS looks at the hard drive which you have configured to boot, reads the partition table and finds the active partition, uses the MBR to find the boot sector, and then executes it. The boot sector is already part of XP and it loads the boot loader (ntldr). ntldr has theability to either load another boot sector (such as one for Windows 9x if you're dual booting) or load an installation of NT. ntldr also has a minimal ability to read NTFS partitions so when you tell it to boot, for example, "multi(0)disk(0)rdisk(0)partition(1)\WINDOWS" (which it reads from boot.ini), it will look in that folder on that partition load the NT kernel, hal, etc. and then the services (drivers and subsystems) will load in whatever order they're configured as in the registry (sort of like runlevels). Once that's done, the GUI starts up and depending on whether there's a security system (usually there is, unless the install was made with Windows Embedded and it was taken out), a user will have to authenticate themselves. After that, the default shell is loaded (usually explorer.exe) and whatever else is specified in the registry is executed, and XP will have finished booting. There's also a slightly different way of booting which does involve DOS, in which the partition with XP on it must be FAT32 (unless you have an NTFS driver loaded, although I've never tried it) and you run good old win.com as if you were booting Windows 3.x, and win.com will load the kernel and whatever else the way ntldr would. Also, when booting from DOS, win.com will completely wipe it from memory since XP has full hardware control and if you run any DOS apps from XP they will run from XP's DOS subsystem.

  • 0
Elagizy

what you said about running windows from dos going into the i386 folder etc, sound like you started the installation from dos and installed it that way, rather than booting from the cd. as for you autoexe.bat, thats probably a result of that process, from a clean install onto a blank hdd my autoexe.bat is empty!

as for testing an os to check if it will work on differewnt computers .... all computers are different, youd have to make sure your operating system could handle different types of hardware through some sort of divers or by embedding it all into one kernel (much the way bsd does things)

as for windows 95/98 AND me ... they all were based on the 9x kernel which was run in dos (yes me ran on dos but it was hidden from the user)

as for nt/2000/xp/2003 they all require the ntldr to boot the system and use one file mainly to run (ntoskrnl), THERE IS NO DOS anywhere with xp 2003 etc, trhey mainly use those files you talked about for legacy and configuration reasons

as for writting your own operating system, if you needed these questions answered your going to be in for a tough reason, to create anything usefull youll need to know assembly to bootstrap your system and id say a fair amount of c. Youd also do weel to look into compiler design!

http://www.ansanest.com/josh/ goes through the very very basic steps of creating a bootable os, all be it slow practically useless and basic!

http://cs.wwc.edu/~aabyan/464/Book/ that is a book on compiler design, if you want to look at how things go through and compile to usable code, usefull if you want to progress into a fuller featured environment

few notes

linux is the kernel of an os, the full os would be correctly referenced as GNU/linux as its the other (gnu) programs running on linux that make the os what it is, linux distributions all package different software!

dos is basically like a small kernel and a a load of applications making it useful! windows 95/98/me all used dos to boot and interact with some of the hardware

windows xp/2000/2003 uses the nt loader and nt kernel which is NOT WHERE NEAR to being dos!

freebsd openbsd and company all use one single kernel for interacting with all hardware and providing a lot of functionality, again its the packages by other authors that allow it to be usefull

if you really are stuggling to understand most of this id suggest a few things before going into fully fledged os design

1) maybe try going through something like a gentoo install/compilation to see how much that alone invloves and get a true sense of how it installs

2) maybe even try creating your own linux distribution, that alon is hard enough but not wuite as hard as making a nicly working os!

http://www.se.linuxfromscratch.org/lfs/news.html  linuxfromsctach is basically a free online book showing you how to build your own distibution (like gentoo but you do EVERYTHING) that would give you an excelent insight into it all and with it youd be handling souce code so by the end its your distribution and you can see all th work thats gone into it!

3) if linux isnt your thing id say get a working freedos environment and bootable http://www.freedos.org/ or http://freedos-32.sourceforge.net/ (a 32bit kernel for freedos) then from there start by coding your own envirment for it maybe? basically doing the step microsoft did with windows 3.1 ... making something usefull of a dos environment!

http://fxr.watson.org/ is a very cool site, you can explore a few kernels for yourself to see ALL the cod3e behind the very heart of the os! linux, bsd, darwin there all there and browsable so you can see what sort of coding is done to make something usefull and worthwhile!

585121668[/snapback]

Thank you wehttam, you got a lot of experience in this , your links is great i think i will spend all the holiday to read them

  • 0
I think he just confused autoexec.bat with autoexec.nt. Windows XP has an autoexec.nt and config.nt file in windows\system32 that gets run every time you run an old DOS app. The blank DOS files in the roor of the active HD are just there for legacy purposes so that any DOS apps that look for them don't crap themselves. As for Windows XP needing DOS to boot, it's not true in any sense. To elaborate on how berz explained the boot process, the boot process for XP is such (from what I know): the BIOS looks at the hard drive which you have configured to boot, reads the partition table and finds the active partition, uses the MBR to find the boot sector, and then executes it. The boot sector is already part of XP and it loads the boot loader (ntldr). ntldr has theability to either load another boot sector (such as one for Windows 9x if you're dual booting) or load an installation of NT. ntldr also has a minimal ability to read NTFS partitions so when you tell it to boot, for example, "multi(0)disk(0)rdisk(0)partition(1)\WINDOWS" (which it reads from boot.ini), it will look in that folder on that partition load the NT kernel, hal, etc. and then the services (drivers and subsystems) will load in whatever order they're configured as in the registry (sort of like runlevels). Once that's done, the GUI starts up and depending on whether there's a security system (usually there is, unless the install was made with Windows Embedded and it was taken out), a user will have to authenticate themselves. After that, the default shell is loaded (usually explorer.exe) and whatever else is specified in the registry is executed, and XP will have finished booting. There's also a slightly different way of booting which does involve DOS, in which the partition with XP on it must be FAT32 (unless you have an NTFS driver loaded, although I've never tried it) and you run good old win.com as if you were booting Windows 3.x, and win.com will load the kernel and whatever else the way ntldr would. Also, when booting from DOS, win.com will completely wipe it from memory since XP has full hardware control and if you run any DOS apps from XP they will run from XP's DOS subsystem.

585121673[/snapback]

:whistle: ooooooh , i understand now , seems reasonable for me , and i think i understand every line in BOOT.INI thanks for help

  • 0
Ok, but why when i setup WINDOWS XP in DOS !! ( when i goto in DOS and run smartdrv.exe then goto i386 and then winnt.exe ) that means that windows depends on DOS

No, that means that the WINNT.exe program depends on DOS. Which is not the same as Windows XP itself. XP doesn't need DOS. It uses "ntldr" to run. Nothing more.

also try to remove the 3 DOS files msdos.sys , io.sys, command.com , u will face a lot of troubles ........ all of that prove that Windows depends on DOS

Hmmm...

C:\>dir /ah
 Volume in drive C is Naomi
 Volume Serial Number is 6C57-3DED

 Directory of C:\

30/08/2004  12:15               211 boot.ini
18/12/2004  11:06     1,073,270,784 hiberfil.sys
30/08/2004  12:22                 0 IO.SYS
30/08/2004  12:22                 0 MSDOS.SYS
03/08/2004  21:38            47,564 NTDETECT.COM
03/08/2004  21:59           250,032 ntldr
18/12/2004  11:06     1,610,612,736 pagefile.sys
30/08/2004  14:27    <DIR>          RECYCLER
30/08/2004  12:27    <DIR>          System Volume Information
01/11/2004  20:01            23,821 _NavCClt.Log
               8 File(s)  2,684,205,148 bytes
               2 Dir(s)  64,280,051,712 bytes free

So, removing the two zero-length files IO.SYS and MSDOS.SYS will cause a "lot of troubles", will it? Oh dear.

COMMAND.COM is the MS-DOS command line interpreter. You can quite happily delete it. COMMAND.COM has been superseded by CMD.EXE anyway.

ok so tell me what is the files which make windows depends on emulated DOS ,

CMD.EXE. And COMMAND.COM if you want to use that (which you don't, as it's rubbish).

as i think smartdrv.exe makes the computer thinks that its working on winxp

SMARTDRV speeds up DOS drive I/O operations. See here. It has NOTHING to do with pretending to be XP.

yes u right but we must say that dos files was the KEY files to make you start windows

No, read this. It tells you how it all works. It uses NTLDR. Not DOS.

i wonder how this 3 intelligent dos files recognize all of that which are you talking about on different pcs with different bios and different devices ....... ohhhh amazing ........ i think IO.sys has the responsibility for this task.

How can IO.SYS, a zero-length file possibly do anything?

i think i have found an EQUIVALENT to this 3 files which windows in a bad need to them cause i always face some troubles with them when i got a virus and correct me if i am wrong , what about HIMEM.SYS, Hiberfil.sys, NTldr and finally you need to tell me what about ((((((((((((( CONFIG.DOS, BOOTSECT.DOS ))))))))) now i guess some body will say to me THAT IS THE EMULATED DOS , in my opinion it is exactly dos files but in other name

HIMEM.SYS is a throwback to the olden days. It's not relevant.

HIBERFIL.SYS is the file that is used when you put your computer into hibernation (i.e. when you do a soft power off).

NTLDR loads XP. It's called from the boot sector in your XP drive.

My AUTOEXEC.BAT file is empty (another of those very powerful zero-length files - how fearsome).

CONFIG.DOS and BOOTSECT.DOS are (according to MSDN) used when you plan to boot more than one operating system on your computer (e.g. XP and Me, and so on).

More resources:

NT boot process.

Boot sector.

Win2K boot process.

Files required to start Win2K.

  • 0
Hmmm...

C:\>dir /ah
 Volume in drive C is Naomi
 Volume Serial Number is 6C57-3DED

 Directory of C:\

30/08/2004 ?12:15 ? ? ? ? ? ? ? 211 boot.ini
18/12/2004 ?11:06 ? ? 1,073,270,784 hiberfil.sys
30/08/2004 ?12:22 ? ? ? ? ? ? ? ? 0 IO.SYS
30/08/2004 ?12:22 ? ? ? ? ? ? ? ? 0 MSDOS.SYS
03/08/2004 ?21:38 ? ? ? ? ? ?47,564 NTDETECT.COM
03/08/2004 ?21:59 ? ? ? ? ? 250,032 ntldr
18/12/2004 ?11:06 ? ? 1,610,612,736 pagefile.sys
30/08/2004 ?14:27 ? ?<DIR> ? ? ? ? ?RECYCLER
30/08/2004 ?12:27 ? ?<DIR> ? ? ? ? ?System Volume Information
01/11/2004 ?20:01 ? ? ? ? ? ?23,821 _NavCClt.Log
 ? ? ? ? ? ? ? 8 File(s) ?2,684,205,148 bytes
 ? ? ? ? ? ? ? 2 Dir(s) ?64,280,051,712 bytes free

So, removing the two zero-length files IO.SYS and MSDOS.SYS will cause a "lot of troubles", will it?  Oh dear.

COMMAND.COM is the MS-DOS command line interpreter.  You can quite happily delete it.  COMMAND.COM has been superseded by CMD.EXE anyway.

CMD.EXE.  And COMMAND.COM if you want to use that (which you don't, as it's rubbish).

SMARTDRV speeds up DOS drive I/O operations.  See here.  It has NOTHING to do with pretending to be XP.

No, read this.  It tells you how it all works.  It uses NTLDR.  Not DOS.

How can IO.SYS, a zero-length file possibly do anything?

HIMEM.SYS is a throwback to the olden days.  It's not relevant.

HIBERFIL.SYS is the file that is used when you put your computer into hibernation (i.e. when you do a soft power off).

NTLDR loads XP.  It's called from the boot sector in your XP drive.

My AUTOEXEC.BAT file is empty (another of those very powerful zero-length files - how fearsome).

CONFIG.DOS and BOOTSECT.DOS are (according to MSDN) used when you plan to boot more than one operating system on your computer (e.g. XP and Me, and so on).

More resources:

NT boot process.

Boot sector.

Win2K boot process.

Files required to start Win2K.

585121788[/snapback]

Thanks DrZoidberg for making this clear , i think my winxp is not a clean install and actually i don't have a bootable cd so i thought thats normal in any kind of installation. but can you tell me please why people said that windows longhorn will be faster in installing and in performance, they said it will be installed like as you are using a GHOST copy, is that true ?

  • 0
Longhorn will install quickly because it just copies an image of a pre-made installation over to the hard drive. After that it's just a matter of installing drivers and setting up users.

585122061[/snapback]

Do you mean it has the mechanism of Norton Ghost ?

  • 0
Ok, but why when i setup WINDOWS XP in DOS !! ( when i goto in DOS and run smartdrv.exe then goto i386 and then winnt.exe ) that means that windows depends on DOS

And if you had a good copy of the Windows CD AND your bios set to boot from the CD... You'd know that Windows NT does not need DOS to install ;)

  • 0
i think i have found an EQUIVALENT to this 3 files which windows in a bad need to them cause i always face some troubles with them when i got a virus and correct me if i am wrong , what about HIMEM.SYS, Hiberfil.sys, NTldr  and finally you need to tell me what about ((((((((((((( CONFIG.DOS, BOOTSECT.DOS ))))))))) now i guess some body will say to me THAT IS THE EMULATED DOS , in my opinion it is exactly dos files but in other name :)

585121581[/snapback]

:laugh: Do you even know what those files are?

himem.sys - DOS memory manager, superseded by Windows 9x, nonexistant in NT systems.

hiberfil.sys - Hibernation file for storing RAM contents during a hibernation.

NTLDR - Boot loader for NT systems.

config.dos - Old config.sys created by NT setup routine, config.sys is then erased.

bootsect.dos - Created by NT setup, the previous boot sector that launched DOS, used when booting into DOS via NT boot menu.

  • 0
lol , look what i found in autoexec.bat

SET windir=D:\WINXP

SET winbootdir=D:\WINXP

(((((((( SET COMSPEC=D:\WINXP\COMMAND.COM ))))))))

SET PATH=D:\WINXP;D:\WINXP\COMMAND

SET PROMPT=$p$g

SET TEMP=D:\WINXP\TEMP

SET TMP=D:\WINXP\TEMP

what do you think now gameguy ?

585121588[/snapback]

I think you found what XP setup wanted to be found by legacy applications. DOS applications are more or less emulated (not quite, but I don't know the right word) on XP, and those applications still have the ability (and right) to use autoexec.bat if they want to. Notice the third line, the comspec is command.com? Not in XP it isn't, but this file is only used by DOS applications, not Windows.

  • 0
DOS applications are more or less emulated (not quite, but I don't know the right word) on XP...

585123463[/snapback]

I guess the term would be virtualized. (or something similar). No emulation takes place. What happens is windows loads the program into memory, changes pages tables to make the memory look continuous and then creates a task. That task refers to the memory where the program is loaded, but also has the EFLAGS.VM bit set. When this new task is switched to, the processor will see the VM bit and switch to virtual mode. In virtual mode, the DOS program will act normally since as far as it's concerned, it's running in real mode (which is what DOS programs run in). If the dos programs executes a privilaged instruction or an exception occurs, control of the CPU is handed back to a piece of OS code called a virtual machine monitor. The monitor will handle the exception in such a way as to look normal to the DOS program. When done, execution is handed back to the DOS program until such a time as another exception occurs or a task switch. There are obviously a lot more details, but this is the jist of it.

  • 0
I think you found what XP setup wanted to be found by legacy applications. DOS applications are more or less emulated (not quite, but I don't know the right word) on XP, and those applications still have the ability (and right) to use autoexec.bat if they want to. Notice the third line, the comspec is command.com? Not in XP it isn't, but this file is only used by DOS applications, not Windows.

585123463[/snapback]

That's correct. NT OSes use a virtual machine in the form of ntvdm.exe that allows 16-bit programs to be run on 32-bit systems. You often see wow.exe, or something similar, in the process list, too. That's Windows On Windows which provides the framework for 16-bit windows apps to run. This is why there is still a system directory in addition to the system32 directory, and why many of the older libraries exist in an XP install. I think this article sums up all the legacy dependencies.

Backward compatibility was MS's focus. They knew it would be critical to allow for older apps to run on newer operating systems in order for them to gain/maintain dominance. I'm certain this trend will continue as we move toward 64-bit computing. It's made even better by CPUs supporting both 32 and 64-bit apps.

  • 0
I think you found what XP setup wanted to be found by legacy applications. DOS applications are more or less emulated (not quite, but I don't know the right word) on XP, and those applications still have the ability (and right) to use autoexec.bat if they want to. Notice the third line, the comspec is command.com? Not in XP it isn't, but this file is only used by DOS applications, not Windows.

585123463[/snapback]

BTW, i forgot to tell you that i have winme with winxp , is that a reason for making my autoexec.bat full of lines instead of being empty ?

and if the answer is yes , does it mean that winME needs dos to boot ?

  • 0

winme, contrary to popular beleif is actuall still dos based, and uses the windows 9x kernel, its just hidden from the user as opposed to windows 98, there are still ways to boot to dos when me is installed tho :D and its highly likely some of your odd files are to do with windowsme being installed

  • 0
Interesting discussion we have here but not many posts on how to make an operating system lol I suppose its a topic you could spend every hour of the day discussing and go on forever.

585127982[/snapback]

There is some posts including a very usefull links , you may need them without needing to read these posts.... ;)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Hello, Christian Maas' XVI32 is a nice (and very small) hex editor. Speaking of hex editors, many years ago a colleague and I who both worked at Tribal Voice managed to edit a copy of the company's PowWow instant messaging client to make it behave better now that all of its lookup servers and other server-side tech was gone.  The program didn't support NAT (RFC-3022 was introduced in January 2001, the same time Tribal Voice was shuttered), but it still worked okay if you manually set up port-forwarding on your router.  The server at http://powwow.jazy.net/ hosts a copy (usual warnings about downloading and running untrusted code from random internet servers apply). I occasionally use some tools like Funduc Software's Search and Replace and Application Mover when I need to make mass-edits to text-based files or move programs with a hard-coded installation directories, respectively.  When I need to figure out the exact LCD panel inside of a laptop, EnTech Taiwan's Monitor Asset Manager is my go-to tool for that purpose. JD Design's website (now hosted on github.io) has a number of interesting freeware and shareware utilities.  I used to use their TouchPro utility to set the file timestamps on software I was mastering to match its version number (e.g., version 3.00 of a program had all of its files dates set to 3:00AM, and so forth). Karenware has a number of interesting freeware utilities, too. Regards, Aryeh Goretsky  
    • I still use HexChat! Not really as ancient as the 1994 AutoCAD above my post, but I have never found anything better to replace it. Yes we still operate an IRC server https://www.neowin.net/irc/ 😛 
    • At work we still have a couple of people that use a version of AutoCAD LT purchased in 1994. This predates Windows 95 and works fine on versions of Windows up to XP. Its long since run in an locked down isolated XP VM, accessible via RDP. I did install LibreCAD for them, however they said it was just too different to get to grips with. In all fairness one of them is now 75 and the other is almost 60.
    • On my music making (non internet) PC Sony Acid Pro 7.0 Adobe Audition 2015 Korg Legacy Collection Windows 7 SP1
    • Anyway to download these versions without being on the Experimental builds?
  • Recent Achievements

    • Week One Done
      Jeroen Wilms earned a badge
      Week One Done
    • Week One Done
      rolfus earned a badge
      Week One Done
    • One Month Later
      Leroy Jethro Gibbs earned a badge
      One Month Later
    • Conversation Starter
      flexorcist earned a badge
      Conversation Starter
    • One Month Later
      AndreaB earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      509
    2. 2
      +Edouard
      198
    3. 3
      PsYcHoKiLLa
      138
    4. 4
      ATLien_0
      90
    5. 5
      Steven P.
      82
  • Tell a friend

    Love Neowin? Tell a friend!