arm-从0开始刷机(linux下)

环境

开发板:九鼎s5pv210_3s

部分资料来源于九鼎科技官方与朱有鹏老师课件资料

1.操作系统:deepin 5.3.15

2.代码编辑器:Visual Studio Code

3.交叉编译工具链安装

版本:arm-2009q3.tar.bz2
方法:

sudo tar -jxvf 文件名 
#即可解压到当前文件夹

复制到:/usr/local/arm
工具链的使用目录为:/usr/local/arm/arm-2009q3/bin
在上述目录创建链接脚本

ln arm-none-linux-gnueabi-addr2line -s arm-linux-addr2line
ln arm-none-linux-gnueabi-ar -s arm-linux-ar
ln arm-none-linux-gnueabi-as -s arm-linux-as
ln arm-none-linux-gnueabi-c++ -s arm-linux-c++
ln arm-none-linux-gnueabi-c++filt -s arm-linux-c++filt
ln arm-none-linux-gnueabi-cpp -s arm-linux-cpp
ln arm-none-linux-gnueabi-g++ -s arm-linux-g++
ln arm-none-linux-gnueabi-gcc -s arm-linux-gcc
ln arm-none-linux-gnueabi-gcc-4.4.1 -s arm-linux-gcc-4.4.1
ln arm-none-linux-gnueabi-gcov -s arm-linux-gcov
ln arm-none-linux-gnueabi-gdb -s arm-linux-gdb
ln arm-none-linux-gnueabi-gdbtui -s arm-linux-gdbtui
ln arm-none-linux-gnueabi-gprof -s arm-linux-gprof
ln arm-none-linux-gnueabi-ld -s arm-linux-ld
ln arm-none-linux-gnueabi-nm -s arm-linux-nm
ln arm-none-linux-gnueabi-objcopy -s arm-linux-objcopy
ln arm-none-linux-gnueabi-objdump -s arm-linux-objdump
ln arm-none-linux-gnueabi-ranlib -s arm-linux-ranlib
ln arm-none-linux-gnueabi-readelf -s arm-linux-readelf
ln arm-none-linux-gnueabi-size -s arm-linux-size
ln arm-none-linux-gnueabi-sprite -s arm-linux-sprite
ln arm-none-linux-gnueabi-strings -s arm-linux-strings
ln arm-none-linux-gnueabi-strip -s arm-linux-strip

执行脚本,注意权限(此时就创建好了符号链接)
添加环境变量:

#在当前终端下导出,关闭终端无效
export PATH=/usr/local/arm/arm-2009q3/bin:$PATH
#~/.bashrc中,添加,仅当前用户有效
export PATH=/usr/local/arm/arm-2009q3/bin:$PATH
#所有用户永久添加环境变量:
  编辑/etc/profile文件 vim /etc/profile    <<---- 通过这种方式,在关闭shell后,添加的环境变量不生效
  文件末尾添加:
  export PATH="/目录/:$PATH"
 shell执行 `source  /etc/profile`没有错误则添加成功

交叉编译工具链安装完成

4.安装minicom

minicom是用来做串口通信的

#可以先搜索一下
#sudo apt search xxx软件
sudo apt install xxx软件

安装好了进行配置:

sudo minicom -s

配置传口(看具体情况)/dev/ttyUSB0
注意要关闭流控,否则电脑按键无反应
需要安装CH340驱动—》》 OK传送门

sudo apt-get install linux-headers-$(uname -r)

编译、烧写UBOOT

UBOOT文件详解与配置—》》传送门
UBOOT移植------------------》》传送门

编译uboot

uboot来源:开发板资料t_x210v3s_160307.tar里的uboot文件
配置生成

make x210_sd_config
#得到Configuring for x210_sd board...表示配置成功

编译:直接make
生成了文件:
uboot
uboot.bin

擦除开发板iNand中的uboot的方法(使用串口,如果需要)
	在linux和android系统下,擦除uboot的方法:
	busybox dd if=/dev/zero of=/dev/block/mmcblk0 bs=512 seek=1 count=1 conv=sync
	sync
	在uboot底下如何擦除uboot:movi write u-boot [一个没用的内存地址,如0x30000000]

linux下sd卡下载uboot

(linux下也可以DNW刷机使用usb下载)
首先插上sd卡,确认路径
ls /dev/
查看多了哪个设备
我这里是mmcblk0和mmcblk0p1
运行烧写脚本如nand_fusing.sh

sudo ./nand_fusing.sh /dev/mmcblk0
#nand_fusing.sh
# Copyright (C) 2010 Samsung Electronics Co., Ltd.
#              http://www.samsung.com/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
####################################
reader_type1="/dev/sdb"
reader_type2="/dev/mmcblk0"

if [ -z $1 ]
then
    echo "usage: ./nand_fusing.sh "
    exit 0
fi

if [ $1 = $reader_type1 ]
then 
    partition1="$11"
    partition2="$12"
    partition3="$13"
    partition4="$14"

elif [ $1 = $reader_type2 ]
then 
    partition1="$1p1"
    partition2="$1p2"
    partition3="$1p3"
    partition4="$1p4"

else
    echo "Unsupported SD reader"
    exit 0
fi

if [ -b $1 ]SD Reader's device file
then
    echo "$1 reader is identified."
else
    echo "$1 is NOT identified."
    exit 0
fi

####################################
# make partition
echo "make sd card partition"
echo "./sd_fdisk $1" 
./sd_fdisk $1 
dd iflag=dsync oflag=dsync if=sd_mbr.dat of=$1 
rm sd_mbr.dat
 
####################################
# format
umount $partition1 2> /dev/null
umount $partition2 2> /dev/null
umount $partition3 2> /dev/null
umount $partition4 2> /dev/null

echo "mkfs.vfat -F 32 $partition1"
mkfs.vfat -F 32 $partition1

#echo "mkfs.ext2 $partition2"
#mkfs.ext2 $partition2  

#echo "mkfs.ext2 $partition3"
#mkfs.ext2 $partition3  

#echo "mkfs.ext2 $partition4"
#mkfs.ext2 $partition4  

####################################
# mount 
#umount /media/sd 2> /dev/null
#mkdir -p /media/sd
#echo "mount -t vfat $partition1 /media/sd"
#mount -t vfat $partition1 /media/sd

####################################
#
bl1_position=1
uboot_position=49

echo "BL1 fusing"
./mkbl1 ./uboot.bin SD-bl1-8k.bin 8192
dd iflag=dsync oflag=dsync if=SD-bl1-8k.bin of=$1 seek=$bl1_position
rm SD-bl1-8k.bin

####################################
#
echo "u-boot fusing"
dd iflag=dsync oflag=dsync if=./uboot.bin of=$1 seek=$uboot_position

####################################
#
echo "U-boot image is fused successfully."
echo "Eject SD card and insert it again."

以上应有具体分析----》》占位
最关键的烧写脚本

#!/bin/sh
sudo dd iflag=dsync oflag=dsync if=烧写镜像名 of=/dev/sdb seek=1

uboot启动后一定要先执行一次fdisk -c 0 进行分区
uboot中要设置bootcmd和bootargs给内核传参
set bootcmd ‘movi read kernel 30008000;bootm 30008000’
set bootargs console=ttySAC2,115200 root=/dev/mmcblk0p2 rw init=/linuxrc rootfstype=ext3
save进行保存

刷机

uboot设置完成并正常启动后,可以用fastboot进行刷机

#linux先安裝 android-libadb
sudo apt install android-libadb
#进行安装fastboot
sudo apt install fastboot

连接好usb(win下要安装驱动)
uboot下输入fastboot命令

#查看连接的设备
fastboot devices
#SMDKC110-01	fastboot
#烧录命令
fastboot flash xxx
#重启设备
fastboot reboot

烧写以下文件

#烧写uboot,分区可在uboot下看到
fastboot flash bootloader 烧写镜像pathname
#烧写内核
fastboot flash kernel 烧写镜像pathname
#烧写系统
fastboot flash system 烧写镜像pathname

执行fastboot reboot重启

你可能感兴趣的:(arm-uboot-drive)