Linux内核编译

xiahou0791 2010-10-02 09:49:38
各位大侠,小弟在编译Linux内核的时候总是出现这个问题:
drivers/block/block.o: In function `ramdisk_updatepage':
drivers/block/block.o(.text+0x2840): undefined reference to `cpu_CPU_NAME_cache_
clean_invalidate_range'
drivers/block/block.o: In function `rd_blkdev_pagecache_IO':
drivers/block/block.o(.text+0x29f8): undefined reference to `cpu_CPU_NAME_cache_
clean_invalidate_range'
make: *** [vmlinux] Error 1
这是怎么回事啊?研究了半天没弄清楚,麻烦大伙儿支个招啊!谢啦!
...全文
213 点赞 收藏 16
写回复
16 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
xiahou0791 2010-10-07
[Quote=引用 14 楼 xieqi0793 的回复:]
static void xsbase270_mci_exit(struct device *device,void *data)
{
free_irq(XSBEDR_CF_DETECT_IRQ,data);
}

static struct pxamci_platform_data xsbase270_mci_platform_data= {
.ocr_mask = MMC_VDD……
[/Quote]兄弟太给力了,看在这么辛苦的份上,接分吧!
回复
xiahou0791 2010-10-07
兄弟太给力了,看在这么辛苦的份上,接分吧!
回复
xieqi0793 2010-10-07
static void xsbase270_mci_exit(struct device *device,void *data)
{
free_irq(XSBEDR_CF_DETECT_IRQ,data);
}

static struct pxamci_platform_data xsbase270_mci_platform_data= {
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.init =xsbase270_mci_init,
.detect_delay =1,
.setpower = xsbase270_mci_setpower,
.exit =xsbase270_mci_exit,
};


static struct resource smc91x_resources[] = {
[0] = {
.start = (XSBEDR_ETH_PHYS + 0x300),
.end = (XSBEDR_ETH_PHYS + 0xfffff),
.flags = IORESOURCE_MEM,
},
[1] = {
.start =IRQ_GPIO(10),// XSBDVK_ETH_IRQ,
.end = IRQ_GPIO(10),//XSBDVK_ETH_IRQ,
.flags = IORESOURCE_IRQ,
}
};
static struct smc91x_platdata xsbase270_smc91x_info = {
.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_USE_DMA,
};

static struct platform_device smc91x_device = {
.name = "smc91x",
.id = 0,
.num_resources = ARRAY_SIZE(smc91x_resources),
.resource = smc91x_resources,
.dev = {
.platform_data = &xsbase270_smc91x_info,
},

};

static int xsbase270_audio_startup(struct snd_pcm_substream *substream, void *priv)
{
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
{
xsbase270edr_bcr &= ~XSBEDR_BCR_SPKR_OFF;
xsbase270edr_bcr |=XSBEDR_BCR_AUDIO_PWR_ON;
XSBEDR_BCR=xsbase270edr_bcr;
}
return 0;
}
static void xsbase270_audio_shutdown(struct snd_pcm_substream *substream, void *priv)
{
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
xsbase270edr_bcr |= XSBEDR_BCR_SPKR_OFF;
xsbase270edr_bcr &= ~XSBEDR_BCR_AUDIO_PWR_ON;
XSBEDR_BCR=xsbase270edr_bcr;
}
static long xsbase270_audio_suspend_mask;
static void xsbase270_audio_suspend(void *priv)
{
xsbase270_audio_suspend_mask = XSBEDR_BCR;
xsbase270edr_bcr |= XSBEDR_BCR_SPKR_OFF;
xsbase270edr_bcr &= ~XSBEDR_BCR_AUDIO_PWR_ON;
XSBEDR_BCR=xsbase270edr_bcr;
}

static void xsbase270_audio_resume(void *priv)
{
xsbase270_audio_suspend_mask |= ~XSBEDR_BCR_SPKR_OFF;//~MST_MSCWR2_AC97_SPKROFF;
xsbase270_audio_suspend_mask &= XSBEDR_BCR_AUDIO_PWR_ON;//~MST_MSCWR2_AC97_SPKROFF;
XSBEDR_BCR &=xsbase270_audio_suspend_mask;
}

static pxa2xx_audio_ops_t xsbase270_audio_ops = {
.startup = xsbase270_audio_startup,
.shutdown = xsbase270_audio_shutdown,
.suspend = xsbase270_audio_suspend,
.resume = xsbase270_audio_resume,
};
static struct platform_device xsbase270_audio_device = {
.name = "pxa2xx-ac97",
.id = -1,
.dev = { .platform_data = &xsbase270_audio_ops },
};

static struct platform_device *platform_devices[] __initdata = {
&smc91x_device,
&xsbase270_audio_device,
&xsbase270_flash_device,
};


static int xsbase270_ohci_init(struct device *dev)
{
/* setup Port1 GPIO pin. */
pxa_gpio_mode( 88 | GPIO_ALT_FN_1_IN); /* USBHPWR1 */
pxa_gpio_mode( 89 | GPIO_ALT_FN_2_OUT); /* USBHPEN1 */

/* Set the Power Control Polarity Low and Power Sense
Polarity Low to active low. */
/* UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) &
~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
*/
return 0;
}

static struct pxaohci_platform_data xsbase270_ohci_platform_data = {
.port_mode = PMM_PERPORT_MODE,
.init = xsbase270_ohci_init,
.flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,

};

static void xsbase270_backlight_power(int on)
{
if (on) {
XSBEDR_LCD_PWR_ON;

} else {
XSBEDR_LCD_PWR_OFF;
}

}

static struct pxafb_mode_info lb064v02_mode __initdata = {
#ifdef CONFIG_MACH_XSBASE270Liod
.pixclock = 50000,//500000,
#else
.pixclock = 400000,
#endif
.xres = 640,
.xres = 640,
.yres = 480,
.bpp = 16,
.hsync_len = 48,
#ifdef CONFIG_MACH_XSBASE270Liod
.left_margin = 90,
.right_margin = 10,
#else
.left_margin = 56,
.right_margin = 15,
#endif
.vsync_len = 3,
.upper_margin = 33,
.lower_margin = 10,
.sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
};

static struct pxafb_mach_info xsbase270_pxafb_info = {
.num_modes = 1,
.lccr0 = LCCR0_Act,
.lccr3 = LCCR3_PCP,
.lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
.pxafb_backlight_power = xsbase270_backlight_power,
};

static void __init xsbase270_init(void)
{
/*
struct rtc_time wtime;
wtime=get_rtc4513_time();
xtime.tv_sec=mktime(wtime.tm_year,wtime.tm_mon,wtime.tm_mday,wtime.tm_hour,wtime.tm_min,wtime.tm_sec);
*/
ARB_CNTRL = ARB_CORE_PARK | 0x234;
// pxa2xx_mfp_config(ARRAY_AND_SIZE(xsbase270_pin_config));

pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD);

platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));

xsbase270_pxafb_info.modes=&lb064v02_mode;
set_pxa_fb_info(&xsbase270_pxafb_info);

pxa_set_ohci_info(&xsbase270_ohci_platform_data);

pxa_set_mci_info(&xsbase270_mci_platform_data);
}


static struct map_desc xsbase270_io_desc[] __initdata = {
{
.virtual =XSBEDR_FPGA_VIRT,
.pfn =__phys_to_pfn(XSBEDR_FPGA_PHYS),
.length =0x00100000,
.type =MT_DEVICE
}, /* CPLD */
{
.virtual =0xF7000000,
.pfn =__phys_to_pfn(0x10700000),
.length =0x00100000,
.type =MT_DEVICE
}, /*rtc*/

};

static void __init xsbase270_map_io(void)
{
pxa_map_io();
iotable_init(xsbase270_io_desc, ARRAY_SIZE(xsbase270_io_desc));

}

MACHINE_START(XSBASE270, "EELIOD (XSBASE270EDR) Development Platform")
.phys_io = 0x40000000,
.boot_params = 0xa0000100, /* BLOB boot parameter setting */
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
.map_io = xsbase270_map_io,
.init_irq = xsbase270_init_irq,
.timer = &pxa_timer,
.init_machine = xsbase270_init,

MACHINE_END

回复
xieqi0793 2010-10-07
2、在linux-2.6.28/arch/arm/mach-pxa目录下增加一个xsbase270.c文件(实际上从该目录下的mainstone.c复制而来),然后根据实际平台进行修改。


#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/sysdev.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/bitops.h>
#include <linux/fb.h>
#include <linux/ioport.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/input.h>
#include <linux/gpio_keys.h>
#include <linux/pwm_backlight.h>
#include <linux/smc91x.h>

#include <asm/types.h>
#include <asm/setup.h>
#include <asm/memory.h>
#include <asm/mach-types.h>
#include <mach/hardware.h>
#include <asm/irq.h>
#include <asm/sizes.h>

#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <asm/mach/flash.h>

#include <mach/pxa-regs.h>
#include <mach/pxa2xx-regs.h>
//#include <mach/mfp-pxa27x.h>
#include <mach/xsbase270.h>
#include <mach/audio.h>
#include <mach/pxafb.h>
#include <mach/i2c.h>
#include <mach/mmc.h>
#include <mach/irda.h>
#include <mach/ohci.h>
#include <mach/pxa27x_keypad.h>

#include <mach/hardware.h>
#include <mach/pxa2xx-gpio.h>

#include "generic.h"
#include "devices.h"
/*
static unsigned long xsbase270_pin_config[] = {
// Chip Select
//GPIO15_nCS_1,

// BTUART
GPIO42_BTUART_RXD,
GPIO43_BTUART_TXD,
// GPIO44_BTUART_CTS,
// GPIO45_BTUART_RTS,

// FFUART
GPIO34_FFUART_RXD,
GPIO39_FFUART_TXD,

// STUART
GPIO46_STUART_RXD,
GPIO47_STUART_TXD,


// LCD - 16bpp Active TFT
GPIO58_LCD_LDD_0,
GPIO59_LCD_LDD_1,
GPIO60_LCD_LDD_2,
GPIO61_LCD_LDD_3,
GPIO62_LCD_LDD_4,
GPIO63_LCD_LDD_5,
GPIO64_LCD_LDD_6,
GPIO65_LCD_LDD_7,
GPIO66_LCD_LDD_8,
GPIO67_LCD_LDD_9,
GPIO68_LCD_LDD_10,
GPIO69_LCD_LDD_11,
GPIO70_LCD_LDD_12,
GPIO71_LCD_LDD_13,
GPIO72_LCD_LDD_14,
GPIO73_LCD_LDD_15,
GPIO74_LCD_FCLK,
GPIO75_LCD_LCLK,
GPIO76_LCD_PCLK,
GPIO77_LCD_BIAS,
GPIO16_PWM0_OUT, // Backlight

// MMC
GPIO32_MMC_CLK,
GPIO112_MMC_CMD,
GPIO92_MMC_DAT_0,
GPIO109_MMC_DAT_1,
GPIO110_MMC_DAT_2,
GPIO111_MMC_DAT_3,

// USB Host Port 1
GPIO88_USBH1_PWR,
GPIO89_USBH1_PEN,

// PC Card
GPIO48_nPOE,
GPIO49_nPWE,
GPIO50_nPIOR,
GPIO51_nPIOW,
GPIO85_nPCE_1,
GPIO54_nPCE_2,
GPIO79_PSKTSEL,
GPIO55_nPREG,
GPIO56_nPWAIT,
GPIO57_nIOIS16,

// AC97
GPIO45_AC97_SYSCLK,

// Keypad
GPIO93_KP_DKIN_0,
GPIO94_KP_DKIN_1,
GPIO95_KP_DKIN_2,
GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH,
GPIO103_KP_MKOUT_0,
GPIO104_KP_MKOUT_1,
GPIO105_KP_MKOUT_2,
GPIO106_KP_MKOUT_3,
GPIO107_KP_MKOUT_4,
GPIO108_KP_MKOUT_5,
GPIO96_KP_MKOUT_6,


GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
};
*/
extern unsigned long xsbase270edr_bcr= 0x000003c0;

static struct resource flash_resources = {
.start = PXA_CS0_PHYS,
.end = PXA_CS0_PHYS + SZ_32M - 1,
.flags = IORESOURCE_MEM,
};

static struct mtd_partition xsbase270flash_partitions[] = {
{
.name = "Bootloader",
.size = 0x00040000,
.offset = 0,
.mask_flags = MTD_WRITEABLE /* force read-only */
},{
.name = "Kernel",
.size = 0x00200000,
.offset = 0x00040000,
},{
.name = "Filesystem",
.size = MTDPART_SIZ_FULL,
.offset = 0x00240000
}
};
static struct flash_platform_data xsbase270_flash_data = {
.map_name = "cfi_probe",
.parts = xsbase270flash_partitions,
.nr_parts = ARRAY_SIZE(xsbase270flash_partitions),
};

static struct platform_device xsbase270_flash_device = {

.name = "pxa2xx-flash",
.id = 0,
.dev = {
.platform_data = &xsbase270_flash_data,
},
.resource = &flash_resources,
.num_resources = 1,
};

static void __init xsbase270_init_irq(void)
{
pxa27x_init_irq();
pxa_gpio_mode(22 | GPIO_IN);
set_irq_type(XSBEDR_CF_IRQ, IRQ_TYPE_EDGE_RISING);

pxa_gpio_mode(10);// | GPIO_IN);
set_irq_type(IRQ_GPIO(10), IRQ_TYPE_EDGE_RISING);

pxa_gpio_mode(13 | GPIO_IN);
set_irq_type(XSBDVK_AC97_IRQ, IRQ_TYPE_EDGE_RISING);

pxa_gpio_mode(12 | GPIO_IN);
set_irq_type(XSBEDR_CF_DETECT_IRQ,IRQ_TYPE_EDGE_BOTH);
}

static int xsbase270_mci_init(struct device *dev, irq_handler_t xsb_detect_int, void *data)
{
unsigned long status;//,flip;
int err;

pxa_gpio_mode(GPIO32_MMCCLK_MD);
pxa_gpio_mode(GPIO112_MMCCMD_MD);
pxa_gpio_mode(GPIO92_MMCDAT0_MD);
pxa_gpio_mode(GPIO109_MMCDAT1_MD);
pxa_gpio_mode(GPIO110_MMCDAT2_MD);
pxa_gpio_mode(GPIO111_MMCDAT3_MD);

status=XSBEDR_STATUS & 0x01fff;
if(status & XSBEDR_STATUS_MMC_DETECT)
{
err = request_irq(XSBEDR_CF_DETECT_IRQ, xsb_detect_int, IRQF_DISABLED,
"MMC card detect", data);
if (err) {
printk(KERN_ERR "xsb_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
return -1;
}
}
return 0;
}

static void xsbase270_mci_setpower(struct device *dev,unsigned int vdd)
{
struct pxamci_platform_data *p_d=dev->platform_data;
if((1<<vdd)&p_d->ocr_mask){
XSBEDR_MMC_PWR_ON;
}
else {
XSBEDR_MMC_PWR_ON;
}
}

回复
xieqi0793 2010-10-07
Linux-2.6.28移植
移植Linux2.6.28到 亿道公司的EELIOD xsbase270开发板的资料,搂主看下有帮助不?

1、修改linux-2.6.28目录下的Makefile



ARCH ?= $(SUBARCH)
CROSS_COMPILE ?=

改为

ARCH ?= arm
CROSS_COMPILE ?=/opt/arm-linux-4.2.1/bin/arm-linux-

//这里的/opt/arm-linux-4.2.1/bin/arm-linux-为编译器的绝对地址


回复
rabbii 2010-10-06
既然这样,你下一个和你用的发行版内核版本一样的内核下来,然后
解压
cp /boot/config-`uname -r` ./.config
make menuconfig
在下面找load config file 点ok
make
make modules
make modules_install
make install
重启
回复
goodmoon2006 2010-10-06
好好学习,谢谢楼主分享
回复
luo6620378xu 2010-10-05
做个记号!
明天补上在Ubuntu10.4下编译2.6.32的过程!
回复
rabbii 2010-10-05
[Quote=引用 6 楼 wenxy1 的回复:]
尝试以下几种方法:
1. #make clean; make all
2. #make menuconifg 配置好内核选项,或者使用正确的.config文件。
3. 从www.kernel.org下载你想要的版本的kernel源码。
[/Quote]
或直接make mrproper,然后再从新配,现在pc的的都不用make dep吧……
回复
xiahou0791 2010-10-05
唉,以上这些方法我都试了。有哪位能给出完整的内核编译过程吗?包括所要编译内核的版本和所用编译器的版本号。
回复
Wenxy1 2010-10-04
尝试以下几种方法:
1. #make clean; make all
2. #make menuconifg 配置好内核选项,或者使用正确的.config文件。
3. 从www.kernel.org下载你想要的版本的kernel源码。
回复
jiaguang3010717 2010-10-04
make dep
回复
Cricketol 2010-10-04
某些依赖的模块没选上
回复
ww2000e 2010-10-03
配置不对?或者重新配置后没make clean?
回复
相关推荐
发帖
Linux_Kernel
创建于2007-08-27

4147

社区成员

Linux/Unix社区 内核源代码研究区
申请成为版主
帖子事件
创建了帖子
2010-10-02 09:49
社区公告
暂无公告