Network booting
Network booting
Hi, I'm new here as you could guess and have read a lot of pages from the wiki, which are already a great help to me as I've been wanting for years to make an OS. It mentions network booting, but I haven't seen anything there on how to go about doing such a thing, so does anyone know of a good tutorial or something to explain this?
I presume it'd be something along the lines of "have an image file on the server and install some program on said server, then choose X option from the BIOS on the target machine".
I have both Linux and Windows computers available, but would prefer to use a Linux server for this.
I presume it'd be something along the lines of "have an image file on the server and install some program on said server, then choose X option from the BIOS on the target machine".
I have both Linux and Windows computers available, but would prefer to use a Linux server for this.
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Right, for PXE booting... you need to run a DHCP and TFTP server.
http://en.wikipedia.org/wiki/Preboot_Ex ... nvironment
http://en.wikipedia.org/wiki/Preboot_Ex ... nvironment
Okay, I got that all working fine.
I have another question/problem now. Obviously, I'm really new to this, and I've been reading the babystep tutorial, but I'm not really succeeding in following it. As I interpret it, following the very first part with nasm/partcopy/whatever should create a 514 byte file, the first 2 bytes being EB FE (machine code for jmp hang), the last 2 bytes being 55 AA and all the others being zero. I tried manually making such a file and using it as the kernel image and it says it's corrupt or invalid.
I also tried a 512 byte file (with two zeros removed) as a size of 514 looked a bit suspicious, but that didn't work either.
I'm probably doing something horribly wrong, but I've completely run out of ideas of what to try or where to look for an answer now.
I have another question/problem now. Obviously, I'm really new to this, and I've been reading the babystep tutorial, but I'm not really succeeding in following it. As I interpret it, following the very first part with nasm/partcopy/whatever should create a 514 byte file, the first 2 bytes being EB FE (machine code for jmp hang), the last 2 bytes being 55 AA and all the others being zero. I tried manually making such a file and using it as the kernel image and it says it's corrupt or invalid.
I also tried a 512 byte file (with two zeros removed) as a size of 514 looked a bit suspicious, but that didn't work either.
I'm probably doing something horribly wrong, but I've completely run out of ideas of what to try or where to look for an answer now.
what says it is corrupt? when you try to write the image to a floppy? if so, that is because it is not FAT formatted, and you can get past that with using partcopy with a few extra parameters.
Website: https://joscor.com
So you actually try to net-boot that image? I'm afraid you've just created a floppy (or hd) boot sector - a netboot image should look differently. Look at the PXE specs for more information, unfortunately I can't point you to a nice tutorial on this as I haven't much experience in that area either.Hayate wrote:The bios on the test PC says the image is corrupt (it works fine with memtest86).
I can't use floppies because although my test pc has a floppy drive only 2 other computers in the house do and those are inconvenient to use. That's why I went with network booting.
EDIT: You could take a look at grub to do the network boot work for you, this would probably make you progress faster.
In any case you'll need a dhcp server in your local network segment (in your LAN). The tftp server could probably be anywhere reachable with ip - but since tftp is udp-based, you'll need a back route to the client.MarkOS wrote:I don't understand... With network booting we can boot our kernel from the internet or only from LAN?
Yet another <noobish post>...
Okay, I didn't find much useful stuff on the internet to do with whatever format these images are, so I just hex-searched memtest86 for the cld/cli at the start, which was located at 0A00. Copied everything before and appended my "jmp hang" and it actually works... so I moved onto the 2nd babystep page and now it restarts whenever it tries to execute the "mov %ax, %ds". Uhhm... any tips?
</noobish post>
Okay, I didn't find much useful stuff on the internet to do with whatever format these images are, so I just hex-searched memtest86 for the cld/cli at the start, which was located at 0A00. Copied everything before and appended my "jmp hang" and it actually works... so I moved onto the 2nd babystep page and now it restarts whenever it tries to execute the "mov %ax, %ds". Uhhm... any tips?
</noobish post>
This was a usefull link
http://home.dei.polimi.it/fornacia/prog ... index.html
But the .zip file links on the site do not seem to work, if you want them i may have them backed up somewhere on CD's ?, i can try and find them.
http://home.dei.polimi.it/fornacia/prog ... index.html
But the .zip file links on the site do not seem to work, if you want them i may have them backed up somewhere on CD's ?, i can try and find them.
Hi,
The BIOS/ROM code downloads your code to 0x0007C00 and (while in real mode) does a "jmp 0x0000:0x7C00" or a "jmp 0x07C0:0x0000" - can't remember which.
Your code can be any size that fits in RAM (e.g. 2 bytes, or 400 KB), as long as it doesn't overwrite the BIOS/ROM code (which is often running just below the EBDA at 0x00080000).
The BIOS/ROM code will download and start any file - it'd even try to execute a JPG picture of your grandparents (but that'd probably crash after it's started too).
Cheers,
Brendan
For PXE boot loaders, there is no image format (it's a flat binary).Hayate wrote:Okay, I didn't find much useful stuff on the internet to do with whatever format these images are, so I just hex-searched memtest86 for the cld/cli at the start, which was located at 0A00. Copied everything before and appended my "jmp hang" and it actually works...
The BIOS/ROM code downloads your code to 0x0007C00 and (while in real mode) does a "jmp 0x0000:0x7C00" or a "jmp 0x07C0:0x0000" - can't remember which.
Your code can be any size that fits in RAM (e.g. 2 bytes, or 400 KB), as long as it doesn't overwrite the BIOS/ROM code (which is often running just below the EBDA at 0x00080000).
The BIOS/ROM code will download and start any file - it'd even try to execute a JPG picture of your grandparents (but that'd probably crash after it's started too).
In real mode, it's impossible for "mov ds, ax" to cause an exception. Maybe you need to put something like "jmp $" after the "mov ds, ax" so that the CPU doesn't try to execute random crud left in RAM after the "mov ds, ax". Maybe you need to make sure your code is 16-bit real mode code (and not 32-bit code). I don't know.Hayate wrote:so I moved onto the 2nd babystep page and now it restarts whenever it tries to execute the "mov %ax, %ds". Uhhm... any tips?
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Well, I figured out why it wasn't working properly - it was set to load it as a Linux kernel, not a PXE image, so I put the .0 extension on the end and removed the $A00-byte header and it worked... ish. Now the problem is that it doesn't print the right thing. It prints the following: a dot, newline, capital S, and space.
Here's the code I currently have:
edit: I changed the "msg" to "$msg" on the 3rd line, because an offset of $1a35 looked kinda suspicious, and now it prints a load of garbage on the screen in various colors...
Here's the code I currently have:
Code: Select all
mov $0x07c0, %ax;
mov %ax, %ds;
mov msg, %si;
ch_loop:
lodsb; # load char into al
or %al, %al; # zero = end of str
jz hang; # get out
mov $0x0E, %ah;
int $0x10;
jmp ch_loop;
hang:
jmp hang;
msg:
.ascii "This string will be printed";
.byte 13, 10, 0;
Well, /now/ it works. It turns out I had to set esi to the actual address of the message, not its offset from ds... here's the line:
Thanks for your help everyone, I guess I'll move on and try and do the next bits, but I'll probably be coming back with another question soon
edit: yes, I am... why can't I write directly to text video memory?
This should put an "a" on the screen (in white on blue), but it does nothing.
Code: Select all
mov $msg+0x7c00, %esi;
edit: yes, I am... why can't I write directly to text video memory?
Code: Select all
mov $0xb800, %ax;
mov %ax, %es;
mov $0, %bx;
movw $0x1f41, %es:bx;
I don't use at&t syntax, but I thought to write to a segmented address you had to use the format r : (r).
I think should be
but it would not surprise me if I was horribly wrong.
Code: Select all
mov $0xb800, %ax;
mov %ax, %es;
mov $0, %bx;
movw $0x1f41, %es:bx;
Code: Select all
mov $0xb800, %ax;
mov %ax, %es;
mov $0, %bx;
movw $0x1f41, %es:(%bx);
Website: https://joscor.com