admin管理员组

文章数量:1794759

Uboot + Kernel

Uboot

交叉编译器的安装

安装包 --> /home/tarena/workdir/arm-linux-gcc

解压

代码语言:javascript代码运行次数:0运行复制
$ tar xvf arm-cortex_a9-eabi-4.7-eglibc-2.18.tar.gz

解压得到 文件夹 arm-cortex_a9-eabi-4.7-eglibc-2.18

代码语言:javascript代码运行次数:0运行复制
$ mv arm-cortex_a9-eabi-4.7-eglibc-2.18 arm-linux-gcc

设置环境变量

将bin目录添加到.bashrc文件中PATH环境变量中

代码语言:javascript代码运行次数:0运行复制
$ vim ~/.bashrc

在PATH后面添加/home/tarena/workdir/arm-linux-gcc/arm-linux-gcc/bin:保存退出

代码语言:javascript代码运行次数:0运行复制
$ source ~/.bashrc

编译uboot源码

代码语言:javascript代码运行次数:0运行复制
$ cd /home/tarena/workdir/uboot

解压 Uboot 源码

代码语言:javascript代码运行次数:0运行复制
$ tar xvf uboot.tar.bz2
代码语言:javascript代码运行次数:0运行复制
$ cd uboot

将uboot项目源码配置成当前开发版使用

代码语言:javascript代码运行次数:0运行复制
$ make x6818_config
代码语言:javascript代码运行次数:0运行复制
$ make

将编译得到 ubootpak.bin,复制到 win 使用烧录软件将 ubootpak.bin 烧录到tf 将tf插入开发版

修改提示符

代码语言:javascript代码运行次数:0运行复制
$ vi include/configs/x6818.h +142
"tarena#" --> "Jasonakeke$"

保存 编译 测试

Kernel

获取 Linux 内核源码

Linux 内核官网:www.linux

解压内核源码

代码语言:javascript代码运行次数:0运行复制
$ cd /home/tarena/workdir/kernel
$ tar xvf kernel.tar.bz2
$ cd kernel

将内核源码配置成 x6818 开发版

代码语言:javascript代码运行次数:0运行复制
$ make x6818_defconfig

或者复制该配置文件到内核源码根目录

代码语言:javascript代码运行次数:0运行复制
$ cp arch/config/x6818_defconfig ./.config

(可选)配置内核模块

代码语言:javascript代码运行次数:0运行复制
$ make menuconfig

编译 Linux 内核

代码语言:javascript代码运行次数:0运行复制
$ make

编译得到的内核镜像 Imagearch/arm/boot/ 目录下

uboot 引导内核 使用的是 uImage 通过 mkimage 命令将 Image 制作成 uImage uboot 编译过程 顺带编译得到了 mkimage /home/tarena/workdir/uboot/uboot/tools/mkimagemkimage 命令拷贝到 /bin

代码语言:javascript代码运行次数:0运行复制
$ sudo cp /home/tarena/workdir/uboot/uboot/tools/mkimage /bin

在内核根目录下运行下面的命令 即可将 Iamge 制作成 uImage

代码语言:javascript代码运行次数:0运行复制
$ make uImage

将编译好的uImage拷贝到/tftpboot目录下

代码语言:javascript代码运行次数:0运行复制
$ cp arch/arm/boot/uImage /tftpboot

配置好网络,准备通过网络下载内核到开发版的内存 在串口工具(secureCRT)的 uboot 命令行下执行命令

代码语言:javascript代码运行次数:0运行复制
$ tftp 48000000 uImage

将下载到48000000,Linux内核启动起来

代码语言:javascript代码运行次数:0运行复制
$ bootm 48000000
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。 原始发表:2024-10-28,如有侵权请联系 cloudcommunity@tencent 删除源码kernel编译开发内核

本文标签: UbootKernel