프로그램 사용/u-boot2010. 1. 22. 19:50
denx.de에 나온 메시지는 아래와는 좀 다른데,

GUNZIP ERROR - must RESET board to recover
에러가 발생할경우, 메모리가 부족해서 겹쳐서 제대로 압축을 해제하지 못했을 가능성이 있다고 한다.
그것도 아니라면.. 도대체 머가 문제일까?

   Verifying Checksum ... OK
   Uncompressing Kernel Image ... Error: Bad gzipped data
GUNZIP ERROR - must RESET board to recover

[링크 : http://www.denx.de/wiki/view/DULG/Manual]
    [링크 : http://www.denx.de/wiki/view/DULG/HowCanILoadAndUncompressACompressedImage]
    [링크 : http://www.denx.de/wiki/view/DULG/LinuxHangsAfterUncompressingKernel]
    [링크 : http://www.denx.de/wiki/view/DULG/LinuxUncompressingError]
Posted by 구차니
프로그램 사용/u-boot2009. 12. 30. 12:26
당연한것 일수도 있지만, u-boot에서 kernel로 argument를 날려주고
그 인자들 중, NIC 관련 변수들을 파싱하여 자동으로 네트워크를 설정하게 되는데
인자를 ' '(홀따옴표)로 감싸주어 커널에서 파싱하도록 할 수 있다.

물론, bootargs에 한번에 넣어서는 불가능하며,
run 명령어를 통해서 인자를 생성후 넘겨주는 방식을 취한다.

We can use U-Boot environment variables to store all necessary configuration parameters:

=> setenv ipaddr 192.168.100.6
=> setenv serverip 192.168.1.1
=> setenv netmask 255.255.0.0
=> setenv hostname canyonlands
=> setenv rootpath /opt/eldk-4.2/ppc_4xx
=> saveenv

Then you can use these variables to build the boot arguments to be passed to the Linux kernel:

=> setenv nfsargs 'root=/dev/nfs rw nfsroot=${serverip}:${rootpath}'


Note: You cannot use this method directly to define for example the "bootargs" environment variable, as the implicit usage of this variable by the "bootm" command will not trigger variable expansion - this happens only when using the "setenv" command.

[링크 : http://www.denx.de/wiki/DULG/LinuxBootArgs]


사용예
setenv nfsargs 'setenv bootargs console=ttyAS0,115200 root=/dev/mtdblock2 rootfstype=cramfs'
setenv addip 'setenv bootargs ${bootargs} nwhwconf=device:eth0,hwaddr:${ethaddr}
                    ip=${ipaddr}::${gateway}:${netmask}:${histname}::off'
setenv bootcmd 'run nfsargs addip\; tftp 0x84400000 uImage\; bootm'

아무튼, bootcmd 에 'run' 을 통해서 bootargs를 생성후 임시 변수를 커널로 넘겨주는 방식이다.
(실제로 bootargs 변수는 uboot에 존재하지 않는다.)
Posted by 구차니
이번에 닥친일은 ethaddr 중 특정 부분을 추출하는 일인데
sed를 써야 하나? shell에서 해야 하나? 이래저래 테스트 하는데..

sh 에서는.. busybox의 ash 라서 그런지 $(string:n:m) 방식의 추출이 되지 않았고
유일하게 되는게 $(string#substr) 로 일치하는 스트링을 삭제하는 것 뿐이었다.
그리고 sed는 .. 라인단위로 하다 보니. 일치하는 문자만을 삭제하려니.. OTL

그런 이유로 tr이라는 녀석이 걸려 나오게 되었다.
tr은 translate or delete characters 라는데.. 도대체 r은 어디서 튀어 나온 녀석일까 ㄱ-




아무튼, uboot 에서 사용하는 예약어인 ethaddr 에서 MAC 부분을 추출하려고 하면
fw_printenv 와 쉘 그리고 tr을 조합하면 된다.

일단 fw_printenv의 값은
 ethaddr=00:00:00:00:00:00
으로 출력되고 이 값을 변수에 넣어준다.

ETH_TEMP=`fw_printenv ethaddr`
ETH_ADDR=echo ${ETH_TEMP#ethaddr=} | tr -d :

그러면 간단하게 ethaddr= 뒤의 MAC 어드레스가 : 없이 나오게 된다.


[링크 : http://k.daum.net/qna/view.html?qid=2f8nN&l_cid=Q&l_st=1] tr
[링크 : http://linux.die.net/man/1/tr] tr man page
[링크 : http://www.faqs.org/docs/abs/HTML/string-manipulation.html]  sh 에서 스트링
[링크 : http://www.ibm.com/developerworks/kr/library/l-sed1.html]      sed 사용법
Posted by 구차니
프로그램 사용/u-boot2009. 8. 19. 17:20
fw_printenv는 uboot에 포함된 tool이다
uboot/tool/env 에 존재하는 녀석인데
ethaddr을 값을 변경하려고 하니 에러가 발생하였다.

fw_setenv()의 리턴값은 30인데 아마도 EROFS가 30인듯 하다(errno.h에서는 발견하지 못한 변수이다.)
눈에 들어온 부분은 아래의 strcmp() 이다.
	/*
	 * Delete any existing definition
	 */
	if (oldval) {
		/*
		 * Ethernet Address and serial# can be set only once
		 */
		if ((strcmp (name, "ethaddr") == 0) ||
			(strcmp (name, "serial#") == 0)) {
			fprintf (stderr, "Can't overwrite \"%s\"\n", name);
			return (EROFS);
		}

		if (*++nxt == '\0') {
			*env = '\0';
		} else {
			for (;;) {
				*env = *nxt++;
				if ((*env == '\0') && (*nxt == '\0'))
					break;
				++env;
			}
		}
		*++env = '\0';
	}

아무튼, uboot에서 기본적으로 ethaddr과 serial#을 지원하고
이값들은, 한번만 write되고 수정되서는 안되기 때문에 제약사항으로 묶어놓은 듯 하다.
Posted by 구차니