ผลต่างระหว่างรุ่นของ "คอมไพล์เคอร์เนล"

จาก Morange Wiki
(หน้าที่ถูกสร้างด้วย '== Cross compiling from OSX == === Macports === The Kernel source requires a case-sensitive filesystem. If you do not have a HFS+ Case-...')
 
(Macports)
แถว 78: แถว 78:
 
export CCPREFIX=/opt/local/bin/arm-none-eabi-
 
export CCPREFIX=/opt/local/bin/arm-none-eabi-
 
make mrproper
 
make mrproper
 +
</pre>
 +
<pre>
 +
git clone git://aufs.git.sourceforge.net/gitroot/aufs/aufs3-standalone.git
 +
cd aufs3-standalone
 +
git checkout origin/aufs3.6
 +
cp -rp *.patch ../
 +
cp -rp fs ../
 +
cp -rp Documentation/ ../
 +
cp -rp include/ ../
 +
cd ..
 +
</pre>
 +
<pre>
 +
zcat /proc/config.gz > .config
 +
</pre>
 +
<pre>
 
cp /Volumes/raspberrypi-kernel/raspberrypi.config .config
 
cp /Volumes/raspberrypi-kernel/raspberrypi.config .config
 
#answer yes to all config options
 
#answer yes to all config options

รุ่นแก้ไขเมื่อ 23:54, 29 มิถุนายน 2557

Cross compiling from OSX

Macports

The Kernel source requires a case-sensitive filesystem. If you do not have a HFS+ Case-sensitive partition that can be used, create a disk image with the appropriate format. Ensure latest Xcode and command line tools are installed from Apple Developer Connection Install macports

port install arm-none-eabi-gcc
port install arm-none-eabi-binutils

If you get an error message that elf.h is missing

sudo port install libelf && sudo ln -s /opt/local/include/libelf /usr/include/libelf

From opensource.apple.com, download and copy elf.h and elftypes.h to /usr/include

Edit elf.h and add

#define R_386_NONE        0
#define R_386_32          1
#define R_386_PC32        2
#define R_ARM_NONE        0
#define R_ARM_PC24        1
#define R_ARM_ABS32       2
#define R_MIPS_NONE       0
#define R_MIPS_16         1
#define R_MIPS_32         2
#define R_MIPS_REL32      3
#define R_MIPS_26         4
#define R_MIPS_HI16       5
#define R_MIPS_LO16       6

If you get a "SEGMENT_SIZE is undeclared" error open the Makefile and change the line:

NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)

to

NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) -Dlinux

Complete script requires raspberrypi.config to be in the same folder that you execute from

sudo port install arm-none-eabi-gcc
sudo port install arm-none-eabi-binutils
sudo port install libelf && sudo ln -s /opt/local/include/libelf /usr/include/libelf
sudo curl http://opensource.apple.com/source/dtrace/dtrace-48/sys/elftypes.h?txt -o  /usr/include/elftypes.h
sudo curl http://opensource.apple.com/source/dtrace/dtrace-48/sys/elf.h?txt -o /usr/include/elf.h
#code to append to elf.h
echo "
#define R_386_NONE 0
#define R_386_32 1
#define R_386_PC32 2
#define R_ARM_NONE 0
#define R_ARM_PC24 1
#define R_ARM_ABS32 2
#define R_MIPS_NONE 0
#define R_MIPS_16 1
#define R_MIPS_32 2
#define R_MIPS_REL32 3
#define R_MIPS_26 4
#define R_MIPS_HI16 5
#define R_MIPS_LO16 6" > elf-append.h
sudo -s 'cat elf-append.h >> /usr/include/elf.h'

#Make a case sensitive 3gb disk image, raspberrypi-kernel, and attach it
hdiutil create -size 10g -type SPARSEBUNDLE -nospotlight -volname raspberrypi-kernel -fs "Case-sensitive Journaled HFS+" -attach ./raspberrypi-kernel.dmg
cp raspberrypi.config /Volumes/raspberrypi-kernel/
mkdir /Volumes/raspberrypi-kernel/src
cd /Volumes/raspberrypi-kernel/src

#get source, either 1. from zip (faster), or 2. from git
#1. from zip
curl https://codeload.github.com/raspberrypi/linux/zip/rpi-3.6.y -o ./rpi-3.6.y.zip
unzip rpi-3.6.y.zip
#2. from git (disabled)
#git init
#git fetch git://github.com/raspberrypi/linux.git rpi-3.6.y:refs/remotes/origin/rpi-3.6.y
#git checkout rpi-3.6.y

cpu=$(sysctl hw.ncpu | awk '{print $2}')
cpup1=$((cpu+1))

cd /Volumes/raspberrypi-kernel/src/linux-rpi-3.6.y/
export CCPREFIX=/opt/local/bin/arm-none-eabi-
make mrproper
git clone git://aufs.git.sourceforge.net/gitroot/aufs/aufs3-standalone.git
cd aufs3-standalone
git checkout origin/aufs3.6
cp -rp *.patch ../
cp -rp fs ../
cp -rp Documentation/ ../
cp -rp include/ ../
cd ..
zcat /proc/config.gz > .config
cp /Volumes/raspberrypi-kernel/raspberrypi.config .config
#answer yes to all config options
#yes "" | make ARCH=arm CROSS_COMPILE=${CCPREFIX} oldconfig
make ARCH=arm CROSS_COMPILE=${CCPREFIX} -j$cpup1
#make ARCH=arm CROSS_COMPILE=${CCPREFIX} modules -j$cpup1