在uboot裡面新增環境變數使用run來執行
Author:楊正 Date:2014.11.11 Email:[email protected] QQ:1209758756
在移植uboot的時候,可以在uboot裡面新增定義一些自己的環境變數,這些環境變數可以大大提高以後的工作效率,比如我在uboot裡面新增如下環境變數:
bbl=sf probe 0;mw.b 82000000 ff 80000;loady0x82000000 uboot_logo.bin;sf erase 0 80000;sf write 82000000 0 80000
然後使用run命令來執行:
hisilicon # run bbl
16384 KiB hi_sfc at 0:0 is now currentdevice
## Ready for binary (ymodem) download to0x82000000 at 115200 bps...
CCC
Starting ymodem transfer. Press Ctrl+C to cancel.
100% 222 KB 6 KB/s 00:00:36 1 Errors
## Total Size = 0x000379ec = 227820 Bytes
Erasing at 0x80000 -- 100% complete.
Writing at 0x80000 -- 100% complete.
那麼這樣就不用每次都輸入很長的一串字串,如:
hisilicon # sf probe 0;mw.b 82000000 ff80000;loady 0x82000000 uboot_logo.bin;sf erase 0 80000;sf write 82000000 080000
那麼方法如下:
一、 在uboot裡面新增環境變數
1、 在u-boot-2010.06/include/configs目錄下的xxx.h(xxx是board,如hi3520d.h)裡面定義環境變數:
/* Burn bootloader, linux kernel and rootfscommand */
#define CONFIG_BURNBL "sf probe 0;mw.b 82000000 ff80000;loady 0x82000000 uboot_logo.bin;sf erase 0 80000;sf write 82000000 0 8
0000"
#define CONFIG_BURNKERNEL"sf probe 0;mw.b 82000000 ff 480000;loady 82000000 root_cramfs.img;sferase 80000 0x480000;sf write 8200000
0 80000 480000"
#define CONFIG_BURN_APP"sf probe 0;mw.b 82000000 ff 0xa00000;loady 82000000 app_jffs2.img;sferase 500000 0xa00000;sf write 82000000
500000 0xa00000"
#define CONFIG_BURN_FLASH"sf probe 0;mw.b 82000000 ff 1000000;loady 0x82000000ZMD-PROGRAMMING-FLASH.binl;sf erase 0 1000000;sf writ
e 82000000 0 1000000"
2、 然後在u-boot-2010.06/common目錄下的evn_common.c裡面新增如下程式碼:
#ifdef CONFIG_BURNBL /* Burn bootloader image to SPIflash*/
"bbl=" CONFIG_BURNBL "\0"
#endif
#ifdef CONFIG_BURNKERNEL /* Burn kernel image to SPIflash*/
"blx="CONFIG_BURNKERNEL "\0"
#endif
#ifdef CONFIG_BURN_APP /* Burn APP image to SPIflash*/
"bapp= "CONFIG_BURN_APP "\0"
#endif
#ifdef CONFIG_BURN_FLASH /* Burn Flash APP image to SPIflash*/
"bfl="CONFIG_BURN_FLASH "\0"
#endif
3、 重新編譯uboot,並燒錄到單板,用printenv或pri可以看到已定義的環境變數:
hisilicon # pr
bootargs=mem=96M console=ttyAMA0,115200root=1f01 rootfstype=cramfsmtdparts=hi_sfc:512K(boot),4M(romfs),10M(app),1536K(config)
bootcmd=sf probe 0;sf read 86000000 500000x1B6B2;decjpg;setvobg 0 0x00;stopvo0;startvo 0 4 15;startvo 0 32 15;startgx 0 0x86000000 2560 0 0 1280 1024;sfread 0x84000000 0x80000 0x400000;cramfsload;bootm 0x82000000
bootdelay=1
baudrate=115200
ethaddr=00:00:23:34:45:66
ipaddr=192.168.28.110
jpeg_addr=0x86000000
jpeg_size=0x1b6b2
vobuf=0x86000000
cramfsaddr=0x84000000
cramfsldaddr=0x82000000
serverip=192.168.28.100
netmask=255.255.255.0
bootfile=/boot/hikernel
bbl=sf probe 0;mw.b82000000 ff 80000;loady 0x82000000 uboot_logo.bin;sf erase 0 80000;sf write82000000 0 80000
blx=sf probe 0;mw.b82000000 ff 480000;loady 82000000 root_cramfs.img;sf erase 80000 0x480000;sfwrite 82000000 80000 480000
bapp= sf probe 0;mw.b82000000 ff 0xa00000;loady 82000000 app_jffs2.img;sf erase 500000 0xa00000;sfwrite 82000000 500000 0xa00000
bfl=sf probe 0;mw.b82000000 ff 1000000;loady 0x82000000 ZMD-PROGRAMMING-FLASH.binl;sf erase 01000000;sf write 82000000 0 1000000
stdin=serial
stdout=serial
stderr=serial
verify=n
ver=U-Boot 2010.06 (Nov 11 2014 - 21:27:51)
filesize=379EC
Environment size: 1202/65532 bytes
二、 在uboot裡面新增run命令
1、 在u-boot-2010.06/common目錄下新增一個檔案cmd_run.c,程式碼如下:
/*********************************************************************************
* Copyright: (C) 2014 YangZheng<[email protected]>
* All rights reserved.
*
* Filename: cmd_run.c
* Description: This file
*
* Version: 1.0.0(11/11/2014~)
* Author: Yang Zheng<[email protected]>
* ChangeLog: 1, Release initialversion on "11/11/2014 09:05:08 PM"
*
********************************************************************************/
#include <common.h>
#include <watchdog.h>
#include <command.h>
#include <image.h>
#include <malloc.h>
#include <u-boot/zlib.h>
#include <bzlib.h>
#include <environment.h>
#include <lmb.h>
#include <linux/ctype.h>
#include <asm/byteorder.h>
int do_run(cmd_tbl_t *cmdtp, int flag, int argc, char **argv)
{
if (argc < 2)
{
cmd_usage(cmdtp);
return 1;
}
if (run_command (getenv (argv[1]), flag)< 0)
{
return -1;
}
return 0;
}
U_BOOT_CMD(
boot, 1, 1, do_run
"boot default, i.e., run 'bootcmd'",
""
);
2、 然後在u-boot-2010.06/include/configs目錄的xxx.h(xxx是board,如hi3520d.h)裡面新增如下巨集定義:
#define CONFIG_CMD_RUN
3、在u-boot-2010.06/common目錄的Makefile中新增如下程式碼:
COBJS-$(CONFIG_CMD_RUN) += cmd_run.o
4、 重新編譯uboot,並燒錄到單板
三、 執行
hisilicon # run bbl
16384 KiB hi_sfc at 0:0 is now current device
## Ready for binary (ymodem) download to0x82000000 at 115200 bps...
C
相關推薦
在uboot裡面新增環境變數使用run來執行
Author:楊正 Date:2014.11.11 Email:[email protected] QQ:1209758756 在移植uboot的時候,可以在uboot裡面新增定義一些自己的環境變數,這些環境變數可以大大提高以後的工作效
CentOS 7下使用chkconfig新增的服務無法使用/etc/profile裡面的環境變數
經過分析/etc/profile為入口的,基本是登入後執行的變數,而使用chkconfig新增的服務多變以守護經常執行,沒有登入。 CentOS 7下使用chkconfig新增的服務無法使用/etc/profile裡面的環境變數,通過env輸出只有: TERM=xterm SYSTEMCTL_SK
讀《利用環境變數LD_PRELOAD來繞過php disable_function執行系統命令》有感
今天看來一篇文章:http://cb.drops.wiki/wooyun/drops/tips-16054.html 復現了一下,感覺有點坑 我把復現的過程,結果和遇到問題在這裡總結一下 我的實驗環境是centos7 php 5.4 首先按照要求編譯一個so 1.建立一個
CentOS7 /etc/profile 新增環境變數重啟後不生效 必須得執行source /etc/profile 解決方法
將環境變數寫入/etc/bashrc檔案中 參考 http://www.oschina.net/question/942236_162558%3Fsort%3Dtime http://19055.blog.51cto.com/9055/1144600
【資料分享】使用迅為iTOP-iMX6開發板-uboot-修改預設環境變數
iTOP-iMX6 開發板燒寫好之後,預設是 android 系統 9.7 寸螢幕的系統引數和螢幕參 數。如下圖。本文件主要介紹如何修改預設啟動引數。 1、 重要的環境變數 比較重要的環境變數或者說經常使用的環境變數,已經在上圖中的紅色方
148_Linux新增環境變數相關的知識
1、檢視環境變數: echo $PATH 2、~和/ ~表示個人目錄 /表示根目錄 從跟使用者切換到普通使用者 (lu是普通使用者的名字)su -l lu 檢視指令是怎麼用的: man shutdown  
(轉)Linux 中/etc/profile、~/.bash_profile 環境變數配置及執行過程
環境變數是和Shell緊密相關的,使用者登入系統後就啟動了一個Shell。對於Linux來說一般是bash,但也可以重新設定或切換到其它的 Shell。對於UNIX,可能是CShelll。環境變數是通過Shell命令來設定的,設定好的環境變數又可以被所有當前使用者所執行的程式所使用。對於bash這個Shell
Windows 如何在cmd命令列中檢視 修改 刪除與新增環境變數
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
使用setx 命令新增環境變數(Windows)
背景 用GUI的方法可能新增環境變數可能會比較麻煩,為此可採用命令列操作的方式。 步驟 以管理員身份執行 cmd 輸入 setx \M "path" "%path%[new_path];"。其中\M開關表示新增系統變數,由於%path%` 本身是系統變數和使用者變數拼起來的,不能用此方法新增使用者
如何在cmd命令列中檢視、修改、刪除與新增環境變數
1、檢視當前所有可用的環境變數:輸入 set 即可檢視。 2、檢視某個環境變數:輸入 “set 變數名”即可,比如想檢視path變數的值,即輸入 set path 3、修改環境變數 :輸入 “set 變數名=變數內容”即可,比如將path設定為“d:\nmake.exe”,只要輸入set
linux下檢視系統屬性 Linux下檢視和新增環境變數
Linux下檢視和新增環境變數 #檢視tomcat安裝路徑 sudo find / -name *tomcat* $PATH:決定了shell將到哪些目錄中尋找命令或程式,PATH的值是一系列目錄,當您執行一個程式時,Linux在這些目錄下進行搜尋編譯連結。 編輯你的 PATH 宣告
Centos Linux新增環境變數到PATH的方法
在 Linux CentOS 系統上安裝完 Hadoop 後,為了使用方便,需要將 Hadoop 命令加到系統命令中,如果在沒有新增到環境變數之前,執行“hadoop fs”命令時,則會提示命令不存在的錯誤,如下所示: [[email protected] logs]# h
Mac/linux新增環境變數
新增環境變數 和windows系統一樣,存在系統環境變數和使用者環境變數 Mac系統的環境變數,載入順序為: /etc/profile /etc/paths ~/.bash_profile ~/.bash_login ~/.profile ~/.bashrc 當然/etc/profi
ubuntu 新增環境變數
Ubuntu Linux系統環境變數配置檔案: /etc/profile : 在登入時,作業系統定製使用者環境時使用的第一個檔案 ,此檔案為系統的每個使用者設定環境資訊,當用戶第一次登入時,該檔案被執行。 /etc /environment : 在登入時作業系統使用的第二個檔案, 系統在讀取你自己的
mac中新增環境變數無效(因為安裝了zsh)
突然換成了mac工作,所以遇到了很多的問題,這一週來各種問題,尤其是環境變數的問題,讓我非常的頭疼,最終還是讓我找到了這個最正確的答案! 以下前半部說的是 使用bash作為預設shell,後半部分是 安裝了zsh導致環境變數無效的問題及解決辦法! mac 一般使用
Linux系統新增環境變數(CentOS6.5 新增php環境變數)
以新增php環境變數為例子,來說明Linux系統下如何新增環境變數。 php安裝目錄為:/usr/local/php56/bin 方法一: 直接執行命令: export PATH=$PATH:/
Linux shell 指令碼新增環境變數,監控web 服務是否正常
例項1:寫shell指令碼定義函式設定環境變數路徑 prepend() { [ -d “$2” ] && eval $1="$2${$1:+’:’$$1}" && export $1 } 執行 prepend PATH /opt/myapp/bin 說明:
Linux 中/etc/profile、~/.bash_profile 環境變數配置及執行過程
環境變數是和Shell緊密相關的,使用者登入系統後就啟動了一個Shell。對於Linux來說一般是bash,但也可以重新設定或切換到其它的 Shell。對於UNIX,可能是CShelll。環境變數是通過Shell命令來設定的,設定好的環境變數又可以被所有當前使用者所執行的程式所使用。對於bash這個Shell
MAC OSX 新增環境變數(最簡單的方式)
echo 'export PATH="/Users/aa/PostgreSQL/pg95/bin"' >> ~/.bash_profil 直接在命令列裡面執行以上命令即可,就是這麼簡單。 這裡是把 export PATH=" " 這行新增進了 ~/.bas
linux系統新增環境變數,mode.js forever 守護程序新增環境變數
1、node.js 守護程序元件 forever 安裝 npm install forever -g 安裝完成後截圖: 2、安裝完成後在控制檯輸入 forever 出現 -bash: forever: command