Skip to contentSkip to conversation

Bring in basic x86 support into 'barebox'

PATCH Applied Juergen Beisert 2 participants 16 messages Jan 12, 2010 – Jan 14, 2010

Subsystems (6)
Documentation x86 Kbuild libata +2 more subsystems
lore
Share & tools
lore
#0 lore raw

v2 cover Bring in basic x86 support into 'barebox'

This patch series brings in some basic x86 support into the tree. At first this support can act as a boot loader on a BIOS based x86 machine like GRUB is. E.g. barebox will be stored in the MBR of a boot media the BIOS supports to boot from. This implementation still talks to the BIOS in real mode, to load or store data from/to a disk drive, but the barebox core itself runs in 32 bit flat mode.

Currently only a serial console is supported.

v2 of this patch series comes with some clean ups and also uses the discussed naming convention for BIOS based disk access. The whole series is updated to 'barebox' (instead of u-boot-v2). Note: Its tested only with QEMU yet. We are going to port it to real hardware now.

Comments are welcome.

jbe

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#2 lore raw

PATCH v2 2/14 Consider real and protected mode in the dump file

On x86 'objdump' does not know which parts of the image are 16 bit code and 32 bit. As the default is 32 bit, it will output garbage from the 16 bit parts (due to 16/32 bit ops are sharing the same opcodes).

---
 Makefile |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
Makefile +23 -0
Index: barebox-2009.12.0/Makefile
===================================================================
@@ -643,7 +643,30 @@ endef
 
 barebox.bin: barebox
 	$(Q)$(OBJCOPY) -O binary barebox barebox.bin
+ifdef CONFIG_X86
+ifdef CONFIG_X86_HDBOOT
+	@echo "-------------------------------------------------" > barebox.S
+	@echo " * MBR content" >> barebox.S
+	$(Q)$(OBJDUMP) -j .bootsector -mi8086 -d barebox >> barebox.S
+	@echo "-------------------------------------------------" >> barebox.S
+	@echo " * Boot loader content" >> barebox.S
+	$(Q)$(OBJDUMP) -j .bootstrapping -mi8086 -d barebox >> barebox.S
+endif
+	@echo "-------------------------------------------------" >> barebox.S
+	@echo " * Regular Text content" >> barebox.S
+	$(Q)$(OBJDUMP) -j .text -d barebox >> barebox.S
+	@echo "-------------------------------------------------" >> barebox.S
+	@echo " * Regular Data content" >> barebox.S
+	$(Q)$(OBJDUMP) -j .data -d barebox >> barebox.S
+	@echo "-------------------------------------------------" >> barebox.S
+	@echo " * Commands content" >> barebox.S
+	$(Q)$(OBJDUMP) -j .barebox_cmd -d barebox >> barebox.S
+	@echo "-------------------------------------------------" >> barebox.S
+	@echo " * Init Calls content" >> barebox.S
+	$(Q)$(OBJDUMP) -j .barebox_initcalls -d barebox >> barebox.S
+else
 	$(Q)$(OBJDUMP) -d barebox > barebox.S
+endif
 
 # barebox image
 barebox: $(barebox-lds) $(barebox-head) $(barebox-common) $(kallsyms.o) FORCE
Signature · 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw

PATCH v2 9/14 Bring in the time reference for the x86 platforms

In reply to Juergen Beisert

This code uses the always (hopefully) existing PIT device to get the time reference for barebox.

---
 arch/x86/mach-i386/Makefile    |    3 +
 arch/x86/mach-i386/pit_timer.c |   71 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)
arch/x86/mach-i386/pit_timer.c new file +71 -0
Index: u-boot-2.0.0-rc10/arch/x86/mach-i386/pit_timer.c
===================================================================
@@ -0,0 +1,71 @@
+/*
+ * 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 Clocksource based on the 'Programmable Interval Timer' PIT (8253)
+ *
+ * This timer should be available on almost all PCs. It also should be run
+ * at a fixed frequency (1193181.8181 Hz) and not modified to use another
+ * reload value than 0xFFFF. So, it always counts from 0xffff down to 0.
+ *
+ * @note: We can't reprogram the PIT, it will be still used by the BIOS. This
+ * clocksource driver does not touch any PIT settings.
+ */
+
+#include <init.h>
+#include <clock.h>
+#include <asm/io.h>
+
+/** base address of the PIT in a standard PC */
+#define PIT 0x40
+
+static uint64_t pit_clocksource_read(void)
+{
+	uint16_t val1, val2;
+
+	outb(0x00, PIT + 3);	/* latch counter 0 */
+	outb(0x00, 0x80);
+
+	val1 = inb(PIT);
+	outb(0x00, 0x80);
+
+	val2 = inb(PIT);
+	val2 <<= 8;
+
+	/* note: its a down counter */
+	return 0xFFFFU - (val1 | val2);
+}
+
+static struct clocksource cs = {
+	.read	= pit_clocksource_read,
+	.mask	= 0x0000ffff,
+	.shift	= 10,
+};
+
+static int clocksource_init (void)
+{
+	cs.mult = clocksource_hz2mult(1193182, cs.shift);
+	init_clock(&cs);
+
+	return 0;
+}
+
+core_initcall(clocksource_init);
arch/x86/mach-i386/Makefile +3 -0
Index: u-boot-2.0.0-rc10/arch/x86/mach-i386/Makefile
===================================================================
@@ -1,2 +1,5 @@
 obj-y += generic.o
 obj-y += reset.o
+
+# reference clocksource
+obj-y += pit_timer.o
Signature · 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH v2 3/14 Adding x86 usage documentation to the tree

In reply to Juergen Beisert

Adding x86 usage documentation to the tree

---
 Documentation/developers_manual.dox |    1 
 Documentation/users_manual.dox      |    1 
 arch/architecture.dox               |    1 
 arch/x86/mach-x86.dox               |  128 ++++++++++++++++++++++++++++++++++++
 4 files changed, 131 insertions(+)
arch/x86/mach-x86.dox new file +128 -0
Index: barebox-2009.12.0/arch/x86/mach-x86.dox
===================================================================
@@ -0,0 +1,128 @@
+/* This document is intended to provide the developer with information
+ * how to integrate a new CPU (MACH) into this part of the barebox tree
+ */
+
+/** @page x86_runtime barebox on x86 at runtime
+
+@section mach_x86_memory_layout barebox's memory layout (BIOS based)
+
+@a barebox uses the following memory layout at runtime when it still depends
+on some kind of BIOS function:
+
+@verbatim
+     Addresses
+------------------------
+
+ seg:off     flat
+
+xxxx:xxxx 0x01xxxxxx    end of  barebox's malloc area
+    .        .
+xxxx:xxxx 0x01000000    start of barebox's malloc area
+    .          .
+    .          .        (used while loading a Linux kernel of type 'bzImage')
+    .          .
+xxxx:xxxx 0x00100000    start of extended memory and  malloc area
+    .          .
+    .          .	(the big hole)
+    .          .
+9000:ffff 0x0009ffff    end of expected real mode memory
+    .          .
+    .          .        (used while loading a Linux kernel of type 'bzImage')
+    .          .
+9000:0000 0x00090000    end of used lower real mode memory
+    .          .
+    .          .
+    .          .        Flat mode stack (about 32 kiB)
+    .          .        bss
+    .          .        Data
+    .          .        Text
+0000:7e00 0x00007e00	Real and flat mode barebox code
+0000:7c00 0x00007c00	MBR initial boot loader code
+0000:7a00 0x00007a00	location of the indirect sector (while booting only)
+			below: real mode stack
+@endverbatim
+
+@note The start address of 0x0000:7c000 is a fixed one, defined by the BIOS.
+So, for a BIOS based @a barebox this address can't be changed.
+
+While the @a barebox code is runnung in flat mode, all interrupts are disabled.
+But in the CPU only. All other interrupt settings are still valid. This is
+required to be able to call real mode code from inside @a barebox flat mode
+code. Thats why not the PIC is touched nor the IDT.
+
+@todo Add some notes about drive numbers used by the BIOS. They may change
+if one change orders in the BIOS setup. Drive orders and numbers may be
+different at BIOS runtime and Linux runtime! But these numbers are required
+at BIOS runtime for booting and the persistant environment storage.
+
+@attention Currently there is a 4 GiB limit for the disk sizes!
+
+@section mach_x86_image_layout barebox's image layout
+
+@a barebox's binary image layout
+
+@verbatim
+  Offset     Content
+
+ 0x?????
+    .        32 bit barebox code
+    .
+    .        16 bit bootstrap code, BIOS calling code
+ 0x00400
+ 0x003ff
+    .        indirect sector
+ 0x00200
+ 0x001ff
+    .        MBR
+ 0x00000
+@endverbatim
+
+The "indirect sector" is a free area in the image where the sector information
+gets stored when this image will be written to a boot media. This information
+is required to load all parts of the image from the boot media at runtime.
+
+The image gets installed in two ways onto the boot media, depending on the
+need for a persistant storage.
+
+@subsection mach_x86_drive_layout_wops barebox's boot media layout without persistant storage
+
+In this case @a barebox's persistant storage is anywhere:
+
+@verbatim
+  Sector     Content
+---------------------------
+    X        start of first partition
+    .
+    ?        end of the binary image
+    .        32 bit barebox code
+    2        16 bit bootstrap code, BIOS calling code
+    1        indirect sector
+    0        MBR, Partition table, boot code
+@endverbatim
+
+@subsection mach_x86_drive_layout_wps barebox's boot media layout with persistant storage
+
+@a barebox's persistant storage is part of the boot media (more
+space required in front of the first partition) and interferes with the
+boot loader image itself:
+
+@verbatim
+  Sector     Content
+---------------------------
+    X        start of first partition
+    .
+    n+?      end of the binary image
+    .        32 bit barebox code
+    n+2      16 bit bootstrap code, BIOS calling code
+    n+1      indirect sector
+    n        end of persistant environment storage
+    .
+    1        start of persistant environment storage
+    0        MBR, Partition table, boot code
+@endverbatim
+
+The information where the persistant storage is located is also stored into
+the MBR at specific locations by @p setupmbr. The @a barebox runtime will use
+it to load and store all environment relevant data.
+
+*/
arch/architecture.dox +1 -0
Index: barebox-2009.12.0/arch/architecture.dox
===================================================================
@@ -88,6 +88,7 @@ TODO
 @li @subpage dev_bf_mach
 @li @subpage dev_ppc_mach
 @li @subpage dev_m68k_mach
+@li @subpage dev_x86_mach
 
 */
 
Documentation/users_manual.dox +1 -0
Index: barebox-2009.12.0/Documentation/users_manual.dox
===================================================================
@@ -10,5 +10,6 @@ work easier.
 @li @subpage readline_parser
 @li @subpage command_reference
 @li @subpage partitions
+@li @subpage x86_bootloader
 
 */
Documentation/developers_manual.dox +1 -0
Index: barebox-2009.12.0/Documentation/developers_manual.dox
===================================================================
@@ -20,5 +20,6 @@ This part of the documentation is intend
 @li @subpage barebox_simul
 @li @subpage io_access_functions
 @li @subpage mcfv4e_MCDlib
+@li @subpage x86_runtime
 
 */
Signature · 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH v2 5/14 Bring in the first x86 specific code

In reply to Juergen Beisert

Add some generic required code to make barebox work on x86.
Note: Resetting the CPU is unfinished yet. I need some ideas how to reset this kind of architecture gracefully.

---
 arch/x86/mach-i386/Kconfig   |   29 +++++++++++++++++++++++++++++
 arch/x86/mach-i386/Makefile  |    2 ++
 arch/x86/mach-i386/generic.c |   38 ++++++++++++++++++++++++++++++++++++++
 arch/x86/mach-i386/reset.c   |   34 ++++++++++++++++++++++++++++++++++
 4 files changed, 103 insertions(+)
arch/x86/mach-i386/Kconfig new file +29 -0
Index: u-boot-2.0.0-rc10/arch/x86/mach-i386/Kconfig
===================================================================
@@ -0,0 +1,29 @@
+
+menu "Board specific settings       "
+
+if X86_BOOTLOADER
+
+config X86_GENERIC_HAS_ISA
+	bool "ISA support"
+	help
+	  Say Y here if the target supports a ISA bus
+
+config X86_GENERIC_HAS_PCI
+	bool "PCI support"
+	select HAS_PCI
+	help
+	  Say Y here if the target supports a PCI bus
+
+config X86_GENERIC_HAS_VIDEO
+	bool "video support"
+	help
+	  Say Y here if the target supports a video output
+
+config X86_GENERIC_HAS_USB
+	bool "USB support"
+	help
+	  Say Y here if the target supports a USB interface
+
+endif
+
+endmenu
arch/x86/mach-i386/Makefile new file +2 -0
Index: u-boot-2.0.0-rc10/arch/x86/mach-i386/Makefile
===================================================================
@@ -0,0 +1,2 @@
+obj-y += generic.o
+obj-y += reset.o
arch/x86/mach-i386/generic.c new file +38 -0
Index: u-boot-2.0.0-rc10/arch/x86/mach-i386/generic.c
===================================================================
@@ -0,0 +1,38 @@
+/*
+ * 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 x86 Architecture Initialization routines
+ */
+
+#include <asm/io.h>
+
+/** to work with the 8250 UART driver implementation we need this function */
+unsigned int x86_uart_read(unsigned long base, unsigned char reg_idx)
+{
+	return inb(base + reg_idx);
+}
+
+/** to work with the 8250 UART driver implementation we need this function */
+void x86_uart_write(unsigned int val, unsigned long base, unsigned char reg_idx)
+{
+	outb(val, base + reg_idx);
+}
arch/x86/mach-i386/reset.c new file +34 -0
Index: u-boot-2.0.0-rc10/arch/x86/mach-i386/reset.c
===================================================================
@@ -0,0 +1,34 @@
+/*
+ * 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 Resetting an x86 CPU
+ */
+
+#include <common.h>
+
+void reset_cpu(ulong addr)
+{
+	/** How to reset the machine? */
+	while(1)
+		;
+}
+EXPORT_SYMBOL(reset_cpu);
Signature · 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#12 lore raw

PATCH v2 12/14 Add a low level disk drive access driver

In reply to Juergen Beisert

This is a low level disk drive communication driver. It uses the real mode BIOS found on most x86 platforms, to read and write sectors. Used by the generic disk driver.

---
 arch/x86/lib/Makefile    |    1 
 arch/x86/lib/bios_disk.S |   77 ++++++++++++
 drivers/ata/Kconfig      |    9 +
 drivers/ata/Makefile     |    2 
 drivers/ata/bios.c       |  291 +++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 380 insertions(+)
drivers/ata/Kconfig +9 -0
Index: barebox-2009.12.0/drivers/ata/Kconfig
===================================================================
@@ -14,4 +14,13 @@ config ATA_DISK
 
 comment "interface types"
 
+config ATA_BIOS
+	bool "BIOS based"
+	depends on X86_BIOS_BRINGUP
+	help
+	  Gain disk drive access via int13 calls to the standard PC-BIOS.
+	  The advantage of this driver is, it still uses user's defined boot
+	  media to work on. Disadvantage is: Due to its 16 bit nature it is
+	  slow.
+
 endif
drivers/ata/Makefile +2 -0
Index: barebox-2009.12.0/drivers/ata/Makefile
===================================================================
@@ -3,3 +3,5 @@
 obj-$(CONFIG_ATA_DISK) += disk_drive.o
 
 # interface types
+
+obj-$(CONFIG_ATA_BIOS) += bios.o
drivers/ata/bios.c new file +291 -0

291 lines not on this page · raw message

arch/x86/lib/Makefile +1 -0
Index: barebox-2009.12.0/arch/x86/lib/Makefile
===================================================================
@@ -5,3 +5,4 @@ obj-y += gdt.o
 # needed, when running via a 16 bit BIOS
 obj-$(CONFIG_X86_BIOS_BRINGUP) += memory16.o
 obj-$(CONFIG_X86_BIOS_BRINGUP) += traveler.o
+obj-$(CONFIG_X86_BIOS_BRINGUP) += bios_disk.o
arch/x86/lib/bios_disk.S new file +77 -0

77 lines not on this page · raw message

Signature · 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#14 lore raw

PATCH v2 14/14 Add the whole x86 architecture to the build system

In reply to Juergen Beisert
---
 arch/x86/Kconfig  |   67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 arch/x86/Makefile |   50 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 117 insertions(+)
arch/x86/Kconfig new file +67 -0
Index: barebox-2009.12.0/arch/x86/Kconfig
===================================================================
@@ -0,0 +1,67 @@
+#
+#
+#
+config ARCH_TEXT_BASE
+	hex
+	default 0x00007c00 if MACH_X86_GENERIC
+
+config BOARDINFO
+	default "Generic x86 bootloader" if MACH_X86_GENERIC
+
+config BOARD_LINKER_SCRIPT
+	bool
+	default n
+
+config GENERIC_LINKER_SCRIPT
+	bool
+	default y
+	depends on !BOARD_LINKER_SCRIPT
+
+config X86
+	bool
+	select HAS_KALLSYMS
+	select HAS_MODULES
+	select HAVE_CONFIGURABLE_MEMORY_LAYOUT
+	select HAVE_CONFIGURABLE_TEXT_BASE
+	default y
+
+choice
+	prompt "Select your board"
+
+config MACH_X86_GENERIC
+	bool "Generic x86"
+	select X86_BOOTLOADER
+	help
+	  Say Y here if you want barebox to be your BIOS based bootloader
+
+endchoice
+
+choice
+	prompt "Bring up type"
+
+	config X86_BIOS_BRINGUP
+		prompt "16 bit BIOS"
+		bool
+		help
+		   Barebox will act as a BIOS based bootloader. This includes
+		   some 16 bit real mode code and some restrictions everyone knows
+		   from BIOS based systems.
+
+	config X86_NATIVE_BRINGUP
+		bool "native"
+		help
+		   Barebox will act as a native bootloader. This includes all the
+		   required initialization needed to bring up a piece of hardware.
+		   Note: Not implemented yet
+
+endchoice
+
+source arch/x86/boot/Kconfig
+source arch/x86/mach-i386/Kconfig
+
+source common/Kconfig
+source commands/Kconfig
+source net/Kconfig
+source drivers/Kconfig
+source fs/Kconfig
+source lib/Kconfig
arch/x86/Makefile new file +50 -0

50 lines not on this page · raw message

Signature · 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH v2 6/14 Add some generic functions to make x86 work

In reply to Juergen Beisert

Add some generic functions to make barebox work on x86.

---
 arch/x86/lib/Makefile      |    7 +
 arch/x86/lib/barebox.lds.S |  194 +++++++++++++++++++++++++++++++++++++++++++++
 arch/x86/lib/gdt.c         |   55 ++++++++++++
 arch/x86/lib/memory.c      |   67 +++++++++++++++
 arch/x86/lib/memory16.S    |   73 ++++++++++++++++
 arch/x86/lib/traveler.S    |  183 ++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 579 insertions(+)
arch/x86/lib/Makefile new file +7 -0
Index: barebox-2009.12.0/arch/x86/lib/Makefile
===================================================================
@@ -0,0 +1,7 @@
+extra-$(CONFIG_GENERIC_LINKER_SCRIPT) += barebox.lds
+obj-y += memory.o
+obj-y += gdt.o
+
+# needed, when running via a 16 bit BIOS
+obj-$(CONFIG_X86_BIOS_BRINGUP) += memory16.o
+obj-$(CONFIG_X86_BIOS_BRINGUP) += traveler.o
arch/x86/lib/barebox.lds.S new file +194 -0

194 lines not on this page · raw message

arch/x86/lib/gdt.c new file +55 -0

55 lines not on this page · raw message

arch/x86/lib/memory.c new file +67 -0

67 lines not on this page · raw message

arch/x86/lib/traveler.S new file +183 -0

183 lines not on this page · raw message

arch/x86/lib/memory16.S new file +73 -0

73 lines not on this page · raw message

Signature · 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

PATCH v2 8/14 Add a generic PC platform

In reply to Juergen Beisert

This code adds a generic x86 platform, enabling barebox to act as a bootloader like 'GRUB'. Very minimalistic, yet. Supports only a serial console and is tested with QEMU only.

---
 Documentation/boards.dox           |    2 
 arch/x86/configs/generic_defconfig |  186 +++++++++++++++++++++++++++++++++++++
 board/x86_generic/Makefile         |    1 
 board/x86_generic/config.h         |   21 ++++
 board/x86_generic/env/bin/boot     |   37 +++++++
 board/x86_generic/env/bin/init     |   15 ++
 board/x86_generic/env/config       |   31 ++++++
 board/x86_generic/generic_pc.c     |  140 +++++++++++++++++++++++++++
 8 files changed, 432 insertions(+), 1 deletion(-)
board/x86_generic/Makefile new file +1 -0
Index: barebox-2009.12.0/board/x86_generic/Makefile
===================================================================
@@ -0,0 +1 @@
+obj-y += generic_pc.o
board/x86_generic/generic_pc.c new file +140 -0

140 lines not on this page · raw message

board/x86_generic/env/config new file +31 -0
Index: barebox-2009.12.0/board/x86_generic/env/config
===================================================================
@@ -0,0 +1,31 @@
+#
+# basic config
+#
+# boot source: 'disk' or 'net'
+kernel=disk
+root=disk
+
+# data for the NFS case
+nfsroot="/path/to/nfs_root"
+
+# data for the disk case
+kernel_device=/dev/biosdisk0.1
+rootpart_disk=/dev/sda1
+rootpart_fs=ext2
+
+baudrate=115200
+serial=ttyS0
+
+# use UART for console
+bootargs="console=$serial,$baudrate"
+
+autoboot_timeout=3
+
+# use 'dhcp' to do dhcp in uboot and in kernel
+#  ip=dhcp
+# or set your networking parameters here
+#  eth0.ipaddr=192.168.3.11
+#  eth0.netmask=255.255.255.0
+#  eth0.gateway=a.b.c.d
+#  eth0.serverip=192.168.3.10
+#  eth0.ethaddr=aa.bb.cc.dd.ee.ff
board/x86_generic/config.h new file +21 -0
Index: barebox-2009.12.0/board/x86_generic/config.h
===================================================================
@@ -0,0 +1,21 @@
+/*
+ * 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
+ *
+ */
+
+/* nothing special yet */
board/x86_generic/env/bin/init new file +15 -0
Index: barebox-2009.12.0/board/x86_generic/env/bin/init
===================================================================
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+PATH=/env/bin
+export PATH
+
+. /env/config
+
+echo
+echo -n "Hit any key to stop autoboot: "
+timeout -a $autoboot_timeout
+if [ $? != 0 ]; then
+        exit
+fi
+
+boot
arch/x86/configs/generic_defconfig new file +186 -0

186 lines not on this page · raw message

board/x86_generic/env/bin/boot new file +37 -0
Index: barebox-2009.12.0/board/x86_generic/env/bin/boot
===================================================================
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+. /env/config
+
+if [ x$1 = xdisk ]; then
+	root=disk
+	kernel=disk
+fi
+
+if [ x$1 = xnet ]; then
+	root=net
+	kernel=net
+fi
+
+if [ x$ip = xdhcp ]; then
+	bootargs="$bootargs ip=dhcp"
+else
+	bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::"
+fi
+
+if [ x$root = xdisk ]; then
+	bootargs="$bootargs root=$rootpart_disk rootfstype=$rootpart_fs rw"
+else
+	bootargs="$bootargs root=/dev/nfs nfsroot=$eth0.serverip:$nfsroot,v3,tcp rw"
+fi
+
+if [ $kernel = net ]; then
+	if [ x$ip = xdhcp ]; then
+		dhcp
+	fi
+	tftp $uimage uImage || exit 1
+	bootm uImage
+else
+	bootargs="BOOT_IMAGE=$kernel_device auto $bootargs"
+	linux16 $kernel_device
+fi
+
Documentation/boards.dox +1 -1
Index: barebox-2009.12.0/Documentation/boards.dox
===================================================================
@@ -27,7 +27,7 @@ Blackfin type:
 
 x86 type:
 
-@li nothing yet
+@li @subpage generic_pc
 
 coldfire/m68k type:
 
Signature · 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#11 lore raw

PATCH v2 11/14 Add the main disk driver

In reply to Juergen Beisert

This is the generic disk driver. It does not know how to access the drives. Other low level drivers are required for this.

---
 drivers/ata/Kconfig      |    5 
 drivers/ata/Makefile     |    2 
 drivers/ata/disk_drive.c |  346 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 353 insertions(+)
drivers/ata/Kconfig +5 -0
Index: barebox-2009.12.0/drivers/ata/Kconfig
===================================================================
@@ -7,6 +7,11 @@ if ATA
 
 comment "drive types"
 
+config ATA_DISK
+	bool "disk drives"
+	help
+	  Add support for regular disk drives
+
 comment "interface types"
 
 endif
drivers/ata/Makefile +2 -0
Index: barebox-2009.12.0/drivers/ata/Makefile
===================================================================
@@ -1,3 +1,5 @@
 # drive types
 
+obj-$(CONFIG_ATA_DISK) += disk_drive.o
+
 # interface types
drivers/ata/disk_drive.c new file +346 -0

346 lines not on this page · raw message

Signature · 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v2 1/14 Add a tool to activate barebox as a boot loader on x86 architectures

In reply to Juergen Beisert

To use barebox as a BIOS based bootloader for x86 architectures, the binary must be patched to get it bootstrapped at runtime. The 'setupmbr' tool installs the barebox-binary to the given device node or image file and patch it in accordance to the needed sector information at runtime.

Signed-off by: Juergen Beisert <[email protected]>

---
 Doxyfile                    |    3 
 scripts/Makefile            |    4 
 scripts/setupmbr/Makefile   |    4 
 scripts/setupmbr/arch.h     |   55 +++
 scripts/setupmbr/setupmbr.c |  705 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 769 insertions(+), 2 deletions(-)
scripts/Makefile +3 -1
Index: barebox-2009.12.0/scripts/Makefile
===================================================================
@@ -14,5 +14,7 @@ always		:= $(hostprogs-y) $(hostprogs-m)
 
 subdir-y                     += mod
 
+subdir-$(CONFIG_X86)             += setupmbr
+
 # Let clean descend into subdirs
-subdir-	+= basic kconfig
+subdir-	+= basic kconfig setupmbr
scripts/setupmbr/Makefile new file +4 -0
Index: barebox-2009.12.0/scripts/setupmbr/Makefile
===================================================================
@@ -0,0 +1,4 @@
+HOST_EXTRACFLAGS=-I$(srctree)
+
+hostprogs-y  := setupmbr
+always       := $(hostprogs-y)
scripts/setupmbr/arch.h new file +55 -0

55 lines not on this page · raw message

scripts/setupmbr/setupmbr.c new file +705 -0

705 lines not on this page · raw message

Doxyfile +2 -1
Index: barebox-2009.12.0/Doxyfile
===================================================================
@@ -484,7 +484,8 @@ INPUT                  = Documentation \
                          commands \
                          common \
                          board \
-                         lib
+                         lib \
+                         scripts/setupmbr
 
 # This tag can be used to specify the character encoding of the source files that
 # doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default
Signature · 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH v2 4/14 Adding required architecture header files

In reply to Juergen Beisert

Add architecture header files. Some of these files are empty, they only must exists to make the build system happy.

---
 arch/x86/include/asm/barebox.h     |   21 ++++++
 arch/x86/include/asm/barebox.lds.h |  113 +++++++++++++++++++++++++++++++++++++
 arch/x86/include/asm/bitops.h      |   32 ++++++++++
 arch/x86/include/asm/byteorder.h   |   30 +++++++++
 arch/x86/include/asm/common.h      |   29 +++++++++
 arch/x86/include/asm/elf.h         |   30 +++++++++
 arch/x86/include/asm/io.h          |   73 +++++++++++++++++++++++
 arch/x86/include/asm/modes.h       |   65 +++++++++++++++++++++
 arch/x86/include/asm/module.h      |   37 ++++++++++++
 arch/x86/include/asm/posix_types.h |   49 ++++++++++++++++
 arch/x86/include/asm/segment.h     |   43 ++++++++++++++
 arch/x86/include/asm/string.h      |   31 ++++++++++
 arch/x86/include/asm/syslib.h      |   29 +++++++++
 arch/x86/include/asm/types.h       |   44 ++++++++++++++
 14 files changed, 626 insertions(+)
arch/x86/include/asm/bitops.h new file +32 -0
Index: barebox-2009.12.0/arch/x86/include/asm/bitops.h
===================================================================
@@ -0,0 +1,32 @@
+/*
+ * 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 x86 bit operations
+ *
+ * This file is required only to make all sources happy including
+ * 'linux/bitops.h'
+ */
+
+#ifndef _ASM_X86_BITOPS_H_
+#define _ASM_X86_BITOPS_H_
+
+/* nothing special yet */
+
+#endif /* _ASM_X86_BITOPS_H_ */
arch/x86/include/asm/byteorder.h new file +30 -0
Index: barebox-2009.12.0/arch/x86/include/asm/byteorder.h
===================================================================
@@ -0,0 +1,30 @@
+/*
+ * 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 x86 endianess declaration
+ */
+
+#ifndef __ASM_X86_BYTEORDER_H
+#define __ASM_X86_BYTEORDER_H
+
+#include <asm/types.h>
+#include <linux/byteorder/little_endian.h>
+
+#endif
arch/x86/include/asm/common.h new file +29 -0
Index: barebox-2009.12.0/arch/x86/include/asm/common.h
===================================================================
@@ -0,0 +1,29 @@
+/*
+ * 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 x86 common declarations
+ */
+
+#ifndef _ASM_X86_COMMON_H_
+#define _ASM_X86_COMMON_H_
+
+/* Nothing exiting yet */
+
+#endif /* _ASM_X86_COMMON_H_ */
arch/x86/include/asm/elf.h new file +30 -0
Index: barebox-2009.12.0/arch/x86/include/asm/elf.h
===================================================================
@@ -0,0 +1,30 @@
+/*
+ * 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 x86 specific elf information
+ *
+ */
+
+#ifndef _ASM_X86_ELF_H
+#define _ASM_X86_ELF_H
+
+#define ELF_CLASS ELFCLASS32
+
+#endif /* _ASM_X86_ELF_H */
arch/x86/include/asm/io.h new file +73 -0

73 lines not on this page · raw message

arch/x86/include/asm/posix_types.h new file +49 -0

49 lines not on this page · raw message

arch/x86/include/asm/segment.h new file +43 -0

43 lines not on this page · raw message

arch/x86/include/asm/string.h new file +31 -0
Index: barebox-2009.12.0/arch/x86/include/asm/string.h
===================================================================
@@ -0,0 +1,31 @@
+/*
+ * 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 x86 specific string optimizations
+ *
+ * Thanks to the Linux kernel here we can add many micro optimized string
+ * functions. But currently it makes no sense, to do so.
+ */
+#ifndef __ASM_X86_STRING_H
+#define __ASM_X86_STRING_H
+
+/* nothing special yet */
+
+#endif
arch/x86/include/asm/syslib.h new file +29 -0
Index: barebox-2009.12.0/arch/x86/include/asm/syslib.h
===================================================================
@@ -0,0 +1,29 @@
+/*
+ * 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
+ *
+ */
+
+extern unsigned int x86_uart_read(unsigned long, unsigned char);
+extern void x86_uart_write(unsigned int, unsigned long, unsigned char);
+
+#ifdef CONFIG_X86_BIOS_BRINGUP
+
+extern int bios_disk_rw_int13_extensions(int, int, void*) __attribute__((regparm(3)));
+extern uint16_t bios_get_memsize(void);
+
+#endif
arch/x86/include/asm/types.h new file +44 -0

44 lines not on this page · raw message

arch/x86/include/asm/barebox.lds.h new file +113 -0

113 lines not on this page · raw message

arch/x86/include/asm/barebox.h new file +21 -0
Index: barebox-2009.12.0/arch/x86/include/asm/barebox.h
===================================================================
@@ -0,0 +1,21 @@
+/*
+ * 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
+ *
+ */
+
+/* nothing special yet */
arch/x86/include/asm/modes.h new file +65 -0

65 lines not on this page · raw message

arch/x86/include/asm/module.h new file +37 -0
Index: barebox-2009.12.0/arch/x86/include/asm/module.h
===================================================================
@@ -0,0 +1,37 @@
+/*
+ * 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 x86 module support
+ *
+ */
+
+#ifndef _ASM_X86_MODULE_H_
+#define _ASM_X86_MODULE_H_
+
+/** currently nothing special */
+struct mod_arch_specific
+{
+        int foo;
+};
+
+#define Elf_Shdr        Elf32_Shdr
+#define Elf_Ehdr        Elf32_Ehdr
+
+#endif /* _ASM_X86_MODULE_H_ */
Signature · 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#10 lore raw

PATCH v2 10/14 Start to add ATA support to barebox

In reply to Juergen Beisert

Add the basic files, declarations and folders to bring in ATA support.

---
 drivers/Kconfig      |    1 +
 drivers/Makefile     |    1 +
 drivers/ata/Kconfig  |   12 ++++++++++++
 drivers/ata/Makefile |    3 +++
 include/ata.h        |   39 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 56 insertions(+)
drivers/ata/Kconfig new file +12 -0
Index: u-boot-2.0.0-rc10/drivers/ata/Kconfig
===================================================================
@@ -0,0 +1,12 @@
+menuconfig ATA
+	bool "ATA                           "
+	help
+	  Add support for ATA types of drives like harddisks and CDROMs.
+
+if ATA
+
+comment "drive types"
+
+comment "interface types"
+
+endif
drivers/ata/Makefile new file +3 -0
Index: u-boot-2.0.0-rc10/drivers/ata/Makefile
===================================================================
@@ -0,0 +1,3 @@
+# drive types
+
+# interface types
include/ata.h new file +39 -0
Index: u-boot-2.0.0-rc10/include/ata.h
===================================================================
@@ -0,0 +1,39 @@
+/*
+ * 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 Declarations to communicate with ATA types of drives
+ */
+
+#include <types.h>
+#include <driver.h>
+
+/**
+ * Access functions from drives through the specified interface
+ */
+struct ata_interface {
+	/** write a count of sectors from a buffer to the drive */
+	int (*write)(struct device_d*, uint64_t, unsigned, const void*);
+	/** read a count of sectors from the drive into the buffer */
+	int (*read)(struct device_d*, uint64_t, unsigned, void*);
+	/** private interface data */
+	void *priv;
+};
drivers/Kconfig +1 -0
Index: u-boot-2.0.0-rc10/drivers/Kconfig
===================================================================
@@ -6,6 +6,7 @@ source "drivers/spi/Kconfig"
 source "drivers/i2c/Kconfig"
 source "drivers/nor/Kconfig"
 source "drivers/nand/Kconfig"
+source "drivers/ata/Kconfig"
 source "drivers/usb/Kconfig"
 source "drivers/video/Kconfig"
 
drivers/Makefile +1 -0
Index: u-boot-2.0.0-rc10/drivers/Makefile
===================================================================
@@ -3,6 +3,7 @@ obj-y	+= serial/
 obj-y	+= nand/
 obj-y	+= nor/
 obj-y	+= usb/
+obj-$(CONFIG_ATA) += ata/
 obj-$(CONFIG_SPI) += spi/
 obj-$(CONFIG_I2C) += i2c/
 obj-$(CONFIG_VIDEO) += video/
Signature · 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#13 lore raw

PATCH v2 13/14 Add a special command to load and start a bzImage on x86

In reply to Juergen Beisert

Other architectures are supporting the uImage format used by barebox's 'bootm' command. x86 does'nt. So, we need a special command to be able to boot the x86 specific bzImage format.

---
 Documentation/commands.dox    |    2 
 arch/x86/include/asm/syslib.h |    4 
 arch/x86/lib/Makefile         |    1 
 arch/x86/lib/linux_start.S    |   75 ++++++++
 commands/Kconfig              |    8 
 commands/Makefile             |    1 
 commands/linux16.c            |  363 ++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 453 insertions(+), 1 deletion(-)
commands/Kconfig +8 -0
Index: barebox-2009.12.0/commands/Kconfig
===================================================================
@@ -219,6 +219,14 @@ config CMD_BOOTU
 	   compile in the 'bootu' command to start raw (uncompressed)
 	   Linux images
 
+config CMD_LINUX16
+	tristate
+	default y if X86
+	prompt "linux16"
+	help
+	  Compile the linux16 command to be able to boot bzImages
+	  via real mode.
+
 config CMD_RESET
 	tristate
 	prompt "reset"
commands/Makefile +1 -0
Index: barebox-2009.12.0/commands/Makefile
===================================================================
@@ -1,4 +1,5 @@
 obj-$(CONFIG_CMD_BOOTM)		+= bootm.o
+obj-$(CONFIG_CMD_LINUX16)	+= linux16.o
 obj-$(CONFIG_CMD_LOADB)		+= loadb.o xyzModem.o
 obj-$(CONFIG_CMD_LOADY)		+= loadb.o xyzModem.o
 obj-$(CONFIG_CMD_LOADS)		+= loads.o
commands/linux16.c new file +363 -0

363 lines not on this page · raw message

arch/x86/include/asm/syslib.h +4 -0
Index: barebox-2009.12.0/arch/x86/include/asm/syslib.h
===================================================================
@@ -27,3 +27,7 @@ extern int bios_disk_rw_int13_extensions
 extern uint16_t bios_get_memsize(void);
 
 #endif
+
+#ifdef CONFIG_CMD_LINUX16
+extern void bios_start_linux(unsigned) __attribute__((regparm(1)));
+#endif
arch/x86/lib/Makefile +1 -0
Index: barebox-2009.12.0/arch/x86/lib/Makefile
===================================================================
@@ -6,3 +6,4 @@ obj-y += gdt.o
 obj-$(CONFIG_X86_BIOS_BRINGUP) += memory16.o
 obj-$(CONFIG_X86_BIOS_BRINGUP) += traveler.o
 obj-$(CONFIG_X86_BIOS_BRINGUP) += bios_disk.o
+obj-$(CONFIG_CMD_LINUX16) += linux_start.o
arch/x86/lib/linux_start.S new file +75 -0

75 lines not on this page · raw message

Documentation/commands.dox +1 -1
Index: barebox-2009.12.0/Documentation/commands.dox
===================================================================
@@ -20,5 +20,5 @@
 @li @subpage setenv_command
 @li @subpage sh_command
 @li @subpage unprotect_command
-
+@li @subpage linux16_command
 */
Signature · 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

PATCH v2 7/14 Add functions to be able to boot with BIOSs help

In reply to Juergen Beisert

These functions are special: They are running in the 16 bit real mode world to bring up barebox on an x86 box.

---
 arch/x86/boot/Kconfig         |   20 ++++
 arch/x86/boot/Makefile        |   13 ++
 arch/x86/boot/a20.c           |  170 ++++++++++++++++++++++++++++++++++++
 arch/x86/boot/bioscall.S      |   99 +++++++++++++++++++++
 arch/x86/boot/boot.h          |  193 ++++++++++++++++++++++++++++++++++++++++++
 arch/x86/boot/boot_hdisk.S    |  176 ++++++++++++++++++++++++++++++++++++++
 arch/x86/boot/boot_main.S     |   58 ++++++++++++
 arch/x86/boot/main_entry.c    |   44 +++++++++
 arch/x86/boot/pmjump.S        |   89 +++++++++++++++++++
 arch/x86/boot/prepare_uboot.c |   86 ++++++++++++++++++
 arch/x86/boot/regs.c          |   34 +++++++
 arch/x86/boot/tty.c           |   45 +++++++++
 12 files changed, 1027 insertions(+)
arch/x86/boot/Kconfig new file +20 -0
Index: barebox-2009.12.0/arch/x86/boot/Kconfig
===================================================================
@@ -0,0 +1,20 @@
+if X86_BIOS_BRINGUP
+
+menu "BIOS boot source              "
+
+config X86_HDBOOT
+	bool "HD boot"
+	help
+	  Add code to boot from harddisk
+
+config X86_VESA
+	bool
+	default y if X86_GENERIC_HAS_VIDEO
+
+config X86_VGA
+	bool
+	default y if X86_GENERIC_HAS_VIDEO
+
+endmenu
+
+endif
arch/x86/boot/Makefile new file +13 -0
Index: barebox-2009.12.0/arch/x86/boot/Makefile
===================================================================
@@ -0,0 +1,13 @@
+
+CPPFLAGS += -D__I386__ -fno-strict-aliasing -m32 -g -Os -march=i386 \
+	-mregparm=3 -fno-strict-aliasing -fomit-frame-pointer -ffreestanding \
+	-fno-toplevel-reorder -fno-unit-at-a-time -fno-stack-protector \
+	-mpreferred-stack-boundary=2
+
+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_VESA) += console_vesa.o
+obj-$(CONFIG_X86_VGA) += console_vga.o
+obj-$(CONFIG_X86_SERIAL) += console_serial.o
arch/x86/boot/a20.c new file +170 -0

170 lines not on this page · raw message

arch/x86/boot/bioscall.S new file +99 -0

99 lines not on this page · raw message

arch/x86/boot/boot.h new file +193 -0

193 lines not on this page · raw message

arch/x86/boot/boot_hdisk.S new file +176 -0

176 lines not on this page · raw message

arch/x86/boot/boot_main.S new file +58 -0

58 lines not on this page · raw message

arch/x86/boot/main_entry.c new file +44 -0

44 lines not on this page · raw message

arch/x86/boot/pmjump.S new file +89 -0

89 lines not on this page · raw message

arch/x86/boot/prepare_uboot.c new file +86 -0

86 lines not on this page · raw message

arch/x86/boot/regs.c new file +34 -0
Index: barebox-2009.12.0/arch/x86/boot/regs.c
===================================================================
@@ -0,0 +1,34 @@
+/* -----------------------------------------------------------------------
+ *
+ *   Copyright 2009 Intel Corporation; author H. Peter Anvin
+ *
+ *   This file is part of the Linux kernel, and is made available under
+ *   the terms of the GNU General Public License version 2 or (at your
+ *   option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+/**
+ * @file
+ * @brief Simple helper function for initializing a register set.
+ *
+ * Note that this sets EFLAGS_CF in the input register set; this
+ * makes it easier to catch functions which do nothing but don't
+ * explicitly set CF.
+ */
+
+#include <asm/segment.h>
+#include "boot.h"
+
+/* be aware of: */
+THIS_IS_REALMODE_CODE
+
+void __bootcode initregs(struct biosregs *reg)
+{
+	memset(reg, 0, sizeof *reg);
+	reg->eflags |= X86_EFLAGS_CF;
+	reg->ds = ds();
+	reg->es = ds();
+	reg->fs = fs();
+	reg->gs = gs();
+}
arch/x86/boot/tty.c new file +45 -0

45 lines not on this page · raw message

Signature · 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#15 lore raw
In reply to Juergen Beisert
Quoted 7 lines · Juergen Beisert

This patch series brings in some basic x86 support into the tree. At first this support can act as a boot loader on a BIOS based x86 machine like GRUB is. E.g. barebox will be stored in the MBR of a boot media the BIOS supports to boot from. This implementation still talks to the BIOS in real mode, to load or store data from/to a disk drive, but the barebox core itself runs in 32 bit flat mode.

Quoted 8 lines

Currently only a serial console is supported.

v2 of this patch series comes with some clean ups and also uses the discussed naming convention for BIOS based disk access. The whole series is updated to 'barebox' (instead of u-boot-v2). Note: Its tested only with QEMU yet. We are going to port it to real hardware now.

Comments are welcome.

Applied to -next.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox