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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ggxyx123/article/details/84982558

参考: 

 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


六、调试

烧写文件系统:

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

猜你喜欢

转载自blog.csdn.net/ggxyx123/article/details/84982558