* more more fix
diff --git a/bootstub.c b/bootstub.c
index 1b3adf7..f028c6d 100644
--- a/bootstub.c
+++ b/bootstub.c
@@ -70,12 +70,12 @@
bp->screen_info.orig_video_mode = 1;
bp->screen_info.orig_video_lines = 25;
bp->screen_info.orig_video_cols = 80;
- bp->alt_mem_k = 256*1024;
+ bp->alt_mem_k = *(u32 *)MEMORY_SIZE_OFFSET;
memcpy(&bp->hdr, sh, sizeof (struct setup_header));
bp->hdr.cmd_line_ptr = CMDLINE_OFFSET;
- bp->hdr.cmdline_size = strnlen((const char*)CMDLINE_OFFSET,256);
- bp->hdr.ramdisk_size = *(u32*)INITRD_SIZE;
- bp->hdr.ramdisk_image = *(u32*)INITRD_OFFSET + CMDLINE_OFFSET;
+ bp->hdr.cmdline_size = strnlen((const char *)CMDLINE_OFFSET,256);
+ bp->hdr.ramdisk_size = *(u32 *)INITRD_SIZE_OFFSET;
+ bp->hdr.ramdisk_image = BZIMAGE_OFFSET + *(u32 *)BZIMAGE_SIZE_OFFSET + *(u32 *)INITRD_SIZE_OFFSET;
}
static int get_32bit_entry(unsigned char *ptr)
@@ -94,7 +94,7 @@
setup_idt();
setup_gdt();
setup_boot_params((struct boot_params *)BOOT_PARAMS_OFFSET,
- (struct setup_header*)SETUP_HEADER_OFFSET);
+ (struct setup_header *)SETUP_HEADER_OFFSET);
return get_32bit_entry((unsigned char *)BZIMAGE_OFFSET);
}
diff --git a/bootstub.h b/bootstub.h
index c6c7f90..8ab0a75 100644
--- a/bootstub.h
+++ b/bootstub.h
@@ -4,11 +4,13 @@
#ifndef _BOOT_STUB_HEAD
#define _BOOT_STUB_HEAD
-#define CMDLINE_OFFSET 0x100000
-#define INITRD_SIZE 0x100100
-#define INITRD_OFFSET 0x100104
-#define BZIMAGE_OFFSET 0x102000
-#define STACK_OFFSET 0x101000
+#define CMDLINE_OFFSET 0x100000
+#define MEMORY_SIZE_OFFSET 0x100100
+#define BZIMAGE_SIZE_OFFSET 0x100104
+#define INITRD_SIZE_OFFSET 0x100108
+#define BZIMAGE_OFFSET 0x102000
+#define STACK_OFFSET 0x101000
+
#define SETUP_HEADER_OFFSET (BZIMAGE_OFFSET + 0x1F1)
#define SETUP_HEADER_SIZE (0x0202 + *(unsigned char*)(0x0201+BZIMAGE_OFFSET))
#define BOOT_PARAMS_OFFSET 0x8000
diff --git a/head.S b/head.S
index 4dec437..0dab98d 100644
--- a/head.S
+++ b/head.S
@@ -10,18 +10,20 @@
/* When bootstub get control, the memory map in DRAM is like:
* ~ ~
- * 0x102000 | initramfs |
- *+bzImage size +-----------------------+
+ * 0x102000 | initrd | initrd will move to high memory otherwise
+ *+bzImage size +-----------------------+ bzImage uncompressing will destory it
* | bzImage |
* 0x102000 +-----------------------+
* | boot stub |
* 0x101000 +-----------------------+
* | free space |
- * | used as stack |
+ * | used as stack |
+ * 0x10010c +-----------------------+
+ * | initrd size | MIC need to fill it according to bzImage size
* 0x100108 +-----------------------+
- * | initramfs offset| MIC need to fill it according to bzImage size
+ * | bzImage size | MIC need to fill it according to initrd size
* 0x100104 +-----------------------+
- * | initramfs size | MIC need to fill it according to initrd size
+ * | mem size | MIC need to fill it
* 0x100100 +-----------------------+
* | kernel cmdline | MIC need to fill it
* 0x100000 +-----------------------+