mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] Various fixes to make barebox's x86 support working again
@ 2011-03-08 14:48 Juergen Beisert
  2011-03-08 14:48 ` [PATCH 01/10] x86: Remove not used expressions from the makefile Juergen Beisert
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Juergen Beisert @ 2011-03-08 14:48 UTC (permalink / raw)
  To: barebox

The x86 architecture is currently broken. I already sent this patch stack a
while ago, but it did not find the way into the repository yet.

At least the "[PATCH 02/10] x86: Use the generic linker script initializing"
is a candidate for barebox-master, as it fixes a build time error.

jbe


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 01/10] x86: Remove not used expressions from the makefile
  2011-03-08 14:48 [PATCH] Various fixes to make barebox's x86 support working again Juergen Beisert
@ 2011-03-08 14:48 ` Juergen Beisert
  2011-03-08 14:48 ` [PATCH 02/10] x86: Use the generic linker script initializing Juergen Beisert
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Juergen Beisert @ 2011-03-08 14:48 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/x86/Makefile |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 8ab40b6..e607b89 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -14,11 +14,6 @@ CPPFLAGS += -fdata-sections -ffunction-sections
 LDFLAGS_uboot += -static --gc-sections
 endif
 
-ifeq ($(incdir-y),)
-incdir-y := $(machine-y)
-endif
-INCDIR   := arch-$(incdir-y)
-
 all: $(KBUILD_IMAGE)
 
 
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 02/10] x86: Use the generic linker script initializing
  2011-03-08 14:48 [PATCH] Various fixes to make barebox's x86 support working again Juergen Beisert
  2011-03-08 14:48 ` [PATCH 01/10] x86: Remove not used expressions from the makefile Juergen Beisert
@ 2011-03-08 14:48 ` Juergen Beisert
  2011-03-08 14:48 ` [PATCH 03/10] x86 ATA: Don't touch the size entry for the BIOS disk based device Juergen Beisert
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Juergen Beisert @ 2011-03-08 14:48 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/x86/Makefile                             |    6 ++
 arch/x86/include/asm/barebox.lds.h            |  113 -------------------------
 arch/x86/lib/barebox.lds.S                    |    2 +-
 arch/x86/mach-i386/include/mach/barebox.lds.h |   99 ++++++++++++++++++++++
 include/asm-generic/barebox.lds.h             |    2 +-
 scripts/setupmbr/setupmbr.c                   |    2 +-
 6 files changed, 108 insertions(+), 116 deletions(-)
 delete mode 100644 arch/x86/include/asm/barebox.lds.h
 create mode 100644 arch/x86/mach-i386/include/mach/barebox.lds.h

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index e607b89..3b034c0 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -19,7 +19,13 @@ all: $(KBUILD_IMAGE)
 
 
 
+machdirs := $(patsubst %,arch/x86/mach-%/,$(machine-y))
 
+ifeq ($(KBUILD_SRC),)
+CPPFLAGS += $(patsubst %,-I%include,$(machdirs))
+else
+CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs))
+endif
 
 ifneq ($(board-y),)
 BOARD  := arch/x86/boards/$(board-y)/
diff --git a/arch/x86/include/asm/barebox.lds.h b/arch/x86/include/asm/barebox.lds.h
deleted file mode 100644
index 6cbf15f..0000000
--- a/arch/x86/include/asm/barebox.lds.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2009 Juergen Beisert, Pengutronix
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- */
-
-/**
- * @file
- * @brief Adapt linker script content in accordance to Kconfig settings
- */
-
-#define INITCALLS			\
-	KEEP(*(.initcall.0))			\
-	KEEP(*(.initcall.1))			\
-	KEEP(*(.initcall.2))			\
-	KEEP(*(.initcall.3))			\
-	KEEP(*(.initcall.4))			\
-	KEEP(*(.initcall.5))			\
-	KEEP(*(.initcall.6))			\
-	KEEP(*(.initcall.7))
-
-#define BAREBOX_CMDS	KEEP(*(SORT_BY_NAME(.barebox_cmd*)))
-
-#define BAREBOX_SYMS	KEEP(*(__usymtab))
-
-/**
- * Area in the MBR of the barebox basic boot code. This offset must be in
- * accordance to the 'indirect_sector_lba' label.
- */
-#define PATCH_AREA 400
-
-/**
- * Offset where to store the boot drive number (BIOS number, 1 byte)
- */
-#define PATCH_AREA_BOOT_DEV 16
-
-/**
- * Offset where to store information about the persistant environment storage
- * It points to an LBA number (8 bytes) and defines the first sector of this
- * storage on disk.
- */
-#define PATCH_AREA_PERS_START 20
-
-/**
- * Offset where to store information about the persistant environment storage
- * It points to a short number (2 bytes) and defines the sector count of this
- * storage on disk.
- */
-#define PATCH_AREA_PERS_SIZE 28
-
-/**
- * Offset where to store information about the persistant environment storage
- * drive number (BIOS number, 1 byte)
- */
-#define PATCH_AREA_PERS_DRIVE 30
-
-/**
- * Mark the persistant environment as not used
- */
-#define PATCH_AREA_PERS_SIZE_UNUSED 0x000
-
-/**
- * Mark a DAPS as unused/invalid
- */
-#define MARK_DAPS_INVALID 0x0000
-
-/**
- * Offset of the partition table in an MBR
- */
-#define OFFSET_OF_PARTITION_TABLE 446
-
-/**
- * Offset of the signature in an MBR
- */
-#define OFFSET_OF_SIGNATURE 510
-
-/**
- * Area where to store indirect sector to loop through. Keep this value
- * in accordance to the 'indirect_area' label. Note: .
- *
- * @attention These addresses are real mode ones (seg:offset)
- */
-#define INDIRECT_AREA 0x7A00
-#define INDIRECT_SEGMENT 0x0000
-
-/**
- * Area where to load sectors from disk to. They should start after the
- * MBR area and must be in accordance to the offset of the '.bootstrapping'
- * section in the linker file.
- *
- * @attention The address must be a multiple of 512.
- */
-#define LOAD_AREA 0x7e00
-#define LOAD_SEGMENT 0x0000
-
-/**
- * Size of one sector.
- */
-#define SECTOR_SIZE 512
diff --git a/arch/x86/lib/barebox.lds.S b/arch/x86/lib/barebox.lds.S
index e0919a6..fffc3a5 100644
--- a/arch/x86/lib/barebox.lds.S
+++ b/arch/x86/lib/barebox.lds.S
@@ -20,7 +20,7 @@
  */
 
 #undef i386
-#include <asm/barebox.lds.h>
+#include <asm-generic/barebox.lds.h>
 
 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
 OUTPUT_ARCH(i386)
diff --git a/arch/x86/mach-i386/include/mach/barebox.lds.h b/arch/x86/mach-i386/include/mach/barebox.lds.h
new file mode 100644
index 0000000..81c326e
--- /dev/null
+++ b/arch/x86/mach-i386/include/mach/barebox.lds.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2009 Juergen Beisert, Pengutronix
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+/**
+ * @file
+ * @brief Adapt linker script content in accordance to Kconfig settings
+ */
+
+/**
+ * Area in the MBR of the barebox basic boot code. This offset must be in
+ * accordance to the 'indirect_sector_lba' label.
+ */
+#define PATCH_AREA 400
+
+/**
+ * Offset where to store the boot drive number (BIOS number, 1 byte)
+ */
+#define PATCH_AREA_BOOT_DEV 16
+
+/**
+ * Offset where to store information about the persistant environment storage
+ * It points to an LBA number (8 bytes) and defines the first sector of this
+ * storage on disk.
+ */
+#define PATCH_AREA_PERS_START 20
+
+/**
+ * Offset where to store information about the persistant environment storage
+ * It points to a short number (2 bytes) and defines the sector count of this
+ * storage on disk.
+ */
+#define PATCH_AREA_PERS_SIZE 28
+
+/**
+ * Offset where to store information about the persistant environment storage
+ * drive number (BIOS number, 1 byte)
+ */
+#define PATCH_AREA_PERS_DRIVE 30
+
+/**
+ * Mark the persistant environment as not used
+ */
+#define PATCH_AREA_PERS_SIZE_UNUSED 0x000
+
+/**
+ * Mark a DAPS as unused/invalid
+ */
+#define MARK_DAPS_INVALID 0x0000
+
+/**
+ * Offset of the partition table in an MBR
+ */
+#define OFFSET_OF_PARTITION_TABLE 446
+
+/**
+ * Offset of the signature in an MBR
+ */
+#define OFFSET_OF_SIGNATURE 510
+
+/**
+ * Area where to store indirect sector to loop through. Keep this value
+ * in accordance to the 'indirect_area' label. Note: .
+ *
+ * @attention These addresses are real mode ones (seg:offset)
+ */
+#define INDIRECT_AREA 0x7A00
+#define INDIRECT_SEGMENT 0x0000
+
+/**
+ * Area where to load sectors from disk to. They should start after the
+ * MBR area and must be in accordance to the offset of the '.bootstrapping'
+ * section in the linker file.
+ *
+ * @attention The address must be a multiple of 512.
+ */
+#define LOAD_AREA 0x7e00
+#define LOAD_SEGMENT 0x0000
+
+/**
+ * Size of one sector.
+ */
+#define SECTOR_SIZE 512
diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h
index fc141a4..2d1dc41 100644
--- a/include/asm-generic/barebox.lds.h
+++ b/include/asm-generic/barebox.lds.h
@@ -1,5 +1,5 @@
 
-#if defined CONFIG_ARCH_IMX25 || defined CONFIG_ARCH_IMX35 || defined CONFIG_ARCH_IMX51
+#if defined CONFIG_ARCH_IMX25 || defined CONFIG_ARCH_IMX35 || defined CONFIG_ARCH_IMX51 || defined CONFIG_X86
 #include <mach/barebox.lds.h>
 #endif
 
diff --git a/scripts/setupmbr/setupmbr.c b/scripts/setupmbr/setupmbr.c
index dd7f38c..74ede94 100644
--- a/scripts/setupmbr/setupmbr.c
+++ b/scripts/setupmbr/setupmbr.c
@@ -43,7 +43,7 @@
 
 /* include the info from this barebox release */
 #include "../../include/generated/utsrelease.h"
-#include "../../arch/x86/include/asm/barebox.lds.h"
+#include "../../arch/x86/mach-i386/include/mach/barebox.lds.h"
 
 /** define to disable integrity tests and debug messages */
 #define NDEBUG
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 03/10] x86 ATA: Don't touch the size entry for the BIOS disk based device
  2011-03-08 14:48 [PATCH] Various fixes to make barebox's x86 support working again Juergen Beisert
  2011-03-08 14:48 ` [PATCH 01/10] x86: Remove not used expressions from the makefile Juergen Beisert
  2011-03-08 14:48 ` [PATCH 02/10] x86: Use the generic linker script initializing Juergen Beisert
@ 2011-03-08 14:48 ` Juergen Beisert
  2011-03-08 14:48 ` [PATCH 04/10] x86 Generic platform: Fix some typos Juergen Beisert
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Juergen Beisert @ 2011-03-08 14:48 UTC (permalink / raw)
  To: barebox

Only the platform sets this entry to setup the correct size or
signals the driver to guess the size of the attached disk.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 drivers/ata/bios.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/ata/bios.c b/drivers/ata/bios.c
index 51e2425..3f419cc 100644
--- a/drivers/ata/bios.c
+++ b/drivers/ata/bios.c
@@ -257,7 +257,6 @@ static int biosdisk_probe(struct device_d *dev)
 
 		strcpy(drive_dev->name, "biosdisk");
 		drive_dev->id = drive - 0x80;
-		drive_dev->size = 1;
 		drive_dev->map_base = 0;
 		drive_dev->platform_data = p;
 
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 04/10] x86 Generic platform: Fix some typos
  2011-03-08 14:48 [PATCH] Various fixes to make barebox's x86 support working again Juergen Beisert
                   ` (2 preceding siblings ...)
  2011-03-08 14:48 ` [PATCH 03/10] x86 ATA: Don't touch the size entry for the BIOS disk based device Juergen Beisert
@ 2011-03-08 14:48 ` Juergen Beisert
  2011-03-08 14:48 ` [PATCH 05/10] x86 Generic platform: Fix disk drive name Juergen Beisert
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Juergen Beisert @ 2011-03-08 14:48 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/x86/boards/x86_generic/generic_pc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/boards/x86_generic/generic_pc.c b/arch/x86/boards/x86_generic/generic_pc.c
index b9c31aa..e156e0d 100644
--- a/arch/x86/boards/x86_generic/generic_pc.c
+++ b/arch/x86/boards/x86_generic/generic_pc.c
@@ -58,7 +58,7 @@ extern uint16_t pers_env_size;
 extern uint8_t pers_env_drive;
 
 /**
- * Persistant environment "not used" marker.
+ * Persistent environment "not used" marker.
  * Note: Must be in accordance to the value the tool "setup_mbr" writes.
  */
 #define PATCH_AREA_PERS_SIZE_UNUSED 0x000
@@ -80,7 +80,7 @@ static int devices_init(void)
 				DEVFS_PARTITION_FIXED, "env0");
 		printf("Partition: %d\n", rc);
 	} else
-		printf("No persistant storage defined\n");
+		printf("No persistent storage defined\n");
 
         return 0;
 }
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 05/10] x86 Generic platform: Fix disk drive name
  2011-03-08 14:48 [PATCH] Various fixes to make barebox's x86 support working again Juergen Beisert
                   ` (3 preceding siblings ...)
  2011-03-08 14:48 ` [PATCH 04/10] x86 Generic platform: Fix some typos Juergen Beisert
@ 2011-03-08 14:48 ` Juergen Beisert
  2011-03-08 14:48 ` [PATCH 06/10] x86 Generic platform: Fix prompt name Juergen Beisert
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Juergen Beisert @ 2011-03-08 14:48 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/x86/boards/x86_generic/generic_pc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/boards/x86_generic/generic_pc.c b/arch/x86/boards/x86_generic/generic_pc.c
index e156e0d..bfa94b9 100644
--- a/arch/x86/boards/x86_generic/generic_pc.c
+++ b/arch/x86/boards/x86_generic/generic_pc.c
@@ -74,7 +74,7 @@ static int devices_init(void)
 	register_device(&bios_disk_dev);
 
 	if (pers_env_size != PATCH_AREA_PERS_SIZE_UNUSED) {
-		rc = devfs_add_partition("disk0",	/* FIXME */
+		rc = devfs_add_partition("biosdisk0",
 				pers_env_storage * 512,
 				(unsigned)pers_env_size * 512,
 				DEVFS_PARTITION_FIXED, "env0");
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 06/10] x86 Generic platform: Fix prompt name
  2011-03-08 14:48 [PATCH] Various fixes to make barebox's x86 support working again Juergen Beisert
                   ` (4 preceding siblings ...)
  2011-03-08 14:48 ` [PATCH 05/10] x86 Generic platform: Fix disk drive name Juergen Beisert
@ 2011-03-08 14:48 ` Juergen Beisert
  2011-03-08 14:48 ` [PATCH 07/10] x86: Remove 'uboot' from file names Juergen Beisert
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Juergen Beisert @ 2011-03-08 14:48 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/x86/configs/generic_defconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/configs/generic_defconfig b/arch/x86/configs/generic_defconfig
index ee13e5c..57161f4 100644
--- a/arch/x86/configs/generic_defconfig
+++ b/arch/x86/configs/generic_defconfig
@@ -2,7 +2,7 @@ CONFIG_X86_HDBOOT=y
 CONFIG_STACK_SIZE=0x7000
 CONFIG_BROKEN=y
 CONFIG_EXPERIMENTAL=y
-CONFIG_PROMPT="uboot:"
+CONFIG_PROMPT="barebox:"
 CONFIG_LONGHELP=y
 CONFIG_GLOB=y
 CONFIG_CMDLINE_EDITING=y
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 07/10] x86: Remove 'uboot' from file names
  2011-03-08 14:48 [PATCH] Various fixes to make barebox's x86 support working again Juergen Beisert
                   ` (5 preceding siblings ...)
  2011-03-08 14:48 ` [PATCH 06/10] x86 Generic platform: Fix prompt name Juergen Beisert
@ 2011-03-08 14:48 ` Juergen Beisert
  2011-03-08 14:48 ` [PATCH 08/10] Change 'linux16' command to use getopt() Juergen Beisert
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Juergen Beisert @ 2011-03-08 14:48 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 arch/x86/boot/Makefile          |    2 +-
 arch/x86/boot/boot_hdisk.S      |    2 +-
 arch/x86/boot/prepare_barebox.c |   86 +++++++++++++++++++++++++++++++++++++++
 arch/x86/boot/prepare_uboot.c   |   86 ---------------------------------------
 4 files changed, 88 insertions(+), 88 deletions(-)
 create mode 100644 arch/x86/boot/prepare_barebox.c
 delete mode 100644 arch/x86/boot/prepare_uboot.c

diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index b92b475..83526b6 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -6,7 +6,7 @@ CPPFLAGS += -D__I386__ -fno-strict-aliasing -m32 -g -Os -march=i386 \
 
 obj-$(CONFIG_X86_HDBOOT)	+= boot_main.o boot_hdisk.o
 
-obj-$(CONFIG_X86_BIOS_BRINGUP)	+= prepare_uboot.o a20.o bioscall.o regs.o tty.o pmjump.o main_entry.o
+obj-$(CONFIG_X86_BIOS_BRINGUP)	+= prepare_barebox.o a20.o bioscall.o regs.o tty.o pmjump.o main_entry.o
 
 obj-$(CONFIG_X86_VESA) += console_vesa.o
 obj-$(CONFIG_X86_VGA) += console_vga.o
diff --git a/arch/x86/boot/boot_hdisk.S b/arch/x86/boot/boot_hdisk.S
index fc4c4d5..9145ef1 100644
--- a/arch/x86/boot/boot_hdisk.S
+++ b/arch/x86/boot/boot_hdisk.S
@@ -168,7 +168,7 @@ output_message:
 
 	.section .boot_data
 
-notification_string:	.asciz "UBOOT2 "
+notification_string:	.asciz "BAREBOX "
 chs_string:	.asciz "CHS "
 jmp_string:	.asciz "JMP "
 
diff --git a/arch/x86/boot/prepare_barebox.c b/arch/x86/boot/prepare_barebox.c
new file mode 100644
index 0000000..a68aced
--- /dev/null
+++ b/arch/x86/boot/prepare_barebox.c
@@ -0,0 +1,86 @@
+/* -*- linux-c -*- ------------------------------------------------------- *
+ *
+ *   Copyright (C) 1991, 1992 Linus Torvalds
+ *   Copyright 2007 rPath, Inc. - All Rights Reserved
+ *
+ *   This file is part of the Linux kernel, and is made available under
+ *   the terms of the GNU General Public License version 2.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * Prepare the machine for transition to protected mode.
+ */
+#include <asm/segment.h>
+#include <asm/modes.h>
+#include <asm/io.h>
+#include "boot.h"
+
+/* be aware of: */
+THIS_IS_REALMODE_CODE
+
+/*
+ * While we are in flat mode, we can't handle interrupts. But we can't
+ * switch them off for ever in the PIC, because we need them again while
+ * entering real mode code again and again....
+ */
+static void __bootcode realmode_switch_hook(void)
+{
+	asm volatile("cli");
+	outb(0x80, 0x70); /* Disable NMI */
+	io_delay();
+}
+
+/*
+ * Reset IGNNE# if asserted in the FPU.
+ */
+static void __bootcode reset_coprocessor(void)
+{
+	outb(0, 0xf0);
+	io_delay();
+	outb(0, 0xf1);
+	io_delay();
+}
+
+/**
+ * Setup and register the global descriptor table (GDT)
+ *
+ * @note This is for the first time only
+ */
+static void __bootcode setup_gdt(void)
+{
+	/* Xen HVM incorrectly stores a pointer to the gdt_ptr, instead
+	   of the gdt_ptr contents.  Thus, make it static so it will
+	   stay in memory, at least long enough that we switch to the
+	   proper kernel GDT. */
+	static struct gdt_ptr __bootdata gdt_ptr;
+
+	gdt_ptr.len = gdt_size - 1;
+	gdt_ptr.ptr = (uint32_t)&gdt + (ds() << 4);
+
+	asm volatile("lgdtl %0" : : "m" (gdt_ptr));
+}
+
+static char a20_message[] __bootdata = "A20 gate not responding, unable to boot...\n";
+
+/*
+ * Actual invocation sequence
+ */
+void __bootcode start_pre_uboot(void)
+{
+	/* Hook before leaving real mode, also disables interrupts */
+	realmode_switch_hook();
+
+	/* Enable the A20 gate */
+	if (enable_a20()) {
+		boot_puts(a20_message);
+		die();
+	}
+
+	/* Reset coprocessor (IGNNE#) */
+	reset_coprocessor();
+
+	setup_gdt();
+	/* Actual transition to protected mode... */
+	protected_mode_jump();
+}
diff --git a/arch/x86/boot/prepare_uboot.c b/arch/x86/boot/prepare_uboot.c
deleted file mode 100644
index a68aced..0000000
--- a/arch/x86/boot/prepare_uboot.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- linux-c -*- ------------------------------------------------------- *
- *
- *   Copyright (C) 1991, 1992 Linus Torvalds
- *   Copyright 2007 rPath, Inc. - All Rights Reserved
- *
- *   This file is part of the Linux kernel, and is made available under
- *   the terms of the GNU General Public License version 2.
- *
- * ----------------------------------------------------------------------- */
-
-/*
- * Prepare the machine for transition to protected mode.
- */
-#include <asm/segment.h>
-#include <asm/modes.h>
-#include <asm/io.h>
-#include "boot.h"
-
-/* be aware of: */
-THIS_IS_REALMODE_CODE
-
-/*
- * While we are in flat mode, we can't handle interrupts. But we can't
- * switch them off for ever in the PIC, because we need them again while
- * entering real mode code again and again....
- */
-static void __bootcode realmode_switch_hook(void)
-{
-	asm volatile("cli");
-	outb(0x80, 0x70); /* Disable NMI */
-	io_delay();
-}
-
-/*
- * Reset IGNNE# if asserted in the FPU.
- */
-static void __bootcode reset_coprocessor(void)
-{
-	outb(0, 0xf0);
-	io_delay();
-	outb(0, 0xf1);
-	io_delay();
-}
-
-/**
- * Setup and register the global descriptor table (GDT)
- *
- * @note This is for the first time only
- */
-static void __bootcode setup_gdt(void)
-{
-	/* Xen HVM incorrectly stores a pointer to the gdt_ptr, instead
-	   of the gdt_ptr contents.  Thus, make it static so it will
-	   stay in memory, at least long enough that we switch to the
-	   proper kernel GDT. */
-	static struct gdt_ptr __bootdata gdt_ptr;
-
-	gdt_ptr.len = gdt_size - 1;
-	gdt_ptr.ptr = (uint32_t)&gdt + (ds() << 4);
-
-	asm volatile("lgdtl %0" : : "m" (gdt_ptr));
-}
-
-static char a20_message[] __bootdata = "A20 gate not responding, unable to boot...\n";
-
-/*
- * Actual invocation sequence
- */
-void __bootcode start_pre_uboot(void)
-{
-	/* Hook before leaving real mode, also disables interrupts */
-	realmode_switch_hook();
-
-	/* Enable the A20 gate */
-	if (enable_a20()) {
-		boot_puts(a20_message);
-		die();
-	}
-
-	/* Reset coprocessor (IGNNE#) */
-	reset_coprocessor();
-
-	setup_gdt();
-	/* Actual transition to protected mode... */
-	protected_mode_jump();
-}
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 08/10] Change 'linux16' command to use getopt()
  2011-03-08 14:48 [PATCH] Various fixes to make barebox's x86 support working again Juergen Beisert
                   ` (6 preceding siblings ...)
  2011-03-08 14:48 ` [PATCH 07/10] x86: Remove 'uboot' from file names Juergen Beisert
@ 2011-03-08 14:48 ` Juergen Beisert
  2011-03-08 14:48 ` [PATCH 09/10] LINUX16: Add selection of the VESA video mode Juergen Beisert
  2011-03-08 14:48 ` [PATCH 10/10] LINUX16: Fix warning Juergen Beisert
  9 siblings, 0 replies; 12+ messages in thread
From: Juergen Beisert @ 2011-03-08 14:48 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 commands/linux16.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/commands/linux16.c b/commands/linux16.c
index 5f412e2..87245d4 100644
--- a/commands/linux16.c
+++ b/commands/linux16.c
@@ -28,6 +28,7 @@
 #include <environment.h>
 #include <fs.h>
 #include <errno.h>
+#include <getopt.h>
 #include <malloc.h>
 #include <asm/syslib.h>
 
@@ -153,18 +154,25 @@ struct linux_kernel_header {
 static int do_linux16(struct command *cmdtp, int argc, char *argv[])
 {
 	struct linux_kernel_header *lh = NULL;
-	int rc;
+	int rc, opt;
 	unsigned setup_sects;
 	unsigned real_mode_size;
 	size_t image_size;
 	const char *cmdline = getenv("bootargs");
+	const char *kernel_file;
 
-	if (argc < 2) {
-		perror("linux16");
+	while((opt = getopt(argc, argv, "")) > 0) {
+		switch(opt) {
+		}
+	}
+
+	if (optind == argc) {
+		printf("No kernel filename given\n");
 		return 1;
 	}
+	kernel_file = argv[optind];
 
-	lh = read_file(argv[1], &image_size);
+	lh = read_file(kernel_file, &image_size);
 	if (lh == NULL) {
 		printf("Cannot read file '%s'\n", argv[1]);
 		return 1;
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 09/10] LINUX16: Add selection of the VESA video mode
  2011-03-08 14:48 [PATCH] Various fixes to make barebox's x86 support working again Juergen Beisert
                   ` (7 preceding siblings ...)
  2011-03-08 14:48 ` [PATCH 08/10] Change 'linux16' command to use getopt() Juergen Beisert
@ 2011-03-08 14:48 ` Juergen Beisert
  2011-03-08 14:48 ` [PATCH 10/10] LINUX16: Fix warning Juergen Beisert
  9 siblings, 0 replies; 12+ messages in thread
From: Juergen Beisert @ 2011-03-08 14:48 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 commands/linux16.c |   37 +++++++++++++++++++++++++++++++++----
 1 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/commands/linux16.c b/commands/linux16.c
index 87245d4..0cdb673 100644
--- a/commands/linux16.c
+++ b/commands/linux16.c
@@ -141,6 +141,10 @@ struct linux_kernel_header {
 #endif
 } __attribute__ ((packed));
 
+/* This is -1. Keep this value in sync with the kernel */
+#define NORMAL_VGA	0xffff		/* 80x25 mode */
+#define ASK_VGA		0xfffd		/* ask for it at bootup */
+
 /**
  * Load an x86 Linux kernel bzImage and start it
  * @param cmdtp FIXME
@@ -157,12 +161,24 @@ static int do_linux16(struct command *cmdtp, int argc, char *argv[])
 	int rc, opt;
 	unsigned setup_sects;
 	unsigned real_mode_size;
+	int vid_mode = NORMAL_VGA;
 	size_t image_size;
 	const char *cmdline = getenv("bootargs");
 	const char *kernel_file;
 
-	while((opt = getopt(argc, argv, "")) > 0) {
+	while((opt = getopt(argc, argv, "v:")) > 0) {
 		switch(opt) {
+		case 'v':
+			vid_mode = simple_strtoul(optarg, NULL, 0);
+			if (vid_mode == 0) {
+				if (!strcmp(optarg, "ask"))
+					vid_mode = ASK_VGA;
+				else {
+					printf("Unknown video mode: %s\n", optarg);
+					return 1;
+				}
+			}
+			break;
 		}
 	}
 
@@ -227,6 +243,14 @@ static int do_linux16(struct command *cmdtp, int argc, char *argv[])
 		goto on_error;
 	}
 
+	/*
+	 * The kernel does not check for the "vga=<val>" kernel command line
+	 * parameter anymore. It expects this kind of information in the
+	 * boot parameters instead.
+	 */
+	if (vid_mode != NORMAL_VGA)
+		lh->vid_mode = vid_mode;
+
 	/* If SETUP_SECTS is not set, set it to the default.  */
 	if (setup_sects == 0) {
 		printf("Fixing setup sector count\n");
@@ -297,16 +321,21 @@ on_error:
 }
 
 BAREBOX_CMD_HELP_START(linux16)
-BAREBOX_CMD_HELP_USAGE("linux16 <file>\n")
-BAREBOX_CMD_HELP_SHORT("Boot a kernel on x86 via real mode code.\n")
+BAREBOX_CMD_HELP_USAGE("linux16 <file> [-v <mode>]\n")
+BAREBOX_CMD_HELP_SHORT("Boot a kernel <file> on x86 via real mode code.\n")
+BAREBOX_CMD_HELP_OPT  ("-v <mode>",   "VESA video mode number or 'ask'\n")
 BAREBOX_CMD_HELP_END
 
 /**
  * @page linux16_command
 
-<p> Only kernel images in bzImage format are supported by now. See \ref
+<p>Only kernel images in bzImage format are supported by now. See \ref
 x86_boot_preparation for more info about how to use this command.</p>
 
+<p>For the video mode refer the Linux kernel documentation
+'Documentation/fb/vesafb.txt' for correct VESA mode numbers. If the keyword
+'ask' instead of a number is given, the starting kernel will ask for a number.
+</p>
  */
 
 BAREBOX_CMD_START(linux16)
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 10/10] LINUX16: Fix warning
  2011-03-08 14:48 [PATCH] Various fixes to make barebox's x86 support working again Juergen Beisert
                   ` (8 preceding siblings ...)
  2011-03-08 14:48 ` [PATCH 09/10] LINUX16: Add selection of the VESA video mode Juergen Beisert
@ 2011-03-08 14:48 ` Juergen Beisert
  9 siblings, 0 replies; 12+ messages in thread
From: Juergen Beisert @ 2011-03-08 14:48 UTC (permalink / raw)
  To: barebox

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 commands/linux16.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/commands/linux16.c b/commands/linux16.c
index 0cdb673..8a1b5fe 100644
--- a/commands/linux16.c
+++ b/commands/linux16.c
@@ -260,7 +260,8 @@ static int do_linux16(struct command *cmdtp, int argc, char *argv[])
 	if (setup_sects >= 15) {
 		void *src = lh;
 		if (lh->kernel_version != 0)
-			printf("Kernel version: '%s'\n", src + lh->kernel_version + DISK_SECTOR_SIZE);
+			printf("Kernel version: '%s'\n",
+			       (char *)src + lh->kernel_version + DISK_SECTOR_SIZE);
 	}
 
 	/*
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 03/10] x86 ATA: Don't touch the size entry for the BIOS disk based device
  2011-01-07  8:35 Various fixes to make barebox's x86 support working again Juergen Beisert
@ 2011-01-07  8:35 ` Juergen Beisert
  0 siblings, 0 replies; 12+ messages in thread
From: Juergen Beisert @ 2011-01-07  8:35 UTC (permalink / raw)
  To: barebox

Only the platform sets this entry to setup the correct size or
signals the driver to guess the size of the attached disk.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 drivers/ata/bios.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/ata/bios.c b/drivers/ata/bios.c
index 51e2425..3f419cc 100644
--- a/drivers/ata/bios.c
+++ b/drivers/ata/bios.c
@@ -257,7 +257,6 @@ static int biosdisk_probe(struct device_d *dev)
 
 		strcpy(drive_dev->name, "biosdisk");
 		drive_dev->id = drive - 0x80;
-		drive_dev->size = 1;
 		drive_dev->map_base = 0;
 		drive_dev->platform_data = p;
 
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-03-08 14:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-08 14:48 [PATCH] Various fixes to make barebox's x86 support working again Juergen Beisert
2011-03-08 14:48 ` [PATCH 01/10] x86: Remove not used expressions from the makefile Juergen Beisert
2011-03-08 14:48 ` [PATCH 02/10] x86: Use the generic linker script initializing Juergen Beisert
2011-03-08 14:48 ` [PATCH 03/10] x86 ATA: Don't touch the size entry for the BIOS disk based device Juergen Beisert
2011-03-08 14:48 ` [PATCH 04/10] x86 Generic platform: Fix some typos Juergen Beisert
2011-03-08 14:48 ` [PATCH 05/10] x86 Generic platform: Fix disk drive name Juergen Beisert
2011-03-08 14:48 ` [PATCH 06/10] x86 Generic platform: Fix prompt name Juergen Beisert
2011-03-08 14:48 ` [PATCH 07/10] x86: Remove 'uboot' from file names Juergen Beisert
2011-03-08 14:48 ` [PATCH 08/10] Change 'linux16' command to use getopt() Juergen Beisert
2011-03-08 14:48 ` [PATCH 09/10] LINUX16: Add selection of the VESA video mode Juergen Beisert
2011-03-08 14:48 ` [PATCH 10/10] LINUX16: Fix warning Juergen Beisert
  -- strict thread matches above, loose matches on Subject: below --
2011-01-07  8:35 Various fixes to make barebox's x86 support working again Juergen Beisert
2011-01-07  8:35 ` [PATCH 03/10] x86 ATA: Don't touch the size entry for the BIOS disk based device Juergen Beisert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox