移植最新内核4.19.8到JZ2440——编译内核

参考: 

 http://www.mr-wu.cn/u-boot-tools-binary-package-in-ubuntu/

 https://blog.csdn.net/u014032613/article/details/79428190/

 https://blog.csdn.net/mybelief321/article/details/10007719

 

一、准备编译环境和工具 

系统:ubuntu16.04

内核:https://www.kernel.org/ 下载最新内核 linux-4.19.8

交叉编译工具:sudo apt-get install gcc-arm-linux-gnueabi

二、初次编译

修改Makefile ,设置CPU架构和交叉编译工具链


 324 ARCH          ?= arm
 325 CROSS_COMPILE ?= arm-linux-gnueabi-

 make s3c2410_defconfig

make menuconfig 设置EABI

make  uImgae

出现以下错误

"mkimage" command not found - U-Boot images will not be built
arch/arm/boot/Makefile:90: recipe for target 'arch/arm/boot/uImage' failed
make[1]: *** [arch/arm/boot/uImage] Error 1
arch/arm/Makefile:336: recipe for target 'uImage' failed
make: *** [uImage] Error 2

 按照经验 sudo apt-get install uboot-mkimage

提示错误

Package uboot-mkimage is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  u-boot-tools:i386 u-boot-tools

安装 :sudo apt-get install u-boot-tools 

成功编译uImage

三、修改内核

1、

arch\arm\mach-s3c24xx\mach-smdk2440.c
s3c24xx_init_clocks(16934400);
改为
s3c24xx_init_clocks(12000000);

static void __init smdk2440_init_time(void)
{
	//s3c2440_init_clocks(16934400);
	s3c2440_init_clocks(12000000);
	samsung_timer_init();
}

2、 修改内核分区

static struct mtd_partition smdk_default_nand_part[] = {
		[0] = {
                .name   = "bootloader",
                .size   = SZ_256K,
                .offset = 0,
        },
        [1] = {
                .name   = "params",
                .offset = MTDPART_OFS_APPEND,
                .size   = SZ_128K,
        },
        [2] = {
                .name   = "kernel",
                .offset = MTDPART_OFS_APPEND,
                .size   = SZ_4M,
        },
        [3] = {
                .name   = "rootfs",
                .offset =  MTDPART_OFS_APPEND,
                .size   = MTDPART_SIZ_FULL,
        }
};

3、编译 

  mv  arch/arm/configs/s3c2410_defconfig arch/arm/configs/s3c2440_defconfig

  make s3c2440_defconfig

  make uImage

4、dm9000网卡支持

在arch/arm/mach-s3c24xx/mach-smdk2440.c 中没有网卡的板级支持,我们可以仿照mini2440书写smdk2440的网卡支持。

/* DM9000AEP 10/100 ethernet controller */

static struct resource mini2440_dm9k_resource[] = {
        [0] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE, 4),
        [1] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE + 4, 4),
        [2] = DEFINE_RES_NAMED(IRQ_EINT7, 1, NULL, IORESOURCE_IRQ \
                                                | IORESOURCE_IRQ_HIGHEDGE),
};

/*
 * The DM9000 has no eeprom, and it's MAC address is set by
 * the bootloader before starting the kernel.
 */
static struct dm9000_plat_data mini2440_dm9k_pdata = {
        .flags          = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
};

static struct platform_device mini2440_device_eth = {
        .name           = "dm9000",
        .id             = -1,
        .num_resources  = ARRAY_SIZE(mini2440_dm9k_resource),
        .resource       = mini2440_dm9k_resource,
        .dev            = {
                .platform_data  = &mini2440_dm9k_pdata,
        },
};

将dm9000的板级文件,拷贝到smdk2440中,重新编译,下载内核即可。


六、调试

烧写文件系统:

nfs 30000000 192.168.1.120:/home/flnet/kernel/new_file/static_yaffs.yaffs2;nand erase.part rootfs;nand write.yaffs 30000000 460000  $filesize

设置uboot参数:

set bootargs console=ttySAC0,115200 root=/dev/mtdblock3 rootfstype=yaffs2 user_debug=1

启动内核:

nfs 30000000 192.168.1.120:/home/flnet/kernel/new_file/uImage;bootm 30000000

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值