mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
coreboot for the Switch
Added set_initrd() to params.h and params.c. Added PRINTK macro and KERN_SPEW to printk.h. Changed fill_inbuf.c to accept zkernel_start and zknernel_mask as variables that can be set by linuxbiosmain(). Changed linuxbiosmain() to allow custom code to modify some parameters such as where the kernel image is located in ROM, the initrd parameters and the command line. Change most of the DBG's in newpci.c to PRINTK(KERN_SPEW... This was the worst offender when DEBUG was defined. Some of it was changed to KERN_DEBUG. There are no new files this time, however, freebios-010214.orig/src/superio/SMC/fdc37n769/superio.inc remains and needs to be deleted and then 'cvs rm'. None of these changes should break any other code. The same ZKERNEL_START, ZKERNEL_MASK and CMD_LINE defines are still used, but are now all used in linuxbiosmain() and used to initialize variables that can later be changed rather than used directly. These changes allow me to choose between two kernel images, optionally use an initrd image, load the initrd image and set the kernel command line as needed. |
||
---|---|---|
Documentation | ||
HOWTO | ||
romimages | ||
src | ||
util | ||
.cvsignore | ||
AUTHORS | ||
ChangeLog | ||
NEWS | ||
README |
This is FreeBIOS. Requires bcc to compile 16-bit C code. Obtain bcc from ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/bcc.tar.gz Rough directory layout: chip is for chipset types. chip/intel is intel mainboards. chip/stpc is stpc systems. These are common files to both freebios and linuxbios. lib is architecture-indepedent (we hope) code that is used by both linuxbios and freebios. include is what you think. ---------------------------------------------------- LinuxBIOS ----------------------------------------------------- linuxbios is the linuxbios directory. Things for linuxbios ONLY live here. There is an inflate directory for the inflate code, a lib directory for common library code, an include directory, a kernel_patches directory for patches to the various kernels, and finally, Makefile.common, an included Makefile used by all the builds. Actual targets are done in caps (this is a Berkeley style thing). In each target are: 1) crt0.S for that target. These vary a bit by target, although they do include lots of common code. 2) Makefile. This mainly has -D stuff and it includes ../Makefile.common 3) ldscript.ld. We'd like to make this common, but they seem to vary a lot 4) linux. (YOU supply this). A soft link to a linux source tree. e.g. ln -s /usr/src/linux linux To make this you need a newer GAS. Our version that works is GNU assembler version 2.9.5 (i386-redhat-linux) using BFD version 2.9.5.0.22 This comes with redhat 6.2. To build, cd to the directory and make, viz. cd linuxbios/PM133 make You'll see the various compiles, then you'll see an ld step, then a step called mkrom. mkrom builds a 64k linuxbios rom image. Finally the linuxbios 64k image is concatenated with a stripped, compressed linux kernel and put into a file called 'romimage'. If you say make floppy it will build it and 'mcopy romimage a:'. This is for those of you with FLASH burners. ------------------------- LinuxBIOS structure ------------------------- Mkrom puts in a call to f000:fff0, which is the entry point for LinuxBIOS. This starts off in source form in crt0.S There are about 16 instructions of 16-bit code, in the include file ../../chip/intel/intel_start32.S. This is the absolute minimum amount of assembly code needed. This puts us into protected mode with 32-bit addresses. Next ram is turned on. We have tried hard to keep the 32-bit assembly to a minimum, and in fact what's there is really the little bit needed to get ram going, and the other little bit needed to print diagnostic messages to COM1 while RAM is set up. If you don't know it already you'll find getting SDRAM going is a real mess, though we're getting better at it bit by bit. The assembly code calls intel_main function (found in ../../chip/intel/intel_main.c). This function does all the remaining hardware setup in C. Please think hard about adding assembly! We do an awful lot in C, include cache, MTRR, MSR, and other setup. Finally, intel_main calls linuxbios_main (../inflate/main.c). This code unzips the kernel to 0x100000, and jumps to it. From that point on, Linux runs the show.