summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlek Du <alek.du@intel.com>2008-05-14 16:59:04 +0800
committerPatrick Tjin <pattjin@google.com>2014-07-21 20:22:36 -0700
commitd6f7f14386617f7b8f5e2ded77bb7edaaac2a393 (patch)
tree62b5a280cf4f06b9475895f9faf7402860825b0d
parent1f2cc2d8ba24cedda84257b368b77ed2fa3d24a1 (diff)
downloadbootstub-d6f7f14386617f7b8f5e2ded77bb7edaaac2a393.tar.gz
* fix more
-rw-r--r--bootstub.c15
-rw-r--r--bootstub.h5
-rw-r--r--head.S8
3 files changed, 19 insertions, 9 deletions
diff --git a/bootstub.c b/bootstub.c
index 79a3a2b..1b3adf7 100644
--- a/bootstub.c
+++ b/bootstub.c
@@ -52,15 +52,28 @@ static void *memset(void *s, int c, size_t count)
return s;
}
+static size_t strnlen(const char *s, size_t maxlen)
+{
+ const char *es = s;
+ while (*es && maxlen) {
+ es++;
+ maxlen--;
+ }
+
+ return (es - s);
+}
+
+
static void setup_boot_params(struct boot_params *bp, struct setup_header *sh)
{
memset(bp, 0, sizeof (struct boot_params));
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;
memcpy(&bp->hdr, sh, sizeof (struct setup_header));
bp->hdr.cmd_line_ptr = CMDLINE_OFFSET;
- bp->hdr.cmdline_size = *(u32*)CMDLINE_SIZE;
+ 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;
}
diff --git a/bootstub.h b/bootstub.h
index 0354b4f..c6c7f90 100644
--- a/bootstub.h
+++ b/bootstub.h
@@ -5,9 +5,8 @@
#define _BOOT_STUB_HEAD
#define CMDLINE_OFFSET 0x100000
-#define CMDLINE_SIZE 0x100100
-#define INITRD_SIZE 0x100104
-#define INITRD_OFFSET 0x100108
+#define INITRD_SIZE 0x100100
+#define INITRD_OFFSET 0x100104
#define BZIMAGE_OFFSET 0x102000
#define STACK_OFFSET 0x101000
#define SETUP_HEADER_OFFSET (BZIMAGE_OFFSET + 0x1F1)
diff --git a/head.S b/head.S
index a66768c..4dec437 100644
--- a/head.S
+++ b/head.S
@@ -17,13 +17,11 @@
* | boot stub |
* 0x101000 +-----------------------+
* | free space |
- * | used as stack | MIC need to pad this to 0
- * 0x10010c +-----------------------+
- * | initramfs offset| MIC need to fill it
+ * | used as stack |
* 0x100108 +-----------------------+
- * | initramfs size | MIC need to fill it
+ * | initramfs offset| MIC need to fill it according to bzImage size
* 0x100104 +-----------------------+
- * | cmdline size | MIC need to fill it
+ * | initramfs size | MIC need to fill it according to initrd size
* 0x100100 +-----------------------+
* | kernel cmdline | MIC need to fill it
* 0x100000 +-----------------------+