Cygwin编译ARM Linux内核

在d:\cygwin\cygwin.bat中加入set CYGWIN=title ntea

cd /bin
mv sh.exe sh-original.exe
ln –s bash.exe sh.exe

~~升级内核补丁

- You can also upgrade between 2.6.xx releases by patching. Patches are
   distributed in the traditional gzip and the newer bzip2 format. To
   install by patching, get all the newer patch files, enter the
   top level directory of the kernel source (linux-2.6.xx) and execute:

gzip -cd ../patch-2.6.xx.gz | patch -p1

or
   bzip2 -dc ../patch-2.6.xx.bz2 | patch -p1

~~Make Menuconfig Issue

~~~scripts/basic/fixdep ERROR

$ make menuconfig
HOSTCC scripts/basic/fixdep
scripts/basic/fixdep.c: In function `parse_config_file':
scripts/basic/fixdep.c:244: warning: array subscript has type `char'
scripts/basic/fixdep.c: In function `parse_dep_file':
scripts/basic/fixdep.c:325: warning: array subscript has type `char'
scripts/basic/fixdep: scripts/basic/fixdep: cannot execute binary file
make[1]: *** [scripts/basic/fixdep] Error 126
make: *** [scripts_basic] Error 2

由于生成了fixdep和fixdep.exe,删除scripts/basic/fixdep,让调用fixdep.exe,以及

scripts/basic/docproc,scripts/Kconfig/mconf


--修改顶层目录下Makefile文件,

SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
      -e s/arm.*/arm/ -e s/sa110/arm/ \
      -e s/s390x/s390/ -e s/parisc64/parisc/ \
      -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
      -e s/sh[234].*/sh/ )
SUBARCH := arm

...

CROSS_COMPILE ?= /usr/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-eabi-

~~~make menuconfig找不到头文件

scripts/kconfig/lxdialog/dialog.h:32:20: curses.h: No such file or directory

在编译内核用make menuconfig时出现:curses.h:No such file or directory
  安装glibc-devel、Utils/ncurses、Devel/libncurses-devel这3个包

默认Cygwin没有glibc安装文件,暂时不装。

~~现在,应该可以进入Menuconfig界面了,只能通过键盘方向键控制选择,连击ESC两次,返回上级菜单直至退出。

配置System Type等

~~make uImage,生成内核镜像

删除,scripts/Kconfig/conf

~~~

include/linux/sched.h:47: fatal error: asm/param.h: No such file or directory

symlink文件include/asm存在,但是不起作用。

~~~

直接在modepost.c里加上:
//copy from kernel.git\include\asm-x86\elf.h
#define R_386_32 1
#define R_386_PC32 2
//copy from kernel.git\include\asm-arm\elf.h
#define R_ARM_PC24 1
#define R_ARM_ABS32 2
//copy from kernel.git\include\asm-mips\elf.h
#define R_MIPS_32 2
#define R_MIPS_26 4
#define R_MIPS_HI16 5
#define R_MIPS_LO16 6

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwpjjx.html