Added a mini networking stack to the boot loader. It speaks basic ARP,
IP, and UDP, as well as a home brewn UDP based protocol, "remote disk",
which provides random access to a single remote file/device. The Open
Firmware flavored boot loader automatically initializes the net stack,
searches for a remote disk, and tries to boot from it, if the boot
device is a network device (e.g. when loading the boot loader via
TFTP).
This is quite nice for developing with a two-machine setup, since one
doesn't even need to install Haiku on the test machine anymore, but can
serve it directly from the development machine. When the networking
support in the kernel is working, this method could even be used to
fully boot, not just for loading kernel and initial modules.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15689 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-28 01:01:33 +03:00
|
|
|
/*
|
2007-08-14 18:54:09 +04:00
|
|
|
* Copyright 2005-2007, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
|
Added a mini networking stack to the boot loader. It speaks basic ARP,
IP, and UDP, as well as a home brewn UDP based protocol, "remote disk",
which provides random access to a single remote file/device. The Open
Firmware flavored boot loader automatically initializes the net stack,
searches for a remote disk, and tries to boot from it, if the boot
device is a network device (e.g. when loading the boot loader via
TFTP).
This is quite nice for developing with a two-machine setup, since one
doesn't even need to install Haiku on the test machine anymore, but can
serve it directly from the development machine. When the networking
support in the kernel is working, this method could even be used to
fully boot, not just for loading kernel and initial modules.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15689 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-28 01:01:33 +03:00
|
|
|
* All rights reserved. Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _BOOT_REMOTE_DISK_DEFS_H
|
|
|
|
#define _BOOT_REMOTE_DISK_DEFS_H
|
|
|
|
|
2007-08-14 18:54:09 +04:00
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
Added a mini networking stack to the boot loader. It speaks basic ARP,
IP, and UDP, as well as a home brewn UDP based protocol, "remote disk",
which provides random access to a single remote file/device. The Open
Firmware flavored boot loader automatically initializes the net stack,
searches for a remote disk, and tries to boot from it, if the boot
device is a network device (e.g. when loading the boot loader via
TFTP).
This is quite nice for developing with a two-machine setup, since one
doesn't even need to install Haiku on the test machine anymore, but can
serve it directly from the development machine. When the networking
support in the kernel is working, this method could even be used to
fully boot, not just for loading kernel and initial modules.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15689 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-28 01:01:33 +03:00
|
|
|
|
|
|
|
enum {
|
|
|
|
REMOTE_DISK_SERVER_PORT = 8765,
|
|
|
|
REMOTE_DISK_BLOCK_SIZE = 1024,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
// requests
|
|
|
|
|
|
|
|
REMOTE_DISK_HELLO_REQUEST = 0,
|
|
|
|
// port: client port
|
|
|
|
|
|
|
|
REMOTE_DISK_READ_REQUEST = 1,
|
|
|
|
// port: client port
|
|
|
|
// offset: byte offset of data to read
|
|
|
|
// size: number of bytes to read (server might serve more, though)
|
|
|
|
|
|
|
|
REMOTE_DISK_WRITE_REQUEST = 2,
|
|
|
|
// port: client port
|
|
|
|
// offset: byte offset of data to write
|
|
|
|
// size: number of bytes to write
|
|
|
|
// data: the data
|
|
|
|
|
|
|
|
// replies
|
|
|
|
|
|
|
|
REMOTE_DISK_HELLO_REPLY = 3,
|
|
|
|
// offset: disk size
|
|
|
|
|
|
|
|
REMOTE_DISK_READ_REPLY = 4, // port unused
|
|
|
|
// offset: byte offset of read data
|
|
|
|
// size: number of bytes of data read; < 0 => error
|
|
|
|
// data: read data
|
|
|
|
|
|
|
|
REMOTE_DISK_WRITE_REPLY = 5, // port, data unused
|
|
|
|
// offset: byte offset of data written
|
|
|
|
// size: number of bytes of data written; < 0 => error
|
|
|
|
};
|
|
|
|
|
|
|
|
// errors
|
|
|
|
enum {
|
|
|
|
REMOTE_DISK_IO_ERROR = -1,
|
|
|
|
REMOTE_DISK_BAD_REQUEST = -2,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct remote_disk_header {
|
|
|
|
uint64_t offset;
|
|
|
|
uint64_t request_id;
|
|
|
|
int16_t size;
|
|
|
|
uint16_t port;
|
|
|
|
uint8_t command;
|
|
|
|
uint8_t data[0];
|
|
|
|
} __attribute__ ((__packed__));
|
|
|
|
|
|
|
|
#endif // _BOOT_REMOTE_DISK_DEFS_H
|