Bootstub: Increase the command line size in bootstub
BZ: 12336
Bootstub is currently allocated only 256 bytes for kernel boot command-line
options. The Android kernel boot command line options is getting larger and
with the current size of 256 bytes in size, it's not enough.
This patch added to increase the allocation of the kernel boot command-line
options to 1024 bytes in bootstub. Also, bump up the bootstub version to v1.2
Change-Id: Id8804359899ee1facb621de2cb8fd3c6ef4e14ad
Signed-off-by: Jeremy Compostella <jeremyx.compostella@intel.com>
Signed-off-by: Leonard Mai <leonard.mai@intel.com>
Reviewed-on: http://android.intel.com:8080/22416
Reviewed-by: Du, Alek <alek.du@intel.com>
Reviewed-by: Romieu, Benoit <benoit.romieu@intel.com>
Tested-by: Seibel, Eric <eric.seibel@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..8ea7489
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,9 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+bootstub: $(PRODUCT_OUT)/boot/bootstub
+
+$(PRODUCT_OUT)/boot/bootstub:
+ cd device/intel/bootstub/ && CC=$(ANDROID_BUILD_TOP)/$($(my_prefix)CC) CMDLINE_SIZE=$(BOARD_KERNEL_CMDLINE_SIZE) make
+ mkdir -p $(PRODUCT_OUT)/boot
+ mv device/intel/bootstub/bootstub $(PRODUCT_OUT)/boot
diff --git a/Makefile b/Makefile
index dcbb212..0fb7d0e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,7 @@
OBJ=bootstub.o spi-uart.o head.o sfi.o
-CFLAGS=-m32 -ffreestanding -Wall
+CMDLINE_SIZE ?= 0x400
+CFLAGS=-m32 -ffreestanding -Wall -DCMDLINE_SIZE=${CMDLINE_SIZE}
+CC ?= gcc
all: bootstub
@@ -13,16 +15,16 @@
ld -m elf_i386 -T bootstub.lds $(OBJ) -o $@
bootstub.o:bootstub.c bootstub.h
- gcc $(CFLAGS) -c bootstub.c
+ ${CC} $(CFLAGS) -c bootstub.c
spi-uart.o:spi-uart.c spi-uart.h
- gcc $(CFLAGS) -c spi-uart.c
+ ${CC} $(CFLAGS) -c spi-uart.c
sfi.o:sfi.c
- gcc $(CFLAGS) -c sfi.c
+ ${CC} $(CFLAGS) -c sfi.c
head.o:head.S bootstub.h
- gcc $(CFLAGS) -c head.S
+ ${CC} $(CFLAGS) -c head.S
clean:
rm -rf *.o *.bin *.elf *.bz2 *.rpm
diff --git a/VERSION b/VERSION
index bfc9838..84ff079 100644
--- a/VERSION
+++ b/VERSION
@@ -1,3 +1,4 @@
+1.2 add support to "large" kernel command line. Oct 20, 2011
1.1 add cloverview support. Oct 6, 2011
1.0 fix alignment issue in SFI mmap searching. Oct 13, 2010
0.9 support medfield. Jun 9, 2010
diff --git a/bootstub.c b/bootstub.c
index e115834..5e8fc1c 100644
--- a/bootstub.c
+++ b/bootstub.c
@@ -109,7 +109,7 @@
bp->alt_mem_k = 128*1024; // hard coded 128M mem here, since SFI will override it
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.cmdline_size = strnlen((const char *)CMDLINE_OFFSET, CMDLINE_SIZE);
bp->hdr.type_of_loader = 0xff; //bootstub is unknown bootloader for kernel :)
bp->hdr.ramdisk_size = *(u32 *)INITRD_SIZE_OFFSET;
bp->hdr.ramdisk_image = (bp->alt_mem_k*1024 - bp->hdr.ramdisk_size) & 0xFFFFF000;
@@ -187,7 +187,7 @@
setup_idt();
setup_gdt();
setup_spi();
- bs_printk("Bootstub Version: 1.1 ...\n");
+ bs_printk("Bootstub Version: 1.2 ...\n");
setup_boot_params((struct boot_params *)BOOT_PARAMS_OFFSET,
(struct setup_header *)SETUP_HEADER_OFFSET);
bs_printk("Jump to kernel 32bit entry ...\n");
diff --git a/bootstub.h b/bootstub.h
index 2bab652..cba655d 100644
--- a/bootstub.h
+++ b/bootstub.h
@@ -11,10 +11,10 @@
#define MRST_CPU_CHIP_CLOVERVIEW 3
#define CMDLINE_OFFSET 0x1100000
-#define BZIMAGE_SIZE_OFFSET 0x1100100
-#define INITRD_SIZE_OFFSET 0x1100104
-#define SPI_UART_SUPPRESSION 0x1100108
-#define SPI_TYPE 0x110010c /*0:SPI0 1:SPI1*/
+#define BZIMAGE_SIZE_OFFSET (CMDLINE_OFFSET + CMDLINE_SIZE)
+#define INITRD_SIZE_OFFSET (BZIMAGE_SIZE_OFFSET + 4)
+#define SPI_UART_SUPPRESSION (INITRD_SIZE_OFFSET + 4)
+#define SPI_TYPE (SPI_UART_SUPPRESSION + 4) /*0:SPI0 1:SPI1*/
#define STACK_OFFSET 0x1101000
#define BZIMAGE_OFFSET 0x1102000