Difference between revisions of "Tips'n'Tricks"

From Code::Blocks
m (moved to deletion requests; all information found in this article has been merged to other articles (User Documentation))
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
====[[Personalities]]====
+
[[Category:Deletion Requests]]
====[[Fixing Internal Errors]]====
+
====[[Personalities]]====
====[[Setting the WX_VER variable]]====
 
 
====[[Running under colinux]]====
 
====[[Running under colinux]]====
 
===Compiling from source===
 
 
The reason to want to do this is if you want to use a different kernel than the one provided by the colinux installer (currently 2.6.11).  If you want to compile your own modules or add something to the kernel then this might be the way to go.  If you just try to compile a new kernel and then run it under the existing colinux binaries you will get an ABI mismatch unless you compiled with their version of gcc they used (3.3.x) to cross compile the colinux binaries, so it's probably best to just setup your own cross compiler under linux and recompile the source.  Note that colinux runs in kernel mode, but does not allow linux to do direct hardware access.  It writes a layer and then hands hardware requests to windows.  So no sound output is supported (yet) and X doesn't run under linux (yet - but you can use xmingw as described above).  It's best not to modify the kernel settings from what the colinux .config file provides too much.  You will need a working linux installation and an internet connection to compile from source. <br>
 
 
- grab the source
 
[http://www.colinux.org/snapshots/stable-colinux-20050524.tar.gz]
 
 
- switch to linux
 
I actually recompiled everything from within colinux which works fine.  You could also reboot into linux. <br>
 
 
- extract the source and compile
 
I used /usr/src as the base directory.  You can use /home/username if desired. <br>
 
cd /usr/src; tar xfz stable-colinux-20050524.tar.gz
 
cd stable-colinux-20050524
 
 
Your linux distribution needs a couple of things to be able to setup the cross compiler and compile the daemons.  I needed to grab and install: <br>
 
unix2dos-2.2.src.tar.gz
 
 
The configure script will let you know about any other missing dependencies (Everything else was present here: LFS & BLFS installation).  Make sure you have wget installed since all needed mingw packages are fetched with it. <br>
 
 
Edit bin/build-common.sh <br>
 
      GCC_VERSION="3.4.4"
 
      GCC_RELEASE="$GCC_VERSION-20050522-1" 
 
      GCC_PATCH="gcc-core-$GCC_RELEASE-src-fix1.patch"
 
      MXML_URL=http://ftp.easysw.com/pub/mxml/1.3
 
 
Needed patch: <br>
 
<nowiki>#########</nowiki>begin gcc-core-3.4.4-20050522-1-src-fix1.patch<nowiki>##########</nowiki>
 
<pre>
 
diff -urN gcc-3.4.4-20050522-1.old/gcc/crtstuff.c gcc-3.4.4-20050522-1/gcc/crtstuff.c
 
--- gcc-3.4.4-20050522-1.old/gcc/crtstuff.c 2005-08-18 15:46:45.000000000 -0400
 
+++ gcc-3.4.4-20050522-1/gcc/crtstuff.c 2005-08-18 15:53:00.000000000 -0400
 
@@ -602,7 +602,8 @@
 
#if defined (USE_EH_FRAME_REGISTRY) \
 
    && !__USING_SJLJ_EXCEPTIONS__
 
static int __EH_FRAME_END__[]
 
-    __attribute__ ((unused, mode(SI), section(EH_FRAME_SECTION_NAME),
 
+/*    __attribute__ ((unused, mode(SI), section(EH_FRAME_SECTION_NAME), */
 
+    __attribute__ ((unused, section(EH_FRAME_SECTION_NAME),
 
    aligned(4)))
 
      = { 0 };
 
static void __reg_frame_ctor (void) __attribute__ ((constructor));
 
</pre>
 
<nowiki>#########</nowiki>end gcc-core-3.4.4-20050522-1-src-fix1.patch<nowiki>#########</nowiki> <br>
 
Save the above (between the <nowiki>###</nowiki> marks) to gcc-core-3.4.4-20050522-1-src-fix1.patch <br>
 
mkdir /usr/src/download (mkdir /home/username/download if using home directory)
 
mv gcc-core-3.4.4-20050522-1-src-fix1.patch /usr/src/download
 
 
The patch is needed for gcc 3.4.4 to compile as a cross compiler using sjlj exceptions (dwarf exceptions don't work well under windows it seems).  Otherwise you get errors about the mode(SI) statement. <br>
 
 
Compile: <br>
 
./configure
 
make
 
make # I got md5sum creation errors, but things resumed ok -- just type make again...
 
make install
 
 
This will download and install a mingw cross compiler under linux.  It will then proceed to compile the windows colinux daemons and finally the colinux kernel.  The kernel source will be in a subdirectory of the directory you are compiling from (/usr/src/linux-2.6.11-co or something).  You can later recompile the colinux kernel by switching to this directory and doing: <br>
 
make menuconfig # set kernel options...don't change too much or it may not work with colinux
 
make vmlinux
 
make modules modules_install # installed to /lib/linux-2.6.11-co i believe
 
 
Then just move the /usr/src/linux-2.6.11-co/vmlinux kernel image to c:\coLinux (backup the old one in case).  Fyi, the kernel patch they are using is under stable-colinux-20050524/patch/linux and the kernel .config file is stable-colinux-20050524/config/linux-config <br>
 
(tar xfz linux-2.6.11-12.tar.gz; cd linux-2.6.11-12; patch -p1 -i  <br> stable-colinux-20050524/patch/linux; cp stable-colinux-20050524/config/linux-config .config) <br>
 
to start from fresh kernel.org sources.  note that only up to 2.6.11-X is working.  A patch is available on colinux.org for 2.6.12 but I haven't tried it. <br>
 
 
Btw the make install above just installs to a subdirectory (dist/).  It won't touch /usr or /usr/local.  Once everything completes you can just tar the dist directory and copy to your windows directory: <br>
 
tar cfz dist.tar.gz dist
 
mount /mnt/cofs
 
mv dist.tar.gz /mnt/cofs
 
Winrar supports extracting from .tar.gz and .tar.bz2 archives (7zip does too I believe).
 
That's all that should be required to build colinux from source and compile custom colinux kernels.
 
Make sure you use the same gcc major version (gcc 3.4.x here) to compile both the daemons and kernel (the automatic kernel build run by the colinux install scripts does this by default). <br>
 

Latest revision as of 18:52, 11 November 2006