Author: wmb Date: 2008-12-29 11:50:20 +0100 (Mon, 29 Dec 2008) New Revision: 1053
Added: cpu/x86/pc/biosload/config-grub.fth cpu/x86/pc/biosload/config-kitchensink.fth Modified: cpu/x86/pc/biosload/HOWTO_QEMU.txt cpu/x86/pc/biosload/addrs.fth cpu/x86/pc/biosload/config-coreboot.fth cpu/x86/pc/biosload/config-i945.fth cpu/x86/pc/biosload/config-usbkey.fth cpu/x86/pc/biosload/config-virtualbox.fth cpu/x86/pc/biosload/config.fth cpu/x86/pc/biosload/ofw.bth cpu/x86/pc/elfhdr.fth cpu/x86/pc/lxdevel/addrs.fth cpu/x86/pc/lxdevel/config.fth cpu/x86/pc/neptune/config.fth cpu/x86/pc/olpc/addrs.fth cpu/x86/pc/olpc/banner.fth cpu/x86/pc/olpc/config.fth cpu/x86/pc/olpc/smallconfig.fth cpu/x86/pc/resetend.fth Log: Big cleanup of the biosload configuration files, fixing the GRUB build in the process. The following build variants now appear to work: OLPC, usbkey, QEMU/floppy, QEMU/ROM, GRUB(also etherboot).
Modified: cpu/x86/pc/biosload/HOWTO_QEMU.txt =================================================================== --- cpu/x86/pc/biosload/HOWTO_QEMU.txt 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/biosload/HOWTO_QEMU.txt 2008-12-29 10:50:20 UTC (rev 1053) @@ -14,7 +14,6 @@ $ cd cpu/x86/pc/biosload/ $ cp config-virtualbox.fth config.fth $ cd build - $ cd cpu/x86/pc/biosload/build $ make floppyofw.img
The "config-virtualbox.fth" configuration is known to work with QEMU.
Modified: cpu/x86/pc/biosload/addrs.fth =================================================================== --- cpu/x86/pc/biosload/addrs.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/biosload/addrs.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -8,8 +8,8 @@ \ early startup code - the first few instructions in the image - \ copies it to get it out of the way of things like OS load areas.
-[ifdef] linuxbios-loaded - [ifdef] qemu-loaded +[ifdef] coreboot-loaded + [ifdef] coreboot-qemu \ when running in qemu OFW is not in ROM but loaded to RAM by elfboot h# 198.0080 constant dropin-base \ Location of payload in RAM dropin-base h# 20 + constant ResetBase \ Location of "reset" dropin in RAM
Modified: cpu/x86/pc/biosload/config-coreboot.fth =================================================================== --- cpu/x86/pc/biosload/config-coreboot.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/biosload/config-coreboot.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -5,13 +5,11 @@ \ that control the boot device to boot vmlinuz from drive A. create pc-linux
-\ - ELF format (no pheader) - ROM - LinuxBIOS direct -create linuxbios-loaded +\ - ELF format (no pheader) - ROM - Coreboot direct +create coreboot-loaded +create coreboot-qemu \ Coreboot QEMU variant
-\ Load and run in qemu -create qemu-loaded - -\ LinuxBIOS+OFW under QEMU currently does not do VGA right +\ Coreboot+OFW under QEMU currently does not do VGA right create serial-console
\ In virtual mode, OFW runs with the MMU on. The advantages are
Added: cpu/x86/pc/biosload/config-grub.fth =================================================================== --- cpu/x86/pc/biosload/config-grub.fth (rev 0) +++ cpu/x86/pc/biosload/config-grub.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -0,0 +1,50 @@ +\ See license at end of file +purpose: Establish configuration definitions + +\ --- The environment that "boots" OFW --- +\ - Image Format - Example Media - previous stage bootloader + +\ - ELF format w/ Multiboot signature - various media - GRUB +create grub-loaded + +create debug-startup +\ create serial-console +create resident-packages +create addresses-assigned \ Don't reassign PCI addresses +\ create virtual-mode +\ create use-root-isa +create use-timestamp-counter +create use-pci-isa +create use-isa-ide +create use-ega +create use-elf +\ create use-ne2000 +create use-watch-all +create use-null-nvram +\ create no-floppy-node + +fload ${BP}/cpu/x86/pc/biosload/addrs.fth + +\ LICENSE_BEGIN +\ Copyright (c) 2006 FirmWorks +\ +\ Permission is hereby granted, free of charge, to any person obtaining +\ a copy of this software and associated documentation files (the +\ "Software"), to deal in the Software without restriction, including +\ without limitation the rights to use, copy, modify, merge, publish, +\ distribute, sublicense, and/or sell copies of the Software, and to +\ permit persons to whom the Software is furnished to do so, subject to +\ the following conditions: +\ +\ The above copyright notice and this permission notice shall be +\ included in all copies or substantial portions of the Software. +\ +\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +\ +\ LICENSE_END
Modified: cpu/x86/pc/biosload/config-i945.fth =================================================================== --- cpu/x86/pc/biosload/config-i945.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/biosload/config-i945.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -1,81 +1,13 @@ \ See license at end of file purpose: Establish configuration definitions - version for i945 chipset
-\ create pc \ Demo version for generic PC -\ create pc-linux \ Demo version for generic PC and Linux -\ create pc-serial \ Demo version for generic PC - \ --- The environment that "boots" OFW --- \ - Image Format - Example Media - previous stage bootloader
-\ - (Syslinux) COM32 format - USB Key w/ FAT FS - Syslinux -\ create syslinux-loaded - -\ - Linux kernel format - USB Key w/ FAT FS - LinuxBIOS w/ stripped Linux payload -\ create bzimage-loaded - -\ - ELF format w/ Multiboot signature - various - GRUB -\ create grub-loaded -\ create etherboot-variant \ Enable additional tweaks for Etherboot - -\ - ELF format (no pheader) - ROM - LinuxBIOS direct -\ create linuxbios-loaded - -\ Load and run in qemu -\ create qemu-loaded - \ Load from ROM by preOF code from Intel create preof-loaded
-[ifdef] pc-serial create serial-console -create pc -[then] - -[ifdef] qemu-loaded \ LinuxBIOS+OFW under QEMU currently doesn't do VGA right -create serial-console -[then] - -[ifdef] etherboot-variant -create debug-startup -create serial-console -[then] - -[ifdef] pc-linux -\ In virtual mode, OFW runs with the MMU on. The advantages are -\ that OFW can automatically locate itself out of the way, at the -\ top of physical memory, it can dynamically allocate exactly as -\ much physical memory as it needs, and it can remain alive after -\ the OS starts. The disadvantage is that it is more confusing - -\ you always have to be aware of the distinction between virtual -\ and physical addresses. - -\ Here we use virtual mode for Linux, so that we can debug past -\ the point where Linux starts using the MMU. It isn't strictly -\ necessary to use virtual mode if you just want to boot Linux -\ and then have OFW disappear. -create virtual-mode -create pc -create linux-support -[then] - -[ifdef] pc -\ create pseudo-nvram -create resident-packages -create addresses-assigned \ Don't reassign PCI addresses -\ create virtual-mode -create use-root-isa -create use-isa-ide -create use-ega -create use-elf -create use-ne2000 -create use-watch-all -create use-null-nvram -create no-floppy-node -[then] - -[ifdef] preof-loaded -create serial-console create use-timestamp-counter create resident-packages create addresses-assigned \ Don't reassign PCI addresses @@ -86,9 +18,9 @@ create use-watch-all create use-null-nvram create no-floppy-node -[then]
fload ${BP}/cpu/x86/pc/biosload/addrs.fth + \ LICENSE_BEGIN \ Copyright (c) 2006 FirmWorks \
Added: cpu/x86/pc/biosload/config-kitchensink.fth =================================================================== --- cpu/x86/pc/biosload/config-kitchensink.fth (rev 0) +++ cpu/x86/pc/biosload/config-kitchensink.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -0,0 +1,147 @@ +\ See license at end of file +purpose: Establish configuration definitions + +\ create pc \ Demo version for generic PC +\ create pc-linux \ Demo version for generic PC and Linux +\ create pc-serial \ Demo version for generic PC + +\ --- The environment that "boots" OFW --- +\ - Image Format - Example Media - previous stage bootloader + +\ - (Syslinux) COM32 format - USB Key w/ FAT FS - Syslinux +\ create syslinux-loaded + +\ - Linux kernel format - USB Key w/ FAT FS - Coreboot w/ stripped Linux payload +\ create bzimage-loaded + +\ - ELF format w/ Multiboot signature - various - GRUB +create grub-loaded + +\ - ELF format (no pheader) - Coreboot +\ create coreboot-loaded + +\ create coreboot-qemu \ Variant + +\ Load and run in VirtualBox +\ create virtualbox-loaded + +\ Load from ROM by preOF code from Intel +\ create preof-loaded + +[ifdef] pc-serial +create serial-console +create pc +[then] + +[ifdef] coreboot-qemu \ Coreboot+OFW under QEMU currently does not do VGA right +create serial-console +[then] + +[ifdef] grub-loaded +create debug-startup +\ create serial-console +create resident-packages +create addresses-assigned \ Don't reassign PCI addresses +\ create virtual-mode +\ create use-root-isa +create use-timestamp-counter +create use-pci-isa +create use-isa-ide +create use-ega +create use-elf +\ create use-ne2000 +create use-watch-all +create use-null-nvram +\ create no-floppy-node +[then] + +[ifdef] virtualbox-loaded +\ create debug-startup +\ create serial-console +create resident-packages +create addresses-assigned \ Don't reassign PCI addresses +\ create virtual-mode +\ create use-root-isa +create use-timestamp-counter +create use-pci-isa +create use-isa-ide +create use-ega +create use-elf +\ create use-ne2000 +create use-watch-all +create use-null-nvram +\ create no-floppy-node +[then] + +[ifdef] pc-linux +\ In virtual mode, OFW runs with the MMU on. The advantages are +\ that OFW can automatically locate itself out of the way, at the +\ top of physical memory, it can dynamically allocate exactly as +\ much physical memory as it needs, and it can remain alive after +\ the OS starts. The disadvantage is that it is more confusing - +\ you always have to be aware of the distinction between virtual +\ and physical addresses. + +\ Here we use virtual mode for Linux, so that we can debug past +\ the point where Linux starts using the MMU. It is not strictly +\ necessary to use virtual mode if you just want to boot Linux +\ and then have OFW disappear. +create virtual-mode +create pc +create linux-support +[then] + +[ifdef] pc +\ create pseudo-nvram +create resident-packages +create addresses-assigned \ Don't reassign PCI addresses +\ create virtual-mode +create use-root-isa +create use-isa-ide +create use-ega +create use-elf +create use-ne2000 +create use-watch-all +create use-null-nvram +create no-floppy-node +[then] + +[ifdef] preof-loaded +create serial-console +create use-timestamp-counter +create resident-packages +create addresses-assigned \ Don't reassign PCI addresses +\ create virtual-mode +create use-root-isa +create use-isa-ide +create use-elf +create use-watch-all +create use-null-nvram +create no-floppy-node +[then] + +fload ${BP}/cpu/x86/pc/biosload/addrs.fth + +\ LICENSE_BEGIN +\ Copyright (c) 2006 FirmWorks +\ +\ Permission is hereby granted, free of charge, to any person obtaining +\ a copy of this software and associated documentation files (the +\ "Software"), to deal in the Software without restriction, including +\ without limitation the rights to use, copy, modify, merge, publish, +\ distribute, sublicense, and/or sell copies of the Software, and to +\ permit persons to whom the Software is furnished to do so, subject to +\ the following conditions: +\ +\ The above copyright notice and this permission notice shall be +\ included in all copies or substantial portions of the Software. +\ +\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +\ +\ LICENSE_END
Modified: cpu/x86/pc/biosload/config-usbkey.fth =================================================================== --- cpu/x86/pc/biosload/config-usbkey.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/biosload/config-usbkey.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -1,65 +1,15 @@ \ See license at end of file purpose: Configuration for loading from a USB key via Syslinux
-\ create pc \ Demo version for generic PC -\ create pc-linux \ Demo version for generic PC and Linux -create pc-serial \ Demo version for generic PC - \ --- The environment that "boots" OFW --- \ - Image Format - Example Media - previous stage bootloader
\ - (Syslinux) COM32 format - USB Key w/ FAT FS - Syslinux create syslinux-loaded
-\ - Linux kernel format - USB Key w/ FAT FS - LinuxBIOS w/ stripped Linux payload -\ create bzimage-loaded - -\ - ELF format w/ Multiboot signature - various - GRUB -\ create grub-loaded -\ create etherboot-variant \ Enable additional tweaks for Etherboot - -\ - ELF format (no pheader) - ROM - LinuxBIOS direct -\ create linuxbios-loaded - -\ Load and run in qemu -\ create qemu-loaded - -\ Load from ROM by preOF code from Intel -\ create preof-loaded - -[ifdef] pc-serial create serial-console create pc -[then]
-[ifdef] qemu-loaded \ LinuxBIOS+OFW under QEMU currently doesn't do VGA right -create serial-console -[then] - -[ifdef] etherboot-variant -create debug-startup -create serial-console -[then] - -[ifdef] pc-linux -\ In virtual mode, OFW runs with the MMU on. The advantages are -\ that OFW can automatically locate itself out of the way, at the -\ top of physical memory, it can dynamically allocate exactly as -\ much physical memory as it needs, and it can remain alive after -\ the OS starts. The disadvantage is that it is more confusing - -\ you always have to be aware of the distinction between virtual -\ and physical addresses. - -\ Here we use virtual mode for Linux, so that we can debug past -\ the point where Linux starts using the MMU. It isn't strictly -\ necessary to use virtual mode if you just want to boot Linux -\ and then have OFW disappear. -create virtual-mode -create pc -create linux-support -[then] - -[ifdef] pc \ create pseudo-nvram create resident-packages create addresses-assigned \ Don't reassign PCI addresses @@ -72,23 +22,9 @@ create use-watch-all create use-null-nvram create no-floppy-node -[then]
-[ifdef] preof-loaded -create serial-console -create use-timestamp-counter -create resident-packages -create addresses-assigned \ Don't reassign PCI addresses -\ create virtual-mode -create use-root-isa -create use-isa-ide -create use-elf -create use-watch-all -create use-null-nvram -create no-floppy-node -[then] - fload ${BP}/cpu/x86/pc/biosload/addrs.fth + \ LICENSE_BEGIN \ Copyright (c) 2006 FirmWorks \
Modified: cpu/x86/pc/biosload/config-virtualbox.fth =================================================================== --- cpu/x86/pc/biosload/config-virtualbox.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/biosload/config-virtualbox.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -1,45 +1,12 @@ \ See license at end of file purpose: Establish configuration definitions
-\ create pc \ Demo version for generic PC -\ create pc-linux \ Demo version for generic PC and Linux -\ create pc-serial \ Demo version for generic PC - \ --- The environment that "boots" OFW --- \ - Image Format - Example Media - previous stage bootloader
-\ - (Syslinux) COM32 format - USB Key w/ FAT FS - Syslinux -\ create syslinux-loaded - -\ - Linux kernel format - USB Key w/ FAT FS - LinuxBIOS w/ stripped Linux payload -\ create bzimage-loaded - -\ - ELF format w/ Multiboot signature - various - GRUB -\ create grub-loaded -\ create etherboot-variant \ Enable additional tweaks for Etherboot - -\ - ELF format (no pheader) - ROM - LinuxBIOS direct -\ create linuxbios-loaded - -\ Load and run in qemu -\ create qemu-loaded - -\ Load and run in VirtualBox +\ Load and run in VirtualBox (also works for other emulators) create virtualbox-loaded
-\ Load from ROM by preOF code from Intel -\ create preof-loaded - -[ifdef] pc-serial -create serial-console -create pc -[then] - -[ifdef] qemu-loaded \ LinuxBIOS+OFW under QEMU currently does not do VGA right -create serial-console -[then] - -[ifdef] virtualbox-loaded \ create debug-startup \ create serial-console create resident-packages @@ -55,60 +22,7 @@ create use-watch-all create use-null-nvram \ create no-floppy-node -[then]
-[ifdef] etherboot-variant -create debug-startup -create serial-console -[then] - -[ifdef] pc-linux -\ In virtual mode, OFW runs with the MMU on. The advantages are -\ that OFW can automatically locate itself out of the way, at the -\ top of physical memory, it can dynamically allocate exactly as -\ much physical memory as it needs, and it can remain alive after -\ the OS starts. The disadvantage is that it is more confusing - -\ you always have to be aware of the distinction between virtual -\ and physical addresses. - -\ Here we use virtual mode for Linux, so that we can debug past -\ the point where Linux starts using the MMU. It is not strictly -\ necessary to use virtual mode if you just want to boot Linux -\ and then have OFW disappear. -create virtual-mode -create pc -create linux-support -[then] - -[ifdef] pc -\ create pseudo-nvram -create resident-packages -create addresses-assigned \ Don't reassign PCI addresses -\ create virtual-mode -create use-root-isa -create use-isa-ide -create use-ega -create use-elf -create use-ne2000 -create use-watch-all -create use-null-nvram -create no-floppy-node -[then] - -[ifdef] preof-loaded -create serial-console -create use-timestamp-counter -create resident-packages -create addresses-assigned \ Don't reassign PCI addresses -\ create virtual-mode -create use-root-isa -create use-isa-ide -create use-elf -create use-watch-all -create use-null-nvram -create no-floppy-node -[then] - fload ${BP}/cpu/x86/pc/biosload/addrs.fth
\ LICENSE_BEGIN
Modified: cpu/x86/pc/biosload/config.fth =================================================================== --- cpu/x86/pc/biosload/config.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/biosload/config.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -1,45 +1,12 @@ \ See license at end of file purpose: Establish configuration definitions
-\ create pc \ Demo version for generic PC -\ create pc-linux \ Demo version for generic PC and Linux -\ create pc-serial \ Demo version for generic PC - \ --- The environment that "boots" OFW --- \ - Image Format - Example Media - previous stage bootloader
-\ - (Syslinux) COM32 format - USB Key w/ FAT FS - Syslinux -\ create syslinux-loaded - -\ - Linux kernel format - USB Key w/ FAT FS - LinuxBIOS w/ stripped Linux payload -\ create bzimage-loaded - -\ - ELF format w/ Multiboot signature - various - GRUB -\ create grub-loaded -\ create etherboot-variant \ Enable additional tweaks for Etherboot - -\ - ELF format (no pheader) - ROM - LinuxBIOS direct -\ create linuxbios-loaded - -\ Load and run in qemu -\ create qemu-loaded - -\ Load and run in VirtualBox +\ Load and run in VirtualBox (also works for other emulators) create virtualbox-loaded
-\ Load from ROM by preOF code from Intel -\ create preof-loaded - -[ifdef] pc-serial -create serial-console -create pc -[then] - -[ifdef] qemu-loaded \ LinuxBIOS+OFW under QEMU currently does not do VGA right -create serial-console -[then] - -[ifdef] virtualbox-loaded \ create debug-startup \ create serial-console create resident-packages @@ -55,60 +22,7 @@ create use-watch-all create use-null-nvram \ create no-floppy-node -[then]
-[ifdef] etherboot-variant -create debug-startup -create serial-console -[then] - -[ifdef] pc-linux -\ In virtual mode, OFW runs with the MMU on. The advantages are -\ that OFW can automatically locate itself out of the way, at the -\ top of physical memory, it can dynamically allocate exactly as -\ much physical memory as it needs, and it can remain alive after -\ the OS starts. The disadvantage is that it is more confusing - -\ you always have to be aware of the distinction between virtual -\ and physical addresses. - -\ Here we use virtual mode for Linux, so that we can debug past -\ the point where Linux starts using the MMU. It is not strictly -\ necessary to use virtual mode if you just want to boot Linux -\ and then have OFW disappear. -create virtual-mode -create pc -create linux-support -[then] - -[ifdef] pc -\ create pseudo-nvram -create resident-packages -create addresses-assigned \ Don't reassign PCI addresses -\ create virtual-mode -create use-root-isa -create use-isa-ide -create use-ega -create use-elf -create use-ne2000 -create use-watch-all -create use-null-nvram -create no-floppy-node -[then] - -[ifdef] preof-loaded -create serial-console -create use-timestamp-counter -create resident-packages -create addresses-assigned \ Don't reassign PCI addresses -\ create virtual-mode -create use-root-isa -create use-isa-ide -create use-elf -create use-watch-all -create use-null-nvram -create no-floppy-node -[then] - fload ${BP}/cpu/x86/pc/biosload/addrs.fth
\ LICENSE_BEGIN
Modified: cpu/x86/pc/biosload/ofw.bth =================================================================== --- cpu/x86/pc/biosload/ofw.bth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/biosload/ofw.bth 2008-12-29 10:50:20 UTC (rev 1053) @@ -33,21 +33,16 @@
[ifdef] grub-loaded fload ${BP}/cpu/x86/pc/elfhdr.fth - [ifdef] etherboot-variant - .( --- Saving as ofwnet.elf - GRUB multiboot format) cr - writing ofwnet.elf - [else] .( --- Saving as ofwgrub.elf - GRUB multiboot format) cr writing ofwgrub.elf - [then] elf-header /elf-header ofd @ fputs [then]
-[ifdef] linuxbios-loaded - .( --- Saving as ofwlb.elf - LinuxBIOS payload format) cr +[ifdef] coreboot-loaded + .( --- Saving as ofwlb.elf - Coreboot payload format) cr fload ${BP}/cpu/x86/pc/elfhdr.fth writing ofwlb.elf - [ifdef] qemu-loaded + [ifdef] coreboot-qemu elf-header /elf-header ofd @ fputs [else] elf-header /elf-header 0 " elf-header" write-dropin @@ -62,6 +57,7 @@ [then]
[ifdef] bzimage-loaded + \ - Linux kernel format - USB Key w/ FAT FS - Coreboot w/ stripped Linux payload .( --- Saving as ofw.bzi - Linux kernel format) cr fload ${BP}/cpu/x86/pc/bzhdr.fth writing ofw.bzi @@ -137,15 +133,14 @@ " ${BP}/ofw/termemu/cp881-16.obf" " font" $add-deflated-dropin [then]
- [ifdef] grub-loaded - ofd @ fsize pad ! \ file size; store in memory for convenience below + ofd @ fsize h# 60 - pad ! \ file size; store in memory for convenience below h# 44 ofd @ fseek \ Seek to file size field; see elfhdr.bth pad 4 ofd @ fputs \ Patch file size pad 4 ofd @ fputs \ Patch memory size [then]
-[ifdef] qemu-loaded +[ifdef] coreboot-qemu ofd @ fsize pad ! \ file size; store in memory for convenience below h# 44 ofd @ fseek \ Seek to file size field; see elfhdr.bth pad 4 ofd @ fputs \ Patch file size
Modified: cpu/x86/pc/elfhdr.fth =================================================================== --- cpu/x86/pc/elfhdr.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/elfhdr.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -1,6 +1,43 @@ \ See license at end of file purpose: Create an ELF format
+\ This handles several different loader cases + +0 value #pheaders +0 value elf-entry +0 value file-offset +0 value elf-addr + +[ifdef] grub-loaded +\ For GRUB, we want to copy the stuff after the ELF headers and the Multiboot +\ header to the final RAM location (dropin-base), so OFW sees just the dropins. +\ The start address is just after the first dropin header. + +dropin-base h# 20 + to elf-entry \ Skip OBMD header in RAM copy +1 to #pheaders \ The pheader causes the image to be copied to RAM +h# 54 h# 0c + to file-offset \ Copy start after pheader + multiboot header (0c) +dropin-base to elf-addr \ Copy file image directly to dropin-base +[then] + +[ifdef] coreboot-loaded + [ifdef] coreboot-qemu + \ For coreboot under QEMU, we want to copy everything, including the ELF headers. + \ We want the ELF headers to be in memory, but Forth shouldn't see them, so we + \ put the headers before dropin-base + + dropin-base h# 20 + to elf-entry \ Skip OBMD header in RAM copy + 1 to #pheaders \ The pheader causes the image to be copied to RAM + 0 to file-offset \ Copy the whole thing, don't skip the ELF headers + dropin-base h# 80 - to elf-addr \ Copied headers will precede dropin-base + [else] + \ For coreboot running from ROM, we can leave everything in ROM, no need to copy, + \ so there's no need for a pheader. + + dropin-base h# 80 + h# 20 + to elf-entry \ Entry is after ELF + OBMD headers + 0 to #pheaders \ No pheaders; we'll use the ROM copy of the dropins + [then] +[then] + create elf-header h# 7f c, char E c, char L c, char F c, 1 c, \ 4 @@ -12,88 +49,42 @@ 2 w, \ 0x10 object file type ET_EXEC 3 w, \ 0x12 architecture EM_386 1 l, \ 0x14 object file version EV_CURRENT - - \ Skip this ELF dropin (80) + the OBMD header of the next dropin (20) -[ifdef] etherboot-variant - \ elf-header is not a dropin, so we only need to skip OBMD header of reset - \ we adjust the load-address below at position 0x40 - dropin-base h# 20 + l, \ 0x18 entry point virtual address -[then] -[ifdef] qemu-loaded - \ skip OBMD header but keep elf-header because elfboot in LinuxBIOS needs it - dropin-base h# 20 + l, \ 0x18 entry point virtual address -[else] - \ Skip this ELF dropin (80) + the OBMD header of the next dropin (20) - dropin-base h# 80 + h# 20 + l, \ 0x18 entry point virtual address -[then] + elf-entry l, \ 0x18 entry point virtual address h# 34 l, \ 0x1c program header file offset 0 l, \ 0x20 section header file offset 0 l, \ 0x24 flags h# 34 w, \ 0x28 ELF header size h# 20 w, \ 0x2a program header table entry size -[ifdef] grub-loaded - 1 w, \ 0x2c program header table entry count (one pheader) -[then] -[ifdef] qemu-loaded - 1 w, \ 0x2c program header table entry count (one pheader) -[else] - 0 w, \ 0x2c program header table entry count (no pheaders) -[then] + #pheaders w, \ 0x2c program header table entry count (one pheader) 0 w, \ 0x2e section header table entry size 0 w, \ 0x30 section header table entry count 0 w, \ 0x32 section header string table index
-[ifdef] grub-loaded \ Pheader causes GRUB to copy us to RAM - \ 0x34 Pheader - 1 l, \ 0x34 entry type PT_LOAD - h# 54 l, \ 0x38 file offset - 0 l, \ 0x3c vaddr -[then] - -[ifdef] qemu-loaded \ Pheader causes elfboot to copy us to RAM - \ 0x34 Pheader - 1 l, \ 0x34 entry type PT_LOAD - 0 l, \ 0x38 file offset - dropin-base 80 - l, \ 0x3c vaddr -[then] - -[ifdef] etherboot-variant - \ we need to skip what left of elf-hdr. to get it to point to a dropin - \ why is it 0x14 ? I would have thought it should be the size of the multiboot header - \ which is 0x0c - dropin-base h# 14 - l, \ 0x40 paddr \ Where to put the bits -[then] - -[ifdef] qemu-loaded - dropin-base h# 80 - l, \ 0x40 paddr \ Where to put the bits +#pheaders [if] + 1 l, \ 0x34 entry type PT_LOAD + file-offset l, \ 0x38 file offset + elf-addr l, \ 0x3c vaddr + elf-addr l, \ 0x40 paddr - where to put the bits + h# ffffffff l, \ 0x44 file size - backpatched later + h# ffffffff l, \ 0x48 memory size - backpatched later + 7 l, \ 0x4c entry flags RWX + 0 l, \ 0x50 alignment + \ 0x54 End of pheader [else] - dropin-base l, \ 0x40 paddr \ Where to put the bits + here h# 54 h# 34 - dup allot erase \ Pad to make the size consistent [then] - h# ffffffff l, \ 0x44 file size \ backpatched later - h# ffffffff l, \ 0x48 memory size \ backpatched later
-[ifndef] qemu-loaded - 0 l, - 0 l, -[then] - 7 l, \ 0x4c entry flags RWX - 0 l, \ 0x50 alignment - \ 0x54 End of pheader -[then] [ifdef] grub-loaded \ "Multiboot" header that GRUB looks for - h# 1BADB002 , \ 0x54 - h# 0 , \ 0x58 - h# 1BADB002 negate , \ 0x5c + h# 1BADB002 , \ 0x54 signature + h# 0 , \ 0x58 flags + h# 1BADB002 negate , \ 0x5c checksum: -(signature + flags) \ 0x60 End +[else] + here h# 60 h# 54 - dup allot erase \ Pad to make the size consistent [then]
-[ifdef] linuxbios-loaded - \ Pad out to h# 60 so the size is the same as above - here h# 60 h# 34 - dup allot erase -[then] - - \ The total size, including the dropin header, will be h# 80 +\ The total size, including the dropin header, will be h# 80 here elf-header - constant /elf-header
\ LICENSE_BEGIN
Modified: cpu/x86/pc/lxdevel/addrs.fth =================================================================== --- cpu/x86/pc/lxdevel/addrs.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/lxdevel/addrs.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -27,47 +27,6 @@ h# 20.0000 constant /fw-ram [then]
-[ifdef] linuxbios-loaded -\ h# d8.0000 constant dropin-base -h# fff2.0000 constant dropin-base \ Location of payload in FLASH -\ h# fff8.0000 constant dropin-base \ Location of payload in FLASH -dropin-base h# 80 + h# 20 + constant ResetBase \ Location of "reset" dropin in ROM -h# 08.0000 constant dropin-size -h# 1e0.0000 constant fw-pa -h# 20.0000 constant /fw-ram -h# fff0.0000 constant rom-pa -h# 10.0000 constant /rom -[then] - -[ifdef] old-bzimage-loaded -\ h# d8.0000 constant dropin-base -h# 10.0020 constant dropin-base \ RAM address where Linux normally loads -h# 08.0000 constant dropin-size -h# 20.0000 constant fw-pa -h# 20.0000 constant /fw-ram -[then] - -[ifdef] bzimage-loaded -h# 1d8.0020 constant dropin-base \ RAM address where we want to end up -h# 08.0000 constant dropin-size -h# 1e0.0000 constant fw-pa -h# 20.0000 constant /fw-ram -[then] - -[ifdef] syslinux-loaded -h# 10.1020 constant dropin-base -h# 07.e0e0 constant dropin-size -h# 20.0000 constant fw-pa -h# 20.0000 constant /fw-ram -[then] - -[ifdef] grub-loaded -h# 1b8.0000 constant dropin-base -h# 08.0000 constant dropin-size -h# 1c0.0000 constant fw-pa -h# 20.0000 constant /fw-ram -[then] - h# 80.0000 constant def-load-base \ Convenient for initrd
\ The heap starts at RAMtop, which on this system is "fw-pa /fw-ram +"
Modified: cpu/x86/pc/lxdevel/config.fth =================================================================== --- cpu/x86/pc/lxdevel/config.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/lxdevel/config.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -10,18 +10,6 @@ \ - OBMD format - ROM - direct boot from ROM create rom-loaded
-\ - ELF format (no pheader) - ROM - LinuxBIOS direct -\ create linuxbios-loaded - -\ - Linux kernel format - USB Key w/ FAT FS - LinuxBIOS w/ stripped Linux payload -\ create bzimage-loaded - -\ - ELF format w/ Multiboot signature - various - GRUB -\ create grub-loaded - -\ - (Syslinux) COM32 format - USB Key w/ FAT FS - Syslinux -\ create syslinux-loaded - create virtual-mode create addresses-assigned \ Define if base addresses are already assigned \ create serial-console \ Define to default to serial port for console
Modified: cpu/x86/pc/neptune/config.fth =================================================================== --- cpu/x86/pc/neptune/config.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/neptune/config.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -12,19 +12,6 @@ \ - OBMD format - ROM - direct boot from ROM create rom-loaded
-\ - ELF format (no pheader) - ROM - LinuxBIOS direct -\ create linuxbios-loaded - -\ - Linux kernel format - USB Key w/ FAT FS - LinuxBIOS w/ stripped Linux payload -\ create bzimage-loaded - -\ - ELF format w/ Multiboot signature - various - GRUB -\ create grub-loaded - -\ - (Syslinux) COM32 format - USB Key w/ FAT FS - Syslinux -\ create syslinux-loaded - - create virtual-mode create addresses-assigned \ Define if base addresses are already assigned create serial-console \ Define to default to serial port for console
Modified: cpu/x86/pc/olpc/addrs.fth =================================================================== --- cpu/x86/pc/olpc/addrs.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/olpc/addrs.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -22,47 +22,6 @@ h# 40.0000 constant /fw-area [then]
-[ifdef] linuxbios-loaded -\ h# d8.0000 constant dropin-base -h# fff2.0000 constant dropin-base \ Location of payload in FLASH -\ h# fff8.0000 constant dropin-base \ Location of payload in FLASH -dropin-base h# 80 + h# 20 + constant ResetBase \ Location of "reset" dropin in ROM -h# 08.0000 constant dropin-size -h# 1e0.0000 constant fw-pa -h# 20.0000 constant /fw-ram -h# fff0.0000 constant rom-pa -h# 10.0000 constant /rom -[then] - -[ifdef] old-bzimage-loaded -\ h# d8.0000 constant dropin-base -h# 10.0020 constant dropin-base \ RAM address where Linux normally loads -h# 08.0000 constant dropin-size -h# 20.0000 constant fw-pa -h# 20.0000 constant /fw-ram -[then] - -[ifdef] bzimage-loaded -h# 1d8.0020 constant dropin-base \ RAM address where we want to end up -h# 08.0000 constant dropin-size -h# 1e0.0000 constant fw-pa -h# 20.0000 constant /fw-ram -[then] - -[ifdef] syslinux-loaded -h# 10.1020 constant dropin-base -h# 07.e0e0 constant dropin-size -h# 20.0000 constant fw-pa -h# 20.0000 constant /fw-ram -[then] - -[ifdef] grub-loaded -h# 1b8.0000 constant dropin-base -h# 08.0000 constant dropin-size -h# 1c0.0000 constant fw-pa -h# 20.0000 constant /fw-ram -[then] - h# 80.0000 constant def-load-base \ Convenient for initrd
\ The heap starts at RAMtop, which on this system is "fw-pa /fw-ram +"
Modified: cpu/x86/pc/olpc/banner.fth =================================================================== --- cpu/x86/pc/olpc/banner.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/olpc/banner.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -9,15 +9,9 @@ \ major-release (.) type ." ." minor-release (.) type sub-release type \ pop-base \ This is the manufacturing signature -[ifdef] linuxbios-loaded - h# ffff.ffc0 h# 10 type cr -[then] [ifdef] rom-loaded h# ffff.ffc0 h# 10 type cr [then] -[ifdef] bzimage-loaded - ." booted from disk - " .built -[then] ;
: (xbanner-basics) ( -- )
Modified: cpu/x86/pc/olpc/config.fth =================================================================== --- cpu/x86/pc/olpc/config.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/olpc/config.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -9,19 +9,6 @@ \ - OBMD format - ROM - direct boot from ROM create rom-loaded
-\ - ELF format (no pheader) - ROM - LinuxBIOS direct -\ create linuxbios-loaded - -\ - Linux kernel format - USB Key w/ FAT FS - LinuxBIOS w/ stripped Linux payload -\ create bzimage-loaded - -\ - ELF format w/ Multiboot signature - various - GRUB -\ create grub-loaded - -\ - (Syslinux) COM32 format - USB Key w/ FAT FS - Syslinux -\ create syslinux-loaded - - \ create virtual-mode create addresses-assigned \ Define if base addresses are already assigned \ create serial-console \ Define to default to serial port for console
Modified: cpu/x86/pc/olpc/smallconfig.fth =================================================================== --- cpu/x86/pc/olpc/smallconfig.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/olpc/smallconfig.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -9,19 +9,6 @@ \ - OBMD format - ROM - direct boot from ROM create rom-loaded
-\ - ELF format (no pheader) - ROM - LinuxBIOS direct -\ create linuxbios-loaded - -\ - Linux kernel format - USB Key w/ FAT FS - LinuxBIOS w/ stripped Linux payload -\ create bzimage-loaded - -\ - ELF format w/ Multiboot signature - various - GRUB -\ create grub-loaded - -\ - (Syslinux) COM32 format - USB Key w/ FAT FS - Syslinux -\ create syslinux-loaded - - \ create virtual-mode create addresses-assigned \ Define if base addresses are already assigned \ create serial-console \ Define to default to serial port for console
Modified: cpu/x86/pc/resetend.fth =================================================================== --- cpu/x86/pc/resetend.fth 2008-12-28 10:49:29 UTC (rev 1052) +++ cpu/x86/pc/resetend.fth 2008-12-29 10:50:20 UTC (rev 1053) @@ -4,9 +4,8 @@ \ The memory layout information from the start dropin is stored in low \ memory.
-[ifndef] qemu-loaded -[ifndef] syslinux-loaded -[ifndef] preof-loaded + \ Beginning of "switch to new GDT" section + \ Move GDT to low memory. We use the first location at gdt-pa as \ scratch memory for sgdt, and put the actual gdt at gdt-pa + 0x10 gdt-pa # ax mov @@ -17,30 +16,26 @@ cx inc
gdt-pa h# 10 + # di mov \ New GDT base - di 2 [ax] mov \ Set new GDT base rep movsb \ Copy ROM GDT to RAM
- \ Copy code and data segment descriptors from 10,18 to 60,68 - gdt-pa h# 10 + h# 10 + # si mov \ Descriptor 0x10 - src - gdt-pa h# 10 + h# 60 + # di mov \ Descriptor 0x60 - dst - 4 # cx mov \ 4 longwords, 2 descriptors - rep movs + \ Move the code and data descriptors to 60,68 + gdt-pa h# 10 + h# 60 + # di mov \ Destination - New descriptor 0x60
- op: h# ff # 0 [ax] mov \ Make GDT bigger for Linux + cs si mov 2 [ax] si add \ Source - Current code descriptor + movs movs \ 2 longwords (1 descriptor) -> 60
+ ds si mov 2 [ax] si add \ Source - Current data descriptor + movs movs \ 2 longwords (1 descriptor) -> 68 + + op: h# ff # 0 [ax] mov \ New GDT size + gdt-pa h# 10 + # 2 [ax] mov \ New GDT base 0 [ax] lgdt \ Setup RAM GDT
- \ Next time segment registers are changed, they will be - \ reloaded from memory. - - \ qemu hangs when trying to do this + \ Reload code segment descriptor from new table here asm-base - ResetBase + 7 + h# 60 #) far jmp \ 7-byte instruction -\ here asm-base - ResetBase + 7 + h# 10 #) far jmp \ 7-byte instruction - \ nop nop nop nop
-\ begin again + \ Reload data segment descriptors from new table h# 68 # ax mov -\ h# 18 # ax mov ax ds mov ax es mov ax fs mov @@ -49,13 +44,12 @@
h# 20 # al mov al h# 80 # out
+ \ End of "switch to new GDT" section + [ifdef] mem-info-pa gdt-pa /page round-up # ax mov \ Current low-memory high water mark ax mem-info-pa 2 la+ #) mov \ Store in memory info area [then] -[then] -[then] -[then]
cld
openfirmware@openfirmware.info