本文参考了:
http://shumeipai.nxez.com/2014/07/08/u-boot-raspberry-pi.html
http://blog.sina.com.cn/s/blog_7cedb56d0102uzye.html
环境准备:
交叉编译操作系统: linux_x86虚拟机
arm-linux存储介质:tf卡(预先装过debian并且运行过,这时tf卡上有两个分区:boot与(另一个分区)。最后将tf卡用读卡器连电脑,挂到虚拟机的usb上)
1)获取U-Boot源代码:
下载地址: https://github.com/gonzoua/u-boot-pi/archive/rpi.tar.gz
2) 打补丁,令其支持sdhci
补丁地址: http://people.freebsd.org/~gonzo/arm/patches/u-boot-pi-sdhci-hs-workaround.diff
补丁内容:
基于patch的分析,只改了一行代码。
应用补丁:
3)执行配置
5)编译后得到u-boot.bin,放到树莓派/boot分区,修改config.txt:
6)至此u-boot就编译移植完毕了。
http://shumeipai.nxez.com/2014/07/08/u-boot-raspberry-pi.html
http://blog.sina.com.cn/s/blog_7cedb56d0102uzye.html
环境准备:
交叉编译操作系统: linux_x86虚拟机
arm-linux存储介质:tf卡(预先装过debian并且运行过,这时tf卡上有两个分区:boot与(另一个分区)。最后将tf卡用读卡器连电脑,挂到虚拟机的usb上)
1)获取U-Boot源代码:
下载地址: https://github.com/gonzoua/u-boot-pi/archive/rpi.tar.gz
2) 打补丁,令其支持sdhci
补丁地址: http://people.freebsd.org/~gonzo/arm/patches/u-boot-pi-sdhci-hs-workaround.diff
补丁内容:
diff --git a/drivers/mmc/bcm2835_sdhci.c b/drivers/mmc/bcm2835_sdhci.c
index 8f2137e..bab6084 100644
--- a/drivers/mmc/bcm2835_sdhci.c
+++ b/drivers/mmc/bcm2835_sdhci.c
@@ -166,7 +166,7 @@ int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq)
host->name = "bcm2835_sdhci";
host->ioaddr = (void *)regbase;
host->quirks = SDHCI_QUIRK_BROKEN_VOLTAGE | SDHCI_QUIRK_BROKEN_R1B |
- SDHCI_QUIRK_WAIT_SEND_CMD;
+ SDHCI_QUIRK_WAIT_SEND_CMD | SDHCI_QUIRK_NO_HISPD_BIT;
host->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
host->ops = &bcm2835_ops;
基于patch的分析,只改了一行代码。
应用补丁:
$ patch –R –p1 <u-boot-pi-sdhci-hs-workaround.diff
手动操作也可:
$ vi drivers/mmc/bcm2835_sdhci.c
$ /SDHCI_QUIRK_WAIT_SEND_CMD
$ i
3)执行配置
$ make ARCH=arm CROSS_COMPILE=/home/debian/raspberrypi/git/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi- rpi_b_config
4)执行make
$ make ARCH=arm CROSS_COMPILE=/home/debian/raspberrypi/git/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-
5)编译后得到u-boot.bin,放到树莓派/boot分区,修改config.txt:
kernel=u-boot.bin
6)至此u-boot就编译移植完毕了。