Beaglebone black 上手教程--uboot

本教程是教如何编译官方uboot到Beaglebon black 上面。

1.格式化sd卡

本人准备一张16g内存卡。

1.把sd卡插入电脑。

2.在命令行下输入以下指令

sudo fdisk /dev/sdb

注意:/请按照系统实际填入磁盘路径,本人电脑ubunut系统下插入sd卡路径为“/dev/sdb”

3.我们查看输入m,则打印help命令

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): m

Help:

  DOS (MBR)
   a   toggle a bootable flag
   b   edit nested BSD disklabel
   c   toggle the dos compatibility flag

  Generic
   d   delete a partition
   F   list free unpartitioned space
   l   list known partition types
   n   add a new partition
   p   print the partition table
   t   change a partition type
   v   verify the partition table
   i   print information about a partition

  Misc
   m   print this menu
   u   change display/entry units
   x   extra functionality (experts only)

  Script
   I   load disk layout from sfdisk script file
   O   dump disk layout to sfdisk script file

  Save & Exit
   w   write table to disk and exit
   q   quit without saving changes

  Create a new label
   g   create a new empty GPT partition table
   G   create a new empty SGI (IRIX) partition table
   o   create a new empty DOS partition table
   s   create a new empty Sun partition table

使用命令 sudo fdisk /dev/sdb 管理磁盘:

a : toggle a bootable flag(设置或取消启动表示)

b : edit bsd disklabel(编辑 bsd disklabel)

c : toggle the dos compatibility flag

d : delete a partition (删除一个分区)

l : list known partition types (列出已知的分区类型)

m : print this menu (打印次列表)

n : add a new partition (增加一个新分区)

o : create a new empty DOS partition table (建立一个新的空 DOS 分区表)

p : print the partition table (打印分区表)

q : quit without saving changes (不保存退出)

s : create a new empty Sun disklabel

t : change a partition’s system id

u : change display/entry units

v : verify the partition table (验证分区表)

w : write table to disk and exit (把分区表写入磁盘)

x : extra functionality (experts only) (额外的功能)

4.我们格式化sd卡,然后打印磁盘信息

Command (m for help): d

Selected partition 1
Partition 1 has been deleted.

Command (m for help): w
The partition table has been altered.
Failed to remove partition 1 from system: Device or resource busy

The kernel still uses the old partitions. The new table will be used at the next reboot. 
Syncing disks.

yates@yates-virtual-machine:~/beagleboard/linux$ sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d       
No partition is defined yet!

Command (m for help): p

Disk /dev/sdb: 14.86 GiB, 15931539456 bytes, 31116288 sectors
Disk model: Mass-Storage    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3244345d

Command (m for help): 

5.创建一个新的磁盘p,并且把格式定义为“FAT32”

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-31116287, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-31116287, default 31116287): 

Created a new partition 1 of type 'Linux' and of size 14.9 GiB.

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): c
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.

Command (m for help): p
Disk /dev/sdb: 14.86 GiB, 15931539456 bytes, 31116288 sectors
Disk model: Mass-Storage    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3244345d

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdb1  *     2048 31116287 31114240 14.9G  c W95 FAT32 (LBA)

Command (m for help): w
The partition table has been altered.
Syncing disks.

yates@yates-virtual-machine:~/beagleboard/linu

二.下载源码.

1.下载源码地址是 https://github.com/beagleboard/u-boot

2.下载源码后切换分支 origin/v2021.01-bb.org-am335x-am57xx

3.执行以下命令编译

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_evm_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 

4.编译成功后,把u-boot.img MLO复制到sd卡上,并且创建一个uEnv.txt文件,输入以下参数

console=ttyO0,115200n8
ipaddr=192.168.23.2
serverip=192.168.23.1
rootpath=/exports/rootfs
netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=${ipaddr}:${serverip}:192.168.23.1:255.255.255.0:beaglebone:eth0:none:192.168.23.1
netboot=echo Booting from network ...; tftp ${loadaddr} ${bootfile}; tftp ${fdtaddr} ${fdtfile}; run netargs; bootz ${loadaddr} - ${fdtaddr}
uenvcmd=run netboot

三.设备上电

用串口工具连接板子串口

 

 

  • J1 = GND (Ground)
  • J4 = RXD (Receive Data)
  • J5 = TXD (Transmit Data)

把板子上电,可以显示以下信息,说明uboot运行成功


U-Boot SPL 2021.04-dirty (Jul 21 2021 - 16:04:09 +0800)
Trying to boot from MMC1


U-Boot 2021.04-dirty (Jul 21 2021 - 16:04:09 +0800)

CPU  : AM335X-GP rev 2.1
Model: TI AM335x BeagleBone Black
DRAM:  512 MiB
WDT:   Started with servicing (60s timeout)
NAND:  0 MiB
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from FAT... OK
Net:   eth2: ethernet@4a100000, eth3: usb_ether
Hit any key to stop autoboot:  0
=>
=>

参考教程

https://blog.csdn.net/zy812248258/article/details/39252733?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522162686122716780265462057%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=162686122716780265462057&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-39252733.first_rank_v2_pc_rank_v29&utm_term=Beaglebone+black+uboot&spm=1018.2226.3001.4187

https://blog.csdn.net/p942005405/article/details/83376554?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522162686122716780265419661%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=162686122716780265419661&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_v2~rank_v29-12-83376554.first_rank_v2_pc_rank_v29&utm_term=Beaglebone+black+uboot&spm=1018.2226.3001.4187

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值