Difference between revisions of "Board:gigabyte/m57sli"

From coreboot
Jump to navigation Jump to search
(→‎SOIC hardware hack: add pointer to the newest instructions by peter)
(→‎LAB payload: more tips for building a static kexec)
Line 236: Line 236:
You will also need a statically linked copy of kexec, which the LAB payload expects to reside at  
You will also need a statically linked copy of kexec, which the LAB payload expects to reside at  


   /sbin/kexec
   /kexec on /dev/sda1


If you are on a Debian-based system, you can easily recompile your kexec package to be statically linked by following these instructions:
If you are on Ubuntu, you can easily recompile your kexec package to be statically linked by following these instructions:


   cd /usr/src
   cd /usr/src
Line 255: Line 255:
   dpkg -i kexec-tools_1.101-kdump10-2ubuntu2_i386.deb
   dpkg -i kexec-tools_1.101-kdump10-2ubuntu2_i386.deb


Adjust the package name as necessary for your distribution. You can tell if your copy of kexec is statically linked by running 'file' on it:
Adjust the package name as necessary for your distribution.  
 
If you want to build the latest kexec from Debian Sid, you're going to need to be a little more careful. Set -static:
 
  export LDFLAGS="-static"
 
Then build the package
 
  apt-get source kexec-tools -b
 
This will fail more or less like this
 
<pre>
  $ gcc -static -lz  -o build/sbin/kexec kexec/kexec.o kexec/ifdown.o kexec/kexec-elf.o kexec/kexec-elf-exec.o kexec/kexec-elf-core.o kexec/kexec-elf-rel.o kexec/kexec- elf-boot.o kexec/kexec-iomem.o kexec/crashdump.o kexec/crashdump-xen.o kexec/arch/i386/kexec-x86.o kexec/arch/i386/kexec-elf-x86.o kexec/arch/i386/kexec-elf-rel-x86.o kexec/arch/i386/kexec-bzImage.o kexec/arch/i386/kexec-multiboot-x86.o kexec/arch/i386/kexec-beoboot-x86.o kexec/arch/i386/kexec-nbi.o kexec/arch/i386/x86-linux-setup.o kexec/arch/i386/crashdump-x86.o kexec/purgatory.o libutil.a
kexec/kexec.o: In function `slurp_decompress_file':
/usr/src/kexec-tools-20080324/kexec/kexec.c:503: undefined reference to `gzopen'
/usr/src/kexec-tools-20080324/kexec/kexec.c:519: undefined reference to `gzread'
/usr/src/kexec-tools-20080324/kexec/kexec.c:533: undefined reference to `gzclose'
/usr/src/kexec-tools-20080324/kexec/kexec.c:524: undefined reference to `gzerror'
/usr/src/kexec-tools-20080324/kexec/kexec.c:535: undefined reference to `gzerror'
/usr/src/kexec-tools-20080324/kexec/kexec.c:505: undefined reference to `gzerror'
collect2: ld returned 1 exit status
</pre>
 
The problem is that the -lz really needs to go at the end of the gcc command line - otherwise it gets filtered out by gcc. When it encounters -lz, it has not yet seen any need for the libz library so it automatically removes it. Manually running
 
<pre>
gcc -static -o build/sbin/kexec kexec/kexec.o kexec/ifdown.o kexec/kexec-elf.o
  kexec/kexec-elf-exec.o kexec/kexec-elf-core.o kexec/kexec-elf-rel.o kexec/kexec-elf-boot.o
  kexec/kexec-iomem.o kexec/crashdump.o kexec/crashdump-xen.o kexec/arch/i386/kexec-x86.o
  kexec/arch/i386/kexec-elf-x86.o kexec/arch/i386/kexec-elf-rel-x86.o kexec/arch/i386/kexec-bzImage.o
  kexec/arch/i386/kexec-multiboot-x86.o kexec/arch/i386/kexec-beoboot-x86.o kexec/arch/i386/kexec-nbi.o
  kexec/arch/i386/x86-linux-setup.o kexec/arch/i386/crashdump-x86.o kexec/purgatory.o libutil.a -lz
</pre>
 
fixes the problem and gives you a static copy of kexec in build/sbin/kexec.
 
You can tell if your copy of kexec is statically linked by running 'file' on it:


   file /sbin/kexec  
   file /sbin/kexec  

Revision as of 20:36, 23 June 2008