|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
系统安全相关命令:passwd、su、umask、chgrp、chmod、chown、chattr、sudo、pswho
完成了uboot对非linuxkernel的引诱。固然有一个IH_TYPE_STANDALONE,可是没有完成。nnd.只能本人想举措。完成具体见上面。
1、两个命令
setbootcmdtftp84000000uImage;bootm84000000
setbootdelay1
2、非linuxkernel的引诱完成办法:
一共三个函数:jump,selectboot和system_boot
把jump放在必要跳转的中央,参数就是要跳转的地点。然后前往,重启体系。select放在main的开首。经由过程判别ram的特定地点的特定信息完成跳转。
system_boot完成体系的从头启动
#defineFDMA_SRAM_TOP_ADDRESS0xB9229800
#defineMAGIC_NUM0x71097100
#defineDEAD_PATTERN0xBAD0BADF
#defineST40_CPG_REGS_BASE0xFFC00000#define
ST40_CPG_WTCNT(ST40_CPG_REGS_BASE+0x08)
#defineST40_CPG_WTCSR(ST40_CPG_REGS_BASE+0x0C)
#defineST40_CPG_WTCSR2(ST40_CPG_REGS_BASE+0x1C)
voidJump(unsignedintaddress)
{
STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS-4*1,MAGIC_NUM);
STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS-4*2,address);
STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS-4*3,~address);
STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS-4*4,~MAGIC_NUM);
STSYS_WriteRegDev16LE(ST40_CPG_WTCNT,0x5AF0);/*Watchdogcounter*/
STSYS_WriteRegDev16LE(ST40_CPG_WTCSR,0xA547);/*Watchdogcontrol*/
STSYS_WriteRegDev16LE(ST40_CPG_WTCSR2,0xAA00);/*Watchdogcontrol2*/
STSYS_WriteRegDev16LE(ST40_CPG_WTCSR,0xA5C7);/*Startwatchdogcounter*/for(;;);
}
voidSelectBoot(void)
{
unsignedintMagicNum=0;
unsignedintNotMagicNum=0;
unsignedintJumpAddress=0;
unsignedintNotJumpAddress=0;void(*entry)(void);
/*entry=0xa0100000;
entry();*///if((STSYS_ReadRegDev16LE(ST40_CPG_WTCSR2)&0xFF)!=0x0)
{
MagicNum=STSYS_ReadRegDev32LE(FDMA_SRAM_TOP_ADDRESS-4*1);
JumpAddress=STSYS_ReadRegDev32LE(FDMA_SRAM_TOP_ADDRESS-4*2);
NotJumpAddress=STSYS_ReadRegDev32LE(FDMA_SRAM_TOP_ADDRESS-4*3);
NotMagicNum=STSYS_ReadRegDev32LE(FDMA_SRAM_TOP_ADDRESS-4*4);
if((MagicNum==MAGIC_NUM)
&&(MagicNum==(~NotMagicNum))
&&(JumpAddress==(~NotJumpAddress)))
{
entry=(void(*)(void))JumpAddress;
STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS-4*1,DEAD_PATTERN);
STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS-4*2,DEAD_PATTERN);
STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS-4*3,DEAD_PATTERN);
STSYS_WriteRegDev32LE(FDMA_SRAM_TOP_ADDRESS-4*4,DEAD_PATTERN);
#if0/*SetupForwatchdogincasejumpfailed.*/
STSYS_WriteRegDev16LE(ST40_CPG_WTCNT,0x5AF0);
STSYS_WriteRegDev16LE(ST40_CPG_WTCSR,0xA543);
STSYS_WriteRegDev16LE(ST40_CPG_WTCSR2,0xAA01);
STSYS_WriteRegDev16LE(ST40_CPG_WTCSR,0xA5C7);
#endifentry();while(1);
}
}
}voidsystem_reboot(void)
{
ulongsr;
asm("stcsr,%0":"=r"(sr));
sr|=(1<<28);/*setblockbit*/
asm("ldc%0,sr"::"r"(sr));
asmvolatile("trapa#0");
}
</p>
当你经过一段时间的学习后就应该扩充自己的知识,多学习linux命令,但是不要在初学阶段就系统的学习linux命令。 |
|