亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 操作系統 > 正文

RPi Kernel Compilation

2024-06-28 13:28:13
字體:
來源:轉載
供稿:網友
RPi Kernel CompilationOverview

This page explains how to rebuild the kernel image for the RPi. There are two possible routes available:

  1. Compile on the Raspberry Pi itself
  2. Cross compile on another linux system

Both of these routes are covered below, however, you are strongly recommended to follow the cross compilation route. The low PRocessing power of the RPi means that a local compile will take many hours.

Example Checklist/Roadmap

This section serves to hold a new user's hand just a bit more than some of the other more generic information below in the document. To get more information on the steps in the roadmap, search this page for additional details. It assumes you can navigate filesystems, move files across systems, and have a general understanding of compiling linux kernels, filesystems, partitions, and block devices.

This series of steps yielded a successful custom/updated hardfp kernel to a stock Raspbian installation, cross compiled from an amd64 Debian system without regression on any kernel configuration options or requiring modified boot parameters. Be aware that in the worst case, you may need to overlay a stock set of kernel/modules/firmware on the Raspberry Pi if something fails. If you do not know how to do this, then a reimage of the SD card may be necessary. Assuming this is not an issue for your configuration, continue onward:

  1. Get the latest raspberrypi kernel source (https://github.com/raspberrypi/linux)
  2. Set an environment variable KERNEL_SRC to point to the location of the source ( e.g. KERNEL_SRC=/home/me/linux/ )
  3. Get the latest raspberrypi compiler (git clonehttps://github.com/raspberrypi/tools)
  4. Set an environment variable CCPREFIX to point to the location of tools ( e.g. CCPREFIX=/home/me/tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi- )
  5. From the kernel clone location, clean the kernel source with "make mrproper"
  6. Pull the /proc/config.gz from the running Raspbian installation
  7. Prime kernel with the old config by running "ARCH=arm CROSS_COMPILE=${CCPREFIX} make oldconfig"
  8. Modify the kernel config by either modifying the .config file or using "ARCH=arm CROSS_COMPILE=${CCPREFIX} make menuconfig"
  9. Build the new kernel by using "ARCH=arm CROSS_COMPILE=${CCPREFIX} make"
  10. Set an environment variable MODULES_TEMP to point to the location of the source ( e.g. MODULES_TEMP=/home/me/modules/ )
  11. Set aside the new kernel modules by using "ARCH=arm CROSS_COMPILE=${CCPREFIX} INSTALL_MOD_PATH=${MODULES_TEMP} make modules_install"
  12. From the tools clone location, in the mkimage directory, run "./imagetool-uncompressed.py ${KERNEL_SRC}/arch/arm/boot/zImage"
  13. Move the resulting kernel.img to the Raspberry Pi's /boot/ directory
  14. Package up the modules into an archive such that at the top level, the structure looks like this:
    • ./firmware
    • ./firmware/brcm
    • ./firmware/edgeport
    • ./firmware/emi26
    • ...
    • ./modules
    • ./modules/3.6.11+
    • ./modules/3.6.11+/kernel
    • ./modules/3.6.11+/kernel/lib
    • ./modules/3.6.11+/kernel/fs
    • ...
  15. Move the modules archive to the Raspberry Pi and extract them such that the aforementioned firmware and modules directories overwrite /lib/firmware and /lib/modules
  16. Get the latest raspberrypi firmware (git://github.com/raspberrypi/firmware.git)
  17. Transfer the following files from the firmware/boot directory to the Raspberry pi /boot directory:
    • bootcode.bin
    • fixup.dat
    • start.elf
  18. Transfer the firmware/hardfp/opt directory to the Raspberry pi /opt directory
  19. Reboot the Raspberry Pi

The Raspberry Pi should now boot with the newly configured/recompiled kernel.

Get the kernel source

The kernel source should be downloaded from theRPI linux section on GitHub. Although you could just compile the vanilla kernel fromKernel.org, it will not have the necessary drivers and modules for the Broadcom SoC on the RPi. You can however apply patches from the vanilla kernel to the RPi one - be prepared for potential compiler grumbles though!

Jan '14 the current is rpi-3.10.y, you can check this and other available versions by browsingRPI linux section on GitHub

You can download the source directly using git. For the 3.10 branch:

git initgit clone --depth 1 git://github.com/raspberrypi/linux.git

and for the other Stable Code branch change the numbers in the following to suit:

git initgit fetch git://github.com/raspberrypi/linux.git rpi-3.6.y:refs/remotes/origin/rpi-3.6.ygit checkout rpi-3.6.y

Or you can download a tarball from the same website:

Get a compiler

Next, you will need to get a version of GCC in order to build the kernel.

1. On the RPiRaspbian and PiBang
apt-get updateapt-get -y dist-upgradeapt-get -y install gcc make bc
Arch Linux
pacman -Syupacman -S gcc make
OpenSuSE Linux

Detailed OpenSuSE RPI 12.3 Image 20130407 + 3.8.8 kernel hack tutorial witten ( 22042013 updated ) see:http://www.raspberrypi.org/phpBB3/viewtopic.php?f=87&t=40664&p=331953#p331953Kernel Compile takes ~22H on RPI Model B due massive module compiles , Include all ip_VS , ARPD , Fuse-zfs , Zram and more:-)

This works as well for Debian , Fedora remix and others ( just package Install command differ )

zypper install u-boot-tools sudo gcc automake autoconf bison gettext flex libncurses5 ncurses-devel
cd /usr/srcmkdir GIT; cd GIT; git init; D=`date +"%m-%d-%Y"`git fetch git://github.com/raspberrypi/linux.git rpi-3.8.y:refs/remotes/origin/rpi-3.8.ygit checkout rpi-3.8.ytar cpf rpi-3.8.y.$D.tar   rpi-3.8.ycd /usr/srctar xpf  GIT/rpi-3.8.y.$D.tarrm linuxln -s linux-rpi-3.8.y linuxcd /usr/src/linuxkversion=$(make -s kernelrelease)cp linux/.config .config_$kversioncd /usr/src/# get config-3.8.7.ipvs+krb5+arpd.tar.bz2 from the Tutorial:wget http://www.raspberrypi.org/phpBB3/download/file.php?id=3174# copy the .config to /usr/src/linux: tar xpfj config-3.8.7.ipvs+krb5+arpd.tar.bz2#make the Kernel and go sleep:-)cd linuxmake oldconfignohup make zImage dep modules &#Next day .. Install It.cd /usr/src/linuxkversion=$(make -s kernelrelease)echo $kversionmkdir -p  /boot/$kversionmake ARCH=arm INSTALL_PATH=/boot/ installcp System.map /boot/System.map-$kversioncp System.map-$kversion /boot/System.mapmake ARCH=arm modules_install INSTALL_MOD_PATH=/make ARCH=arm INSTALL_PATH=/boot/ zinstallcp .config /boot/config-$kversioncp ./Module.symvers  /boot/symvers-$kversioncp arch/arm/boot/Image /boot/kernel.img
2. Cross compiling from Linux

Please note that when cross-compiling, your compiler may not target the correct ARM processor by default. This will at best reduce performance, or worse, compile for a much newer processor resulting in illegal instructions in your code. The pre-built compiler or a custom-built compiler are recommended because of this. (For example, the latest GCC Linaro binary targets armv7-a by default, whereas the RPi requires armv6kz). It is possible to add extra compiler options to theHOSTCFLAGSline inMakefile. The correct flags are shown on thesoftware page- note that you may also need to add-marmif your compiler produces Thumb code by default.

Use the provided compiler

Download the pre-built bmc2708 compiler from theRPI tools section on GitHub.

git clone git://github.com/raspberrypi/tools.git

or you can download a tarball from the website usingthis link.

Custom-built Linaro GCC

SeeLinaro GCC Compilation.

Ubuntu
apt-get install gcc-arm-linux-gnueabi make ncurses-dev
Gentoo Linux
crossdev -S -v -t arm-unknown-linux-gnueabi

Crossdev should create a cross-toolchain using the latest stable versions of the required packages. If it fails, you can specify exact versions by removing the "-S" flag and adding the "--b", "--g", "--k" and "--l" flags. On 2012-05-06,cross -S -v -A gnueabi armworks just fine.

Arch Linux
yaourt -S arm-linux-gnueabi-gcc
Cross compiling from OSXMacports

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 fromApple Developer ConnectionInstallmacports

port install arm-none-eabi-gccport 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 copyelf.handelftypes.hto /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" erroropen 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 scriptrequires raspberrypi.config to be in the same folder that you execute from

sudo port install arm-none-eabi-gccsudo port install arm-none-eabi-binutilssudo port install libelf && sudo ln -s /opt/local/include/libelf /usr/include/libelfsudo curl http://opensource.apple.com/source/dtrace/dtrace-48/sys/elftypes.h?txt -o  /usr/include/elftypes.hsudo curl http://opensource.apple.com/source/dtrace/dtrace-48/sys/elf.h?txt -o /usr/include/elf.h#code to append to elf.hecho "#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.hsudo -s 'cat elf-append.h >> /usr/include/elf.h'#Make a case sensitive 3gb disk image, raspberrypi-kernel, and attach ithdiutil create -size 10g -type SPARSEBUNDLE -nospotlight -volname raspberrypi-kernel -fs "Case-sensitive Journaled HFS+" -attach ./raspberrypi-kernel.dmgcp raspberrypi.config /Volumes/raspberrypi-kernel/mkdir /Volumes/raspberrypi-kernel/srccd /Volumes/raspberrypi-kernel/src#get source, either 1. from zip (faster), or 2. from git#1. from zipcurl https://codeload.github.com/raspberrypi/linux/zip/rpi-3.6.y -o ./rpi-3.6.y.zipunzip 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.ycpu=$(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 mrpropercp /Volumes/raspberrypi-kernel/raspberrypi.config .config#answer yes to all config options#yes "" | make ARCH=arm CROSS_COMPILE=${CCPREFIX} oldconfigmake ARCH=arm CROSS_COMPILE=${CCPREFIX} -j$cpup1#make ARCH=arm CROSS_COMPILE=${CCPREFIX} modules -j$cpup1
Yagarto

Download and install fromhere.

Perform the compilation

Firstly, ensure your build directory is clean:

make mrproper

Next, in all cases, you will want to get a working kernel configuration to start from. You can get the one running on the RPi by typing the following (on the RPi):

zcat /proc/config.gz > .config

then copy.configinto your build directory.

Alternatively, the default configuration is available in the downloaded kernel source inarch/arm/configs/bcmrpi_defconfig. Just copy this to.configin the build directory.

From this point on, if you are cross-compiling, set an environment variableCCPREFIXthat points to the prefix of your compiler binary as each compiler will be named slightly differently.

export CCPREFIX=/path/to/your/compiler/binary/prefix-of-binary-

If you are building on the RPi, removeARCH=arm CROSS_COMPILE=${CCPREFIX}from each command.

Ensure that your configuration file is up-to-date:

make ARCH=arm CROSS_COMPILE=${CCPREFIX} oldconfig

If any configuration options have been added, you will be asked what set each option to. If you don't know the answer, just press enter to accept the default.

Optionally, if you want to make changes to the configuration, run this next:

make ARCH=arm CROSS_COMPILE=${CCPREFIX} menuconfig

Now you are ready to build:

make ARCH=arm CROSS_COMPILE=${CCPREFIX}

If you are on a multi-core system, you can make the build faster by appending-j<N>where<N>is the number of cores on your system plus one (i.e. -j3 for 2 cores).

Find something else to get on with while the compilation takes place. On an average PC with the default configuration, this should take about 15 minutes.

The modules will be build with the following command.

make ARCH=arm CROSS_COMPILE=${CCPREFIX} modules
Transfer the build

The fully built kernel will bearch/arm/boot/Image. Copy your new kernel file into the RPi boot partition, though preferably as a new file (such askernel_new.img) just in case it doesn't work. If you're building on the RPi, just copy the file to/boot. If you use a different filename, editconfig.txtchange the kernel line:

kernel=kernel_new.img#kernel=kernel.img

Now you need to transfer the modules. Set an environment variable that points to a temporary module path.

export MODULES_TEMP=~/modules

In the build directory, run the following command:

make ARCH=arm CROSS_COMPILE=${CCPREFIX} INSTALL_MOD_PATH=${MODULES_TEMP} modules_install

The contents of this directory, a single

lib

directory, should then be copied into the RPi root directory, merging or overwriting

/lib

. NOTE: If you have rebuilt the new kernel with exactly the same version as the one that's running, you'll need to remove the old modules first. Ideally this should be done offline by mounting the SD card on another system.

Your RPi should now be ready to boot the new kernel. However, at this point it's recommended that you update your GPU firmware and libraries.This is required if you've just moved from 3.2 to 3.6 as the firmware interface has changed.

Get the firmware

The firmware and boot files should be updated at the same time to ensure that your new kernel works properly. Again, two branches are available:

  • master- This is the version of firmware currently used in Raspbian (i.e. it works with the 3.2 kernel).
  • next- This is a development branch which provides a newer GPU firmware to work with the updated drivers in the 3.6 kernel.

You can either download the source directly using git: You can download the firmware directly using git. For the master branch:

git clone git://github.com/raspberrypi/firmware.git

and for the next branch:

git fetch git://github.com/raspberrypi/firmware.git next:refs/remotes/origin/next

Or you can download a tarball from the website using these links:masternext

Transfer the firmware

Firstly, update the required boot files in the RPibootdirectory with those you've downloaded. These are:

  • bootcode.bin
  • fixup.dat
  • start.elf

Next, you need to copy the VC libraries over. There are two copies of this: one for hard float and one for soft float. To find the correct one, run the following command:

${CCPREFIX}gcc -v 2>&1 | grep hard

If something prints out, and you can see--with-float=hard, you need the hard float ones. NOTE: The current version of Raspbian uses hard float.

Remove the/opt/vcdirectory from the RPi root, then:

  • For hard float, copyvcfrom thehardfp/optdirectory into/optin the RPi root directory
  • Otherwise copyvcfrom the top-leveloptdirectory into/optin the RPi root directory.
Test your build

Power cycle your RPi and check the following:

  • If you have the serial port on the GPIO expander wired up, you should see the kernel booting.
  • The screen works - the kernel boots and you get a login prompt.
  • The VC interface is working - if the 'OK' LED Flashes regularly eight or so times every few seconds once the OS has booted, it's not. You can also test this by runningvcgencmd measure_temp. If it prints "VCHI initialization failed", you have the a mismatch between the firmware, the VC libraries, and the kernel driver.
  • Rununame -aand check that your new kernel is the one that's running.
  • Make sure you don't have any odd error messages during boot that may indicate a module isn't working properly. If you seemissed completion of cmd 18regarding DMA transfers to the SD card, you can safely ignore it.

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
亚洲欧美中文字幕在线一区| 亚洲欧美视频在线| 欧美劲爆第一页| 成年无码av片在线| 91精品国产一区| 亚洲欧美一区二区三区四区| 国产欧美精品xxxx另类| 亚洲第一在线视频| 成人亚洲综合色就1024| 午夜精品蜜臀一区二区三区免费| 中文字幕欧美国内| 国产色综合天天综合网| 国产日韩欧美在线看| 午夜精品99久久免费| 伦伦影院午夜日韩欧美限制| 国产主播精品在线| 日韩中文字幕欧美| 日韩中文字幕在线视频播放| 国产综合久久久久| 欧美日韩免费观看中文| 国产成人精品午夜| 日韩在线小视频| 亚洲自拍偷拍网址| 中国日韩欧美久久久久久久久| 亚洲一区二区在线| 国产91免费观看| 午夜精品一区二区三区在线视频| 久久天天躁狠狠躁老女人| 91久久久久久国产精品| 国产精品丝袜一区二区三区| 日韩精品视频三区| 俺也去精品视频在线观看| 精品久久久久人成| 97精品久久久中文字幕免费| 91av在线免费观看| 亚洲国产精品久久精品怡红院| 国产欧美日韩视频| 日韩精品视频在线观看免费| 欧美一区二区三区免费视| 亚洲电影中文字幕| 欧美激情a∨在线视频播放| 国产精品视频区| 57pao国产成人免费| 在线日韩第一页| 国产一区二区三区中文| 亚洲一区二区黄| 日本精品久久电影| 欧洲精品在线视频| 亚洲国产精品yw在线观看| 亚洲网站在线播放| 热久久免费视频精品| 日韩av综合网| 国产欧美韩国高清| 国产91精品不卡视频| 国产成人aa精品一区在线播放| 亚洲国产另类 国产精品国产免费| 国产视频在线一区二区| 国产成人综合精品在线| 国产精品免费福利| 亚洲成人精品久久久| 亚洲精品久久久久久下一站| 久久男人资源视频| 日韩在线视频网| 国产欧美一区二区三区在线看| 欧美日韩成人网| 国产精品海角社区在线观看| 91豆花精品一区| 成人福利在线视频| 亚洲字幕一区二区| 亚洲成人黄色在线| 精品久久久久久久久中文字幕| 日韩精品免费在线播放| 热久久这里只有精品| 疯狂蹂躏欧美一区二区精品| 中文字幕日韩av| 欧美在线影院在线视频| 综合网日日天干夜夜久久| 成人亚洲欧美一区二区三区| 国产aaa精品| 青青精品视频播放| 97avcom| 中文精品99久久国产香蕉| 欧美激情欧美激情在线五月| 欧美激情一二三| 91深夜福利视频| 亚洲成人久久网| 欧美丰满片xxx777| 欧美激情在线观看| 亚洲美女久久久| 91精品在线国产| 欧美日韩国内自拍| 日韩一区二区三区在线播放| 久久韩国免费视频| 精品国产欧美一区二区三区成人| 亚洲精品视频免费在线观看| 影音先锋欧美在线资源| 欧美一级大片在线观看| 一区二区av在线| 欧美视频裸体精品| 亚洲成人网久久久| 亚洲国产成人91精品| 欧美激情一区二区三区在线视频观看| 免费97视频在线精品国自产拍| 色综合久久天天综线观看| 亚洲精品国产精品乱码不99按摩| 亚洲天堂成人在线视频| 97人人模人人爽人人喊中文字| 久久6免费高清热精品| 一个人看的www久久| 欧美电影免费观看电视剧大全| 国产亚洲成av人片在线观看桃| 亚洲综合精品伊人久久| 欧美成人精品激情在线观看| 久久激情视频免费观看| 欧美日韩国产页| 欧美精品一本久久男人的天堂| 8x拔播拔播x8国产精品| 精品中文字幕在线观看| 日韩av在线播放资源| 久久国产天堂福利天堂| 国产精品7m视频| 国产精品夜色7777狼人| 欧美成人在线免费视频| 欧美一级淫片播放口| 中文字幕av一区二区三区谷原希美| 97在线免费观看视频| 欧美巨猛xxxx猛交黑人97人| 日韩在线观看精品| 国产精品9999| 国产网站欧美日韩免费精品在线观看| 国产福利精品av综合导导航| 97精品国产97久久久久久免费| 午夜精品理论片| 大胆人体色综合| 国产精品情侣自拍| 欧美性jizz18性欧美| 2019亚洲男人天堂| 欧美第一黄色网| 久久精品国产电影| 在线性视频日韩欧美| 欧美最近摘花xxxx摘花| 国产91九色视频| 国产又爽又黄的激情精品视频| 成人午夜两性视频| 欧美日韩精品在线播放| 91精品久久久久久久久久久久久久| 91wwwcom在线观看| 欧美精品少妇videofree| 国产精品男人爽免费视频1| 国产精品v片在线观看不卡| 91国自产精品中文字幕亚洲| 欧美黑人xxxⅹ高潮交| 午夜精品视频网站| 国产亚洲精品美女久久久| 亚洲香蕉成人av网站在线观看| 久久精品欧美视频| 精品久久香蕉国产线看观看亚洲| 色婷婷av一区二区三区久久| 亚洲视频在线观看网站| 最好看的2019年中文视频| 亚洲美女视频网站| 美日韩丰满少妇在线观看| 国产成人午夜视频网址| 精品电影在线观看|