mirror of
https://github.com/limine-bootloader/limine
synced 2024-11-27 02:49:56 +03:00
Merge pull request #57 from Matt8898/unstable
pxe: add stivale2 pxe server info tag
This commit is contained in:
commit
50541a7d05
11
STIVALE2.md
11
STIVALE2.md
@ -456,6 +456,17 @@ struct stivale2_smp_info {
|
||||
} __attribute__((packed));
|
||||
```
|
||||
|
||||
#### PXE server info structure tag
|
||||
|
||||
This tag reports that the kernel has been booted via PXE, and reports the server ip that it was booted from.
|
||||
|
||||
```c
|
||||
struct stivale2_struct_tag_pxe_server_info {
|
||||
struct stivale2_tag tag; // Identifier: 0x29d1e96239247032
|
||||
uint32_t server_ip; // Server ip in network byte order
|
||||
} __attribute__((packed));
|
||||
```
|
||||
|
||||
#### MMIO32 UART tag
|
||||
|
||||
This tag reports that there is a memory mapped UART port and its address. To write to this port, write the character, zero extended to a 32 bit unsigned integer to the address provided.
|
||||
|
BIN
limine-pxe.bin
BIN
limine-pxe.bin
Binary file not shown.
BIN
limine.bin
BIN
limine.bin
Binary file not shown.
BIN
stage2.map
BIN
stage2.map
Binary file not shown.
@ -80,7 +80,7 @@ void entry(uint8_t _boot_drive, int pxe_boot) {
|
||||
if (!strcmp(proto, "stivale")) {
|
||||
stivale_load(config, cmdline);
|
||||
} else if (!strcmp(proto, "stivale2")) {
|
||||
stivale2_load(config, cmdline);
|
||||
stivale2_load(config, cmdline, pxe_boot);
|
||||
} else if (!strcmp(proto, "linux")) {
|
||||
linux_load(config, cmdline);
|
||||
} else if (!strcmp(proto, "chainload")) {
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <fs/file.h>
|
||||
#include <mm/pmm.h>
|
||||
#include <stivale/stivale2.h>
|
||||
#include <pxe/tftp.h>
|
||||
|
||||
#define KASLR_SLIDE_BITMASK 0x03FFFF000u
|
||||
|
||||
@ -50,7 +51,7 @@ static void append_tag(struct stivale2_struct *s, struct stivale2_tag *tag) {
|
||||
s->tags = (uint64_t)(size_t)tag;
|
||||
}
|
||||
|
||||
void stivale2_load(char *config, char *cmdline) {
|
||||
void stivale2_load(char *config, char *cmdline, bool pxe) {
|
||||
struct file_handle *kernel = conv_mem_alloc(sizeof(struct file_handle));
|
||||
|
||||
char *kernel_path = config_get_value(config, 0, "KERNEL_PATH");
|
||||
@ -352,6 +353,15 @@ void stivale2_load(char *config, char *cmdline) {
|
||||
append_tag(&stivale2_struct, (struct stivale2_tag *)tag);
|
||||
}
|
||||
|
||||
{
|
||||
if (pxe) {
|
||||
struct stivale2_struct_tag_pxe_server_info *tag = conv_mem_alloc(sizeof(struct stivale2_struct_tag_pxe_server_info));
|
||||
tag->tag.identifier = STIVALE2_STRUCT_TAG_PXE_SERVER_INFO;
|
||||
tag->server_ip = get_boot_server_info();
|
||||
append_tag(&stivale2_struct, (struct stivale2_tag *)tag);
|
||||
}
|
||||
}
|
||||
|
||||
stivale_spinup(bits, level5pg && level5pg_requested, pagemap,
|
||||
entry_point, &stivale2_struct, stivale2_hdr.stack);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifndef __PROTOS__STIVALE2_H__
|
||||
#define __PROTOS__STIVALE2_H__
|
||||
|
||||
void stivale2_load(char *config, char *cmdline);
|
||||
void stivale2_load(char *config, char *cmdline, bool pxe);
|
||||
|
||||
#endif
|
||||
|
@ -6,7 +6,15 @@
|
||||
#include <mm/pmm.h>
|
||||
#include <lib/blib.h>
|
||||
|
||||
int tftp_open(struct tftp_file_handle* handle, uint32_t server_ip, uint16_t server_port, const char* name) {
|
||||
uint32_t get_boot_server_info() {
|
||||
struct pxenv_get_cached_info cachedinfo = { 0 };
|
||||
cachedinfo.packet_type = 2;
|
||||
pxe_call(PXENV_GET_CACHED_INFO, ((uint16_t)rm_seg(&cachedinfo)), (uint16_t)rm_off(&cachedinfo));
|
||||
struct bootph *ph = (struct bootph*)(void *) (((((uint32_t)cachedinfo.buffer) >> 16) << 4) + (((uint32_t)cachedinfo.buffer) & 0xFFFF));
|
||||
return ph->sip;
|
||||
}
|
||||
|
||||
int tftp_open(struct tftp_file_handle *handle, uint32_t server_ip, uint16_t server_port, const char *name) {
|
||||
int ret = 0;
|
||||
if (!server_ip) {
|
||||
struct pxenv_get_cached_info cachedinfo = { 0 };
|
||||
|
@ -47,5 +47,6 @@ struct pxenv_get_file_size {
|
||||
//server_ip and server_port can be 0 for default
|
||||
int tftp_open(struct tftp_file_handle* handle, uint32_t server_ip, uint16_t server_port, const char* name);
|
||||
int tftp_read(void *fd, void *buf, uint64_t loc, uint64_t count);
|
||||
uint32_t get_boot_server_info();
|
||||
|
||||
#endif
|
||||
|
@ -159,4 +159,11 @@ struct stivale2_struct_tag_smp {
|
||||
struct stivale2_smp_info smp_info[];
|
||||
} __attribute__((packed));
|
||||
|
||||
#define STIVALE2_STRUCT_TAG_PXE_SERVER_INFO 0x29d1e96239247032
|
||||
|
||||
struct stivale2_struct_tag_pxe_server_info {
|
||||
struct stivale2_tag tag;
|
||||
uint32_t server_ip;
|
||||
} __attribute__((packed));
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user