Sungjin's sub-brain :
Admin : New post
Guestbook
Local
Catergories
Recent Articles
Recent Comments
Calendar
Tag
Archive
Link
Search
 
해당되는 게시물 46건
  데비안에서 eth 장치 순서 바꾸기 (reordering eth devices) 
작성일시 : 2008. 1. 3. 11:34 | 분류 : 컴퓨터/LINUX

pico의 라이센스 기간이 만료된 관계로 다음 계약까지 사용을 못하게 되었다.
하지만 일이 급한지라 개인 용도의 리눅스 머신의 mac 어드레스와 시간을 바꿔
임시로 사용하기로 마음 먹었다.

리눅스 머신 eth0엔 공인 ip를 받아서 쓰고 있고 eth1은 사설 ip를 받아 내부 네트워크로 사용하고 있었는데 공인 ip의 mac애드레스를 라이센스가 사용하고 있는 mac애드레스로 바꿀 경우 인터넷을 사용할 수 없으므로 eth1의 mac 애드레스를 바꿔서 사용해야만 했다. 그런데 문제가 있었다. flexlm의 경우 eth0을 통해 hostid 즉 mac 애드레스를 검사하므로 어떻게 해서든지 eth0의 mac 애드레스를 라이센스에 맞게 고쳐야 한다는 것이었다. 이를 위해 네트워크 디바이스의 이름을 바꿀 필요가 있었다.

밑에 있는 글에서 소개된 대로 몇개를 시도해 보았지만 시도해본 결과 데비안(debian 2.6.18-5-686) udev rule을 고치는 것이 가장 깔끔하다는 것을 알 수 있었다. /etc/udev/rules.d/z25_persistent-net.rules 파일의 eth들 이름을 수정하면 되고 /etc/network/interfaces 파일의 아이피 관련 설정을 바꾸면 된다.

AIR Wiki : LogicalInterfaceNames

How to reorder or rename logical interface names in Linux


One of the problems of Linux is that the order of the network interfaces is unpredictable. Between reboots it usually stays the same, but often after an upgrade to a new kernel or the addition or replacement of a network card (NIC) the order of all network interfaces changes. For example, what used to be eth0 now becomes eth1 or eth2 or visa versa.

Obviously there is some logic to which network interface gets which name, but Linux documentation states that this may change and no user or program should ever assume anything about this. This is annoying, in particular if your management interface is at eth1 at one node in a cluster and at eth2 in another node of the same cluster (which we have experienced). I personally like to have my (primary) management interface always to be eth0.

Thankfully, there are ways to achieve this. They can be divided in four methods:
1. Order the network interfaces based on physical properties of the NIC. (e.g. the physical location in the machine)
2. Order the network interfaces based on the MAC address of the NIC.
3. Order the network interfaces based on the driver of the NIC.
4. Order the network interfaces based on the physical location of the NIC in the computer

So you have to pick a method that suits you. I recommend either to use ifrename (based on physcial properties, especially useful if you often change network cards in your hosts) or writing a udev rule (based on the MAC address). However, I listed the other methods as well. Be aware that the last two methods mentioned in this article are only for the masochistic (you will scream and shoot to get those to work).

Note: Linux kernels up to 2.4 did only probe for the first Ethernet card, ignoring other NICs. We assume you use a 2.6 or higher kernel or already fixed this, for example by specifying ether=0,0,eth1 as kernel parameter.

Based on the physical properties


Perhaps the most elegant way to name the ethernet NIC is to do so based on their physical properties, like link speed and port type.

Using the ifrename tool

Ifrename is a tool specifically designed to (re)name network interfaces based on characteristics like MAC address (wildcards supported), bus information, and hardware settings. It uses a control file (/etc/iftab) to specify rules about how the interfaces will be named. (thanks to Matt Baron for this tip.)

# Example /etc/iftab file
eth2           mac 08:00:09:DE:82:0E
eth3           driver wavelan interrupt 15 baseaddress 0x390
eth4           driver pcnet32 businfo 0000:02:05.0
# wildcard name: pick the lowest available name of air0, air1, air2, etc.
air*           mac 00:07:0E:* arp 1


Using the ethtool and ip programs

It is possible to check the NIC properties using the ethtool program, and to change the name using the ip program (thanks to Jollynn Schmidt for this tip):

if ethtool eth0 | grep -q "Port: FIBRE"; then
	   ip link set dev eth0 name not_eth0
	   ip link set dev eth1 name eth0
	   ip link set dev not_eth0 name eth1
fi


The disadvantage of ethtool is that it can only be run by root, even when you're only using it to query for information. Though this is a minor annoyance of ethtool, it doesn't matter in this case, since you want to set a device name and thus need to be root anyway.

Based on the MAC address


Secondly, it is also possible to name the network interface based on the MAC address of each NIC. The advantage is that it is possible to use this method if you have two NICs which use the same driver (unlike the next method: based on driver).

First, you must determine the MAC address of your interfaces. You can do this locally on a machine running
ifconfig -a

The MAC address is listed as "hwaddr" (hardware address). Alternatively, you can even determine MAC addresses remotely using ping and /sbin/arp.

There are three ways to map the MAC address to the logical interface name. Either by using the udev rules, with the get-mac-address.sh script, or by using the nameif program.

The udev method should work on all recent Linux distributions, and is recommended. The get-mac-address.sh script and the nameif program are know to work with Debian, while on Red Hat, you can change the interface configuration file.

Using udev rules
udev replaced devfs in Linux 2.6. First make sure that your Linux system has udev installed, rather then devfs. If you have a /etc/udev directory, but not /etc/devfs directory, you are probably fine. If not, be aware that changing your kernel from devfs to udev is possible, but is not just a matter of adding a new module. Perhaps for now, another method is easier for you.

Now that you have udev, it is rather simple. You only need to create a udev rule mapping the MAC address to the interface name. Store this in a file inside the /etc/udev/rules.d/ directory:
KERNEL=="eth?", SYSFS{address}=="00:37:e9:17:64:af", NAME="eth0"  # MAC of first NIC in lowercase
KERNEL=="eth?", SYSFS{address}=="00:21:e9:17:64:b5", NAME="eth1"  # MAC of second NIC in lowercase


Most distibutions already come with an example config file for you. E.g. /etc/udev/rules.d/network-devices.rules or /etc/udev/rules.d/010_netinterfaces.rules. More information can be found at http://www.reactivated.net/writing_udev_rules.html or http://www.debianhelp.co.uk/udev.htm. (Thanks to Casey Scott and Ron Hermsen for the pointers.)

Using the interface configuration file
If you run a Red-Hat-based distribution, you can simply add the MAC addres in the interface configuration file /etc/sysconfig/network-scripts/ifcfg-eth0:

DEVICE=eth0
HWADDR=00:37:e9:17:64:af


You can give it any DEVICE name you want, like DEVICE=ethmgmt, as long as you remember to rename the config file:
/etc/sysconfig/network-scripts/ifcfg-ethmgmt

Source: http://forums.serverwatch.com/showthread.php?t=18476

Using the get-mac-address.sh script
Another solution is to use the get-mac-address.sh script to map interface names by MAC address. On Debian, this script is distributed as part of the ifupdown package (in /usr/share/doc/ifupdown/examples/get-mac-address.sh). Copy this script to a saner place (e.g. /usr/local/bin), and you can setup /etc/network/interfaces in this manner:

auto lo eth0 eth1

iface lo inet loopback

mapping eth0 eth1
	    script /usr/local/bin/get-mac-address.sh
	    map 00:37:E9:17:64:AF netA
	    map 00:21:E9:17:64:B5 netB

iface netA inet static
	    address etc...

iface netB inet static
	    address etc...


Source: https://www.gelato.unsw.edu.au/archives/gelato-technical/2004-February/000334.html

The disadvantage of this method is that defines a mapping, rather then changing the actual logical interface name.

Using the nameif program

Alternative to the get-mac-address.sh script, you can also use the slightly more convenient nameif program, which is distributed as part of the net-tools package on Debian.

The advantage of nameif is that you can specify the interface names in the /etc/mactab file:
ethmgnt 00:37:E9:17:64:AF
ethwireless 00:21:E9:17:64:B5


It is not possible to rename an interface to a name of an existing interface. So you can't rename eth1 to eth0 as long as eth0 still exists. It is possible to still swap the names eth0 and eth1 by using a temporary name (e.g. first rename eth1 to ethfoo, then eth0 to eth1 and finally ethfoo to eth0). Note that this method may lead to problems if you use common names such as eth0 and eth1. If you upgrade a kernel, the names may be different than you expected, and you may rename a NIC to eth0 while eth0 still exists, leading to name collisions. Therefor, it is recommended to use other names like "ethmgmnt", "ethwired", "ethwireless" and "eth10ge", as shown in the example above.

Based on the driver


Warning: This only works if the driver is available as a loadable module. Not if it is built into the kernel.

This is a relative easy method, since it does not rely on external scripts. The idea is to just load the kernel module for your eth0 interface before the modules for other network cards.

First of all, you must determine which driver is used for each network card. Thankfully Linux does have a system to load the appropriate driver automatically, based on the PCI ID of the network card. Unfortunately, there is no single command to simply get the driver (and other information like the link speed) based on just the interface name in Linux. Your best bet is to look for kernel messages:
dmesg | grep eth

This should give you a good estimate of the driver name. You can verify if the name indeed does exist and is loaded:
lsmod


Note:
lsmod gave:
e1000           84868  0
tg3             70816  0

However, the 0 indicates that these drivers are not controlling any device! That is strange, since modprobe -r tg3 and modprobe -r e1000 do disable the network cards. Apparently, this is a flaw in lsmod.

Note that running modprobe tg3 en then modprobe e1000 does bring them up in the correct order, with the correct interface names. This is a good check if this approach (using the driver to decide the interface name) can work.

Red Hat
In Red Hat, if the driver is called "tg3" (the Tigon driver), you simply specify the network name by adding this enty in /etc/modules.conf:
~alias eth0 tg3


Debian
On a Debian system, /etc/modules.conf is generated automatically and should not be edited directly. Instead, create a file in the subdirectory /etc/modules/ (do not use /etc/modprobe.d/, that seems out-of-date). For example, create the file /etc/modutils/interfaces and add the appropriate modules. For example:
alias eth0 tg3
alias eth1 e1000

Next, update /etc/modules.conf by running:
update-modules


Alternative method: I have encountered scenario's where the kernel did already load the modules for the drivers, even before /etc/modules.conf was read. The result was that in effect, the specification in /etc/modules.conf was ignored, and this method did not work. As an alternative, it is possible to also list the drivers, in the appropriate order, in /etc/modules (thus not /etc/modules.conf):
tg3
e1000

The result will be that the tg3 driver is loaded before the e1000 kernel. Since /etc/modules only exists for Debian, this trick will most likely not work for other distributions.

Based on the physical location in the computer


Warning: This only works if the driver is built into the kernel, not as a loadable module.

Note: It is relatively hard to get this to work, and we encountered problems with it. The other methods are recommended.

It is possible to name the network interfaces based on the interrupt (IRQ) and memory address. This should work if you have network cards in PCI busses, and it involves appending the proper parameters to the "ether=" or "netdev=" kernel parameters.

First of all, you can detect the PCI slot of the devices using
lspci -v
This is reported to fail sometimes for certain cards. Now, write down the IRQ and IO (memory) address of each network card, and use this information to specify the interface name in your LILO or GRUB configuration file.

For LILO, you need to add an add line to the appropriate boot configuration. For example:
append="netdev=irq=21,io=0x2040,name=eth0 netdev=irq=20,io=0x3000,name=eth1 netdev=irq18,io=0x2000,name=eth2"

Under grub, it can just be listed as parameter. e.g.:
kernel /boot/vmlinuz netdev=irq=24,name=eth0


More Information
http://www.tldp.org/HOWTO/Ethernet-HOWTO-8.html
http://www.tldp.org/HOWTO/BootPrompt-HOWTO-11.html


Written by Freek Dijkstra. Licensed under public domain. (That is, feel free to modify, redistribute, cripple, or even sell it as your own work, and there is no need to mention the source, even though you are of course welcome to do so.)

Categories
CategorySysAdmin
CategoryProcedures
http://www.science.uva.nl/research/air/wiki/LogicalInterfaceNames
|
  script for socmaster3 
작성일시 : 2007. 12. 7. 12:30 | 분류 : 컴퓨터/SoC Master 3

ifconfig eth0 down
ifconfig eth0 up 192.168.0.3 netmask 255.255.255.0
route add default gw 192.168.0.1
mkdir /root/nfs
mount -t nfs -o nolock -o udp -o rsize=1024,wsize=8192 192.168.0.1:/filesystem/SoCMaster3  /root/nfs
cd nfs/itsoc
cd pico_driver
./test_pico.sh
cd ..
cd
./init
|
  The Linux Kernel Module Programming Guide 
작성일시 : 2007. 11. 23. 11:17 | 분류 : 컴퓨터/LINUX

The Linux Kernel Module Programming Guide
Prev Chapter 3. Preliminaries Next

3.1. Modules vs Programs

3.1.1. How modules begin and end

A program usually begins with a main() function, executes a bunch of instructions and terminates upon completion of those instructions. Kernel modules work a bit differently. A module always begin with either the init_module or the function you specify with module_init call. This is the entry function for modules; it tells the kernel what functionality the module provides and sets up the kernel to run the module's functions when they're needed. Once it does this, entry function returns and the module does nothing until the kernel wants to do something with the code that the module provides.

All modules end by calling either cleanup_module or the function you specify with the module_exit call. This is the exit function for modules; it undoes whatever entry function did. It unregisters the functionality that the entry function registered.

Every module must have an entry function and an exit function. Since there's more than one way to specify entry and exit functions, I'll try my best to use the terms `entry function' and `exit function', but if I slip and simply refer to them as init_module and cleanup_module, I think you'll know what I mean.

3.1.2. Functions available to modules

Programmers use functions they don't define all the time. A prime example of this is printf(). You use these library functions which are provided by the standard C library, libc. The definitions for these functions don't actually enter your program until the linking stage, which insures that the code (for printf() for example) is available, and fixes the call instruction to point to that code.

Kernel modules are different here, too. In the hello world example, you might have noticed that we used a function, printk() but didn't include a standard I/O library. That's because modules are object files whose symbols get resolved upon insmod'ing. The definition for the symbols comes from the kernel itself; the only external functions you can use are the ones provided by the kernel. If you're curious about what symbols have been exported by your kernel, take a look at /proc/kallsyms.

One point to keep in mind is the difference between library functions and system calls. Library functions are higher level, run completely in user space and provide a more convenient interface for the programmer to the functions that do the real work---system calls. System calls run in kernel mode on the user's behalf and are provided by the kernel itself. The library function printf() may look like a very general printing function, but all it really does is format the data into strings and write the string data using the low-level system call write(), which then sends the data to standard output.

Would you like to see what system calls are made by printf()? It's easy! Compile the following program:

#include <stdio.h>
int main(void)
{ printf("hello"); return 0; }
				

with gcc -Wall -o hello hello.c. Run the exectable with strace hello. Are you impressed? Every line you see corresponds to a system call. strace[1] is a handy program that gives you details about what system calls a program is making, including which call is made, what its arguments are what it returns. It's an invaluable tool for figuring out things like what files a program is trying to access. Towards the end, you'll see a line which looks like write(1, "hello", 5hello). There it is. The face behind the printf() mask. You may not be familiar with write, since most people use library functions for file I/O (like fopen, fputs, fclose). If that's the case, try looking at man 2 write. The 2nd man section is devoted to system calls (like kill() and read(). The 3rd man section is devoted to library calls, which you would probably be more familiar with (like cosh() and random()).

You can even write modules to replace the kernel's system calls, which we'll do shortly. Crackers often make use of this sort of thing for backdoors or trojans, but you can write your own modules to do more benign things, like have the kernel write Tee hee, that tickles! everytime someone tries to delete a file on your system.

3.1.3. User Space vs Kernel Space

A kernel is all about access to resources, whether the resource in question happens to be a video card, a hard drive or even memory. Programs often compete for the same resource. As I just saved this document, updatedb started updating the locate database. My vim session and updatedb are both using the hard drive concurrently. The kernel needs to keep things orderly, and not give users access to resources whenever they feel like it. To this end, a CPU can run in different modes. Each mode gives a different level of freedom to do what you want on the system. The Intel 80386 architecture has 4 of these modes, which are called rings. Unix uses only two rings; the highest ring (ring 0, also known as `supervisor mode' where everything is allowed to happen) and the lowest ring, which is called `user mode'.

Recall the discussion about library functions vs system calls. Typically, you use a library function in user mode. The library function calls one or more system calls, and these system calls execute on the library function's behalf, but do so in supervisor mode since they are part of the kernel itself. Once the system call completes its task, it returns and execution gets transfered back to user mode.

3.1.4. Name Space

When you write a small C program, you use variables which are convenient and make sense to the reader. If, on the other hand, you're writing routines which will be part of a bigger problem, any global variables you have are part of a community of other peoples' global variables; some of the variable names can clash. When a program has lots of global variables which aren't meaningful enough to be distinguished, you get namespace pollution. In large projects, effort must be made to remember reserved names, and to find ways to develop a scheme for naming unique variable names and symbols.

When writing kernel code, even the smallest module will be linked against the entire kernel, so this is definitely an issue. The best way to deal with this is to declare all your variables as static and to use a well-defined prefix for your symbols. By convention, all kernel prefixes are lowercase. If you don't want to declare everything as static, another option is to declare a symbol table and register it with a kernel. We'll get to this later.

The file /proc/kallsyms holds all the symbols that the kernel knows about and which are therefore accessible to your modules since they share the kernel's codespace.

3.1.5. Code space

Memory management is a very complicated subject---the majority of O'Reilly's `Understanding The Linux Kernel' is just on memory management! We're not setting out to be experts on memory managements, but we do need to know a couple of facts to even begin worrying about writing real modules.

If you haven't thought about what a segfault really means, you may be surprised to hear that pointers don't actually point to memory locations. Not real ones, anyway. When a process is created, the kernel sets aside a portion of real physical memory and hands it to the process to use for its executing code, variables, stack, heap and other things which a computer scientist would know about[2]. This memory begins with $0$ and extends up to whatever it needs to be. Since the memory space for any two processes don't overlap, every process that can access a memory address, say 0xbffff978, would be accessing a different location in real physical memory! The processes would be accessing an index named 0xbffff978 which points to some kind of offset into the region of memory set aside for that particular process. For the most part, a process like our Hello, World program can't access the space of another process, although there are ways which we'll talk about later.

The kernel has its own space of memory as well. Since a module is code which can be dynamically inserted and removed in the kernel (as opposed to a semi-autonomous object), it shares the kernel's codespace rather than having its own. Therefore, if your module segfaults, the kernel segfaults. And if you start writing over data because of an off-by-one error, then you're trampling on kernel code. This is even worse than it sounds, so try your best to be careful.

By the way, I would like to point out that the above discussion is true for any operating system which uses a monolithic kernel[3]. There are things called microkernels which have modules which get their own codespace. The GNU Hurd and QNX Neutrino are two examples of a microkernel.

3.1.6. Device Drivers

One class of module is the device driver, which provides functionality for hardware like a TV card or a serial port. On unix, each piece of hardware is represented by a file located in /dev named a device file which provides the means to communicate with the hardware. The device driver provides the communication on behalf of a user program. So the es1370.o sound card device driver might connect the /dev/sound device file to the Ensoniq IS1370 sound card. A userspace program like mp3blaster can use /dev/sound without ever knowing what kind of sound card is installed.

3.1.6.1. Major and Minor Numbers

Let's look at some device files. Here are device files which represent the first three partitions on the primary master IDE hard drive:

# ls -l /dev/hda[1-3]
brw-rw----  1 root  disk  3, 1 Jul  5  2000 /dev/hda1
brw-rw----  1 root  disk  3, 2 Jul  5  2000 /dev/hda2
brw-rw----  1 root  disk  3, 3 Jul  5  2000 /dev/hda3
					

Notice the column of numbers separated by a comma? The first number is called the device's major number. The second number is the minor number. The major number tells you which driver is used to access the hardware. Each driver is assigned a unique major number; all device files with the same major number are controlled by the same driver. All the above major numbers are 3, because they're all controlled by the same driver.

The minor number is used by the driver to distinguish between the various hardware it controls. Returning to the example above, although all three devices are handled by the same driver they have unique minor numbers because the driver sees them as being different pieces of hardware.

Devices are divided into two types: character devices and block devices. The difference is that block devices have a buffer for requests, so they can choose the best order in which to respond to the requests. This is important in the case of storage devices, where it's faster to read or write sectors which are close to each other, rather than those which are further apart. Another difference is that block devices can only accept input and return output in blocks (whose size can vary according to the device), whereas character devices are allowed to use as many or as few bytes as they like. Most devices in the world are character, because they don't need this type of buffering, and they don't operate with a fixed block size. You can tell whether a device file is for a block device or a character device by looking at the first character in the output of ls -l. If it's `b' then it's a block device, and if it's `c' then it's a character device. The devices you see above are block devices. Here are some character devices (the serial ports):

crw-rw----  1 root  dial 4, 64 Feb 18 23:34 /dev/ttyS0
crw-r-----  1 root  dial 4, 65 Nov 17 10:26 /dev/ttyS1
crw-rw----  1 root  dial 4, 66 Jul  5  2000 /dev/ttyS2
crw-rw----  1 root  dial 4, 67 Jul  5  2000 /dev/ttyS3
					

If you want to see which major numbers have been assigned, you can look at /usr/src/linux/Documentation/devices.txt.

When the system was installed, all of those device files were created by the mknod command. To create a new char device named `coffee' with major/minor number 12 and 2, simply do mknod /dev/coffee c 12 2. You don't have to put your device files into /dev, but it's done by convention. Linus put his device files in /dev, and so should you. However, when creating a device file for testing purposes, it's probably OK to place it in your working directory where you compile the kernel module. Just be sure to put it in the right place when you're done writing the device driver.

I would like to make a few last points which are implicit from the above discussion, but I'd like to make them explicit just in case. When a device file is accessed, the kernel uses the major number of the file to determine which driver should be used to handle the access. This means that the kernel doesn't really need to use or even know about the minor number. The driver itself is the only thing that cares about the minor number. It uses the minor number to distinguish between different pieces of hardware.

By the way, when I say `hardware', I mean something a bit more abstract than a PCI card that you can hold in your hand. Look at these two device files:

% ls -l /dev/fd0 /dev/fd0u1680
brwxrwxrwx   1 root  floppy   2,  0 Jul  5  2000 /dev/fd0
brw-rw----   1 root  floppy   2, 44 Jul  5  2000 /dev/fd0u1680
					

By now you can look at these two device files and know instantly that they are block devices and are handled by same driver (block major 2). You might even be aware that these both represent your floppy drive, even if you only have one floppy drive. Why two files? One represents the floppy drive with 1.44 MB of storage. The other is the same floppy drive with 1.68 MB of storage, and corresponds to what some people call a `superformatted' disk. One that holds more data than a standard formatted floppy. So here's a case where two device files with different minor number actually represent the same piece of physical hardware. So just be aware that the word `hardware' in our discussion can mean something very abstract.


http://www.linuxtopia.org/online_books/Linux_Kernel_Module_Programming_Guide/x431.html

|
  SoCMaster3 플래시에 부트로더, 커널이미지, 램디스크 올리기 
작성일시 : 2007. 11. 6. 19:48 | 분류 : 컴퓨터/SoC Master 3

IT-SoC 디자인 컨테스트에 참가해 오늘 데모를 하기로 했다.
노트북에 nfs를 세팅하고 이것 저것 환경을 다 체크한 후 회석이 형과 함께
SoC 사업단에 가서 데모를 한답시고 노트북 두대를 세팅하고 시리얼 케이블 연결하고
크로스케이블도 연결하고 보드에 전원을 넣었는데
평소와는 다르게 starting kernel에서 멈춰있는 보드... 굴욕 그자체ㅠㅠ
원인은 플래시가, 특히 부트로더쪽 플래시가 날라간거 같은데 설마 플래시가... 하는 마음에
열심히 fpga prom만 구워봤는데 여전히 안도는 걸로 봐서 플래시를 다시 굽기로했음.
플래시를 굽는 방법을 따로 정리해놓지 않아 당황했지만 이번 기회에 다시 플래시 굽는걸
기록해 놓아야 겠다는 생각으로 이렇게 기록!
-----------
환경
RVD3.0

간단한 절차는
1.RealViewDebugger로 부트모니터를 띄우고
2.모니터 프로그램의 어드레스맵에 맞춰SDRAM의 특정 주소에 RVD를 이용해 이미지를 기록해 놓는다.
3.모니터의 메뉴에 플래시 관련 메뉴가 있는데 여기서 1.blob 2.kernel image, 3.ramdisk중 하나를 선택하면 모니트 어드레스 맵에 적혀있는 위치에서 이미지 파일을 복사해 플래시에 기록한다.

자세히
\SoCMaster3 Linux\soc3_init\soc3_init\soc3_init_Data\Debug\soc3_init.axf
이 파일이 모니터 파일인데 이 파일을 load image를 통해 RVD로 불러온 후 run으로 실행시킨다.
실행된 결과가 RVD의 콘솔창을 통해 출력되어야 하는데 어떤 문제인지는 몰라도 항상 시리얼로 출력이 되는 문제가 있었다. 시리얼로 출력시 문제가 SDRAM에 blob,vmlinux.bin,ramdisk.tgz를 기록하기 위해 RVD의 메모리 관련 메뉴(debug-memory/register operation-upload/download memoryfile)를 통한 메모리 롸이팅이 제대롱 이루어 지지 않는다는 것이다. 여러가지 노력을 해보았지만 출력 방향은 결국은 해결하지 못하고 메모리 기록만 성공했는데 방법은 다음과 같다.
먼저 RVI를 연결하고 RVD를 실행시켜 모니터를 로드하고 run을 하기 직전! 메모리 기록을 시도하는 것이다. 이 때 어드레스맵
 #define BLOB_RAM_BASE       (0x50f00000)
 #define KERNEL_RAM_BASE     (0x50008000)
 #define PARAM_RAM_BASE      (0x50400000)
 #define RAMDISK_RAM_BASE    (0x50500000)
에 맞게 주소를 설정하고 타입은 RAW로 한다. 기록이 끝난후 blob를 제외한 나머지에선 download complete등의 메시지를 볼 수 있따. 이렇게 한 뒤 재부팅 후 제대로 도는거 확인!

제기랄 보드.ㅠㅠ

|
  AHB testbench signal generator 
작성일시 : 2007. 11. 5. 20:01 | 분류 : 컴퓨터/PICO Express

#include <stdio.h>
#define AHB_HTRANS_IDLE 0x00
#define AHB_HTRANS_BUSY 0x01
#define AHB_HTRANS_NONSEQ 0x02
#define AHB_HTRANS_SEQ 0x03

#define AHB_HBURST_SINGLE 0x0
#define AHB_HBURST_INCR 0x1
#define AHB_HBURST_WRAP4 0x2
#define AHB_HBURST_INCR4 0x3
#define AHB_HBURST_WRAP8 0x4
#define AHB_HBURST_INCR8 0x5
#define AHB_HBURST_WRAP16 0x6
#define AHB_HBURST_INCR16 0x7

#define AHB_HWRITE_READ 0x0
#define AHB_HWRITE_WRITE 0x1
FILE *fp;
char* sig_name = "sig_mout(0)";
int wait_for = 20;
int period = 20;
struct signal{
    int htrans;
    int* haddr;
    int hwdata;
    int hburst;
    int hsize;
    int hwrite;
    int hbusreq;
    int hlock;
    int hprot;
};
struct signal curr, next;
void initSignal(struct signal* s){
    s->htrans = AHB_HTRANS_IDLE;
    s->haddr = (int*)0x00000000;
    s->hburst = AHB_HBURST_SINGLE;
    s->hsize = 0;
    s->hwrite = AHB_HWRITE_READ;
    s->hbusreq = 0;
    s->hlock = 0;
    s->hprot = 1;
    s->hwdata = 0;
}
void setWriteDataInt32(int* addr, int data){
    printf("-- ADDR_PHASE WRITE: %08x = %08x\n",addr,data);
    curr.htrans = AHB_HTRANS_NONSEQ;
    curr.haddr = addr;
    curr.hbusreq = 1;
    curr.hwrite = AHB_HWRITE_WRITE;

    next.htrans = AHB_HTRANS_IDLE;
    next.hwdata = data;
    next.hbusreq = 1;

    wait_for = period;

}
void setReadDataInt32(int* addr){
    printf("-- ADDR_PHASE READ: %08x\n",addr);
    curr.htrans = AHB_HTRANS_NONSEQ;
    curr.haddr = addr;
    curr.hbusreq = 1;
    curr.hwrite = AHB_HWRITE_READ;

    next.htrans = AHB_HTRANS_IDLE;
    //next.hwdata = data;
    next.hbusreq = 1;

    wait_for = period;
}
void setWaitFor(int delay){
    initSignal(&next);

    wait_for = delay;
}

void advanceClock(){
    //curr <= next, init next
    memcpy((void*)&curr,(void*)&next,sizeof(curr));
    initSignal(&next);
}

void convHexToBinary(char* dst, int data, int size){
    int index = 0,i;
    char quote;
    if(size == 1)
        quote = '\'';
    else
        quote = '"';
    if(size > 1)
        dst[index++] = 'b';
    else
        dst[index++] = ' ';
    dst[index++] = quote;
    for(i = 0; i < size; ++i){

        char c = '0' + ((data>>i) & 0x00000001);
        dst[size + 3 - index++] = c;
    }
    dst[index++] = quote;
    dst[index] = '\0';
}
void convHexToHex(char* dst, int data, int size){
    char tmp[100];
    sprintf(tmp,"x\"%%0%dx\"",size);
    sprintf(dst,tmp,data);
}

void printSignal(void){
    char htrans[100];
    char haddr[100];
    char hburst[100];
    char hsize[100];
    char hwrite[100];
    char hbusreq[100];
    char hlock[100];
    char hprot[100];
    char hwdata[100];

    convHexToBinary(htrans,curr.htrans,2);
    convHexToHex(haddr,(int)curr.haddr,8);
    convHexToBinary(hburst,curr.hburst,3);
    convHexToBinary(hsize,curr.hsize,3);
    convHexToBinary(hwrite,curr.hwrite,1);
    convHexToBinary(hbusreq,curr.hbusreq,1);
    convHexToBinary(hlock,curr.hlock,1);
    convHexToBinary(hprot,curr.hprot,4);
    convHexToHex(hwdata,curr.hwdata,8);

    fprintf(fp,"%s.htrans\t<= %s;\n",sig_name,htrans);
    fprintf(fp,"%s.haddr\t<= %s;\n",sig_name,haddr);
    fprintf(fp,"%s.hburst\t<= %s;\n",sig_name,hburst);
    fprintf(fp,"%s.hsize\t<= %s;\n",sig_name,hsize);
    fprintf(fp,"%s.hwrite\t<= %s;\n",sig_name,hwrite);
    fprintf(fp,"%s.hbusreq\t<= %s;\n",sig_name,hbusreq);
    fprintf(fp,"%s.hlock\t<= %s;\n",sig_name,hlock);
    fprintf(fp,"%s.hprot\t<= %s;\n",sig_name,hprot);
    fprintf(fp,"%s.hwdata\t<= %s;\n",sig_name,hwdata);

    fprintf(fp,"wait for %d ns;\n",wait_for);
    advanceClock();
}

int main(){
    fp = fopen("/dev/stdout","w");
    //first init
    initSignal(&curr);
    initSignal(&next);
    printSignal();

    setWriteDataInt32((int*)0x9000000,0x00000030);
    printSignal();

    setWaitFor(200);
    printSignal();

    setReadDataInt32((int*)0x9000000);
    printSignal();

    setWaitFor(200);
    printSignal();

    setWriteDataInt32((int*)0x9010000,0x0000000a);
    printSignal();

    setWriteDataInt32((int*)0x9010004,0x00000002);
    printSignal();

    setWriteDataInt32((int*)0x9000000,0x00000003);
    printSignal();

    setWaitFor(200);
    printSignal();

}

|
  SoC Master3 cramfs를 통한 부팅 후 ip, nfs설정 
작성일시 : 2007. 10. 25. 14:16 | 분류 : 컴퓨터/SoC Master 3

ifconfig eth0 down
ifconfig eth0 up 192.168.0.3 netmask 255.255.255.0
route add default gw 192.168.0.1
mkdir /root/nfs
mount -t nfs -o nolock -o udp -o rsize=1024,wsize=8192 192.168.0.1:/filesystem/SoCMaster3  /root/nfs


------
nfs 마운트시 옵션 매우 중요.
read, write buffer 사이즈 설정.
|
  바이너리가 필요로 하는 공유 라이브러리 보기 - ldd 
작성일시 : 2007. 10. 13. 13:02 | 분류 : 컴퓨터/LINUX

LDD(1)

NAME
       ldd - print shared library dependencies

SYNOPSIS
       ldd [OPTION]...  FILE...

DESCRIPTION
       ldd prints the shared libraries required by each program or shared library specified on the command line.

OPTIONS
       --version
              Print the version number of ldd.

       -v --verbose
              Print all information, including e.g. symbol versioning information.

       -d --data-relocs
              Perform relocations and report any missing objects (ELF only).

       -r --function-relocs
              Perform relocations for both data objects and functions, and report any missing objects or functions (ELF only).

       --help Usage information.

BUGS
       ldd does not work on a.out shared libraries.

       ldd  does  not  work with some extremely old a.out programs which were built before ldd support was added to the compiler releases.  If you use ldd on one of these programs, the program
       will attempt to run with argc = 0 and the results will be unpredictable.

AUTHOR
       Roland McGrath and Ulrich Drepper.

SEE ALSO
       ldconfig(8), ld.so(8).

|
  ramdisk 파일 mount 하기 
작성일시 : 2007. 10. 5. 19:18 | 분류 : 컴퓨터/LINUX

Working with Ramdisk, Initrd, and Filesystems

Working with Ext2 Images

First, when we talk about a ramdisk, we're usually talking about an image of an ext2 filesystem and not necessarily the ramdisk device driver. We often use the ramdisk device driver, copying in the ramdisk image, mounting the filesystem, etc., but we could also use the flash block device driver or the loopback driver. These instructions tell how to use the loopback device to access an ext2 image, in which case ramdisk is not really involved at all.

Given an uncompressed filesystem image, you can mount it either through a ramdisk device or through the loopback filesystem type. Via ramdisk:

bash# mkdir mnt
bash# cat init-ramdisk-2-35 > /dev/ram1
bash# mount /dev/ram1 mnt

Or via loopback:

bash# mount -o loop init-ramdisk-2-35 mnt

In both of these cases, we omitted the '-t fstype' option from mount because it will read the superblock to determine the filesystem type. I've found that I often need to supply the type when mounting fat filesystems, but maybe that's just me.

Finally, we almost always compress the image before making copies of it, and we install the compressed filesystem image for the initial ramdisk, because the initrd driver knows how to recognize and unzip compressed filesystem images. We use the highest level of compression to minimize xmodem download times.

A small note: if you did some work (copied, moved, deleted files), the ramdisk will have some dirty blocks. Those blocks are not in use by the ext2 filesystem, but they still have the original file contents, and hence aren't that easy compressable as empty blocks (i.e. blocks only containing zeros). To get a smaller compressed image, you can copy the contents of the ramdisk to a clean ramdisk. Create a second ramdisk (or loopback device) and mount it. Suppose we have the original ramdisk mounted on /tmp/orig and the new one on /tmp/new, we just copy the contents:

  
cd /tmp/orig
tar cf - . | ( cd /tmp/new ; tar xpf - )

Unmount the ramdisks, extract the new ramdisk, compress it, and you'll have a smaller compressed image with exactly the same contents.

Example 1. Modifying an existing ext2 filesystem image

bash# gunzip ramdisk-file.gz
bash# mkdir temp
bash# mount -o loop ramdisk-file temp
bash# cd temp
(Do what you need to do.)
bash# cd ..
bash# umount temp
bash# gzip -9 ramdisk-file

Example 2. Creating a new ext2 filesystem image

bash# dd if=/dev/zero of=init-ramdisk.img bs=1k count=8k
bash# mke2fs -i 1024 -b 1024 -m 3 -F -v init-ramdisk.img
bash# mkdir temp
bash# mount -o loop init-ramdisk.img temp
bash# cd temp
(Do what you need to do.)
bash# cd ..
bash# umount temp
bash# gzip -9 init-ramdisk.img

Example 3. Creating an ext2 filesystem on a device

bash# mkfs -t ext2 /specialfile
where specialfile is something like /dev/ram1 (for a ramdisk), /dev/flash3 (for a flash device), /dev/fd0 (for a floppy), or init-ramdisk.img (for an image of a filesystem stored in a pre-existing file). The example above makes a filesystem onto an 8MByte file. This is the equivalent of formatting the drive. Instead of ext2, we could use another filesystem type, such as reiserfs, fat, etc.

Example 4. Going from a device to a file

bash# dd if=specialfile of=imagefile

will read the entire special file into a plain file, e.g.:

bash# dd if=/dev/ram1 of=init-ramdisk-2-35

But remember to unmount it before you extract it, or it can be out-of-sync (i.e.: the kernel hasn't flushed all data to disk yet). And of course the "mounted" bit is set if it is still mounted, so the next time you mount it you'll get a warning about dirty filesystems.

Working With Cramfs

Accessing cramfs is similar to ext2 ramdisk, except that cramfs is a readonly filesystem. It's new to 2.4.x so most 2.2.x-based development machines do not support it. Since cramfs is readonly, you cannot 'mkfs -t cramfs' and then populate. The mkcramfs utility creates an image of a cramfs filesystem from a directory tree.

Linux 2.4.x Desktop Computer

bash# mkdir mntpoint
bash# mkdir temp
bash# mount -t cramfs init-2-40.cramfs mntpoint -o loop
bash# cp -a mntpoint temp
(do what you need to do)
bash# cd ..
bash# mkcramfs temp init-2-41.cramfs

Now get to the boot loader and load the file where it belongs.

Linux 2.2.x Desktop Computer

Since 2.2 does not support cramfs filesystems, you cannot mount the cramfs filesystem. You will need the 'src' tar ball, e.g. root-src-2-40.tar.gz

bash# tar xfz root-src-2-40.tar.gz
bash# cd root
bash# (do what you need to do)
bash# cd ..
bash# mkcramfs root root-src-2-41.cramfs

Now get to the boot loader and load the file where it belongs.

Working With Ramfs

Ramfs is new to 2.4.x. It is a filesystem which keeps all files in RAM. It allows read and write access. Ramfs grows and shrinks to accomodate the files it contains, in contrast to a 'ext2 ramdisk', which gets allocated a fixed amount of RAM. To use ramfs, type:

bash# mkdir /mnt/mntpoint
bash# mount -t ramfs ramfs /mnt/mntpoint

Cloning an iPAQ Installation

Many people have asked me how to clone an iPAQ. Here is one way to clone an iPAQ that is a little scary because it involves reading and writing the raw device under a mounted JFFS2 filesystem. Several of us have used this mechanism with good results.

Example 5. Cloning a filesystem with dd

On the ipaq to be cloned, mount a filesystem on a card or network (via NFS). For the sake of argument, let us assume an IDE card mounted that filesystem on /mnt/hda.

Assuming the standard Familiar root filesytem mounted on /dev/mtdblock/1, execute the following command:

sh-2.03# mount /dev/hda1 /mnt/hda
hda: 700560 sectors (359 MB) w/96KiB Cache, CHS=695/16/63
Partition check:
/dev/ide/host0/bus0/target0/lun0: p1
sh-2.03# dd if=/dev/mtdblock/1 of=/mnt/hda/snapshot.jffs2
mtdblock_open
65024+0 records in
65024+0 records out
mtdblock_release
ok
sh-2.03# umount /mnt/hda
sh-2.03# 

Example 6. Cloning a filesystem using the bootldr

The bootldr can write to CF/IDE partitions or to VFAT filesytems. Using this mechanism, one can make a copy of the root filesystem image.

boot> copy input=flash:root output=cfa0:/backup.jffs2
boot> vfat write 0x50040000 /backup.jffs2 

Example 7. Option A: Restoring a filesystem with dd

On the clonee ipaq, with at least task-bootstrap installed, insert the IDE card and mount the filesystem. Again, let us assume it is installed on /mnt/hda.

sh-2.03# mount /dev/hda1 /mnt/hda
hda: 700560 sectors (359 MB) w/96KiB Cache, CHS=695/16/63
Partition check:
/dev/ide/host0/bus0/target0/lun0: p1
sh-2.03# dd if=/mnt/hda/snapshot.jffs2 of=/dev/mtdblock/1
mtdblock_open
65024+0 records in
65024+0 records out
mtdblock_release
ok
sh-2.03#

Now push the reset button. Trying to execute commands afterwards

Example 8. Option B: Restoring a filesystem via the bootldr

This method currently only works with H3600 or H3700 and VFAT filesystems. On the clonee ipaq, install bootldr 2.18.16 or newer.

boot> ver
Compaq OHH BootLoader, Rev 2-18-21 [BIG_KERNEL] [MD5] [MONO]
Last link date: Mon Mar 11 12:53:44 EST 2002
Contact: bootldr@handhelds.org

First, detect and attach the sleeve driver with the sleeve insert. In this example, it is a Compaq dual pcmcia sleeve.

boot> sleeve insert
h3600_sleeve_insert: no spi read, defaulting sleeve vendor
h3600_sleeve_insert: no spi read, defaulting sleeve deviceid
sleeve vendorid=00001125
sleeve deviceid=0000D7C3
pcmcia_probe_sleeve
probing for dual pcmcia sleeve
dual_pcmcia_linkup[0]->prc=000019F0
dual_pcmcia_probe_sleeve
pcmcia_register_ops: ops=0002D6F8
h3600_sleeve_insert: matched driver Compaq PC Card Sleeve

Next, detect and attach the driver for the PCMCIA card. In this example, it is a 340MB IBM Microdrive CF card.

boot> pcmcia insert
cis mapping=28000000
cis[0] =00000301
01 03 00 00 FF 17 04 67 5A 08 FF 1D 05 01 67 5A 08 FF 15 50 05 00 4C 75 63 65
6E 74 20 54 65 63 68 6E 6F 6C 6F 67 69 65 73 00 57 61 76 65 4C 41 4E 2F 49 45 45
45 00 56 65 72 73 69 6F 6E 20 30 31 2E 30 31 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 20 04 56 01 02 00
21 02 06 00 22 02 01 07 22 05 02 40 42 0F 00 22 05 02 80 84 1E 00 22 05 02 60 EC
53 00 22 05 02 C0 D8 A7 00 22 02 03 07 22 08 04 06 00 02 2D 0A EA 8B 22 02 05 0
1 1A 07 03 01 E0 03 00 00 01 1B 0F C1 01 19 76 C5 4B D5 19 36 36 05 46 7F FF FF
FF 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F
F FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
cis mapping=38000000
cis[0] =00000001
01 03 D9 01 FF
1C 04 03 D9 01 FF
18 02 DF 01
20 04 A4 00 00 00
manfid[0]=000000A4
manfid[1]=00000000
15 12 04 01 49 42 4D 00 6D 69 63 72 6F 64 72 69 76 65 00 FF
21 02 04 01
funcid=00000004
fixed disk
22 02 01 01
22 03 02 08 2F
1A 05 01 07 00 02 0F
1B 0B C0 C0 A1 27 55 4D 5D 4E 08 00 20
1B 06 00 01 21 B5 1E 3E
1B 0D C1 41 99 27 55 4D 5D 4E 64 F0 FF FF 20
1B 06 01 01 21 B5 1E 3E
1B 12 C2 41 99 27 55 4D 5D 4E EA 61 F0 01 07 F6 03 01 EE 20
1B 06 02 01 21 B5 1E 3E
1B 12 C3 41 99 27 55 4D 5D 4E EA 61 70 01 07 76 03 01 EE 20
1B 06 03 01 21 B5 1E 3E
end
ide status=000000D0
ide status=000000D0
ide status=000000D0
ide status=000000D0
C1A00594: 8A 84 B7 02 00 00 10 00-00 7E 00 02 3F 00 0A 00 | .........~..?...
C1A005A4: 90 B0 00 00 20 20 20 20-20 20 20 20 20 20 20 20 | ....
C1A005B4: 48 58 54 41 34 36 39 32-03 00 C0 00 04 00 44 4D | HXTA4692......DM
C1A005C4: 49 32 36 43 31 30 42 49-2D 4D 4D 44 4D 44 31 2D | I26C10BI-MMDMD1-
C1A005D4: 33 30 30 34 20 20 20 20-20 20 20 20 20 20 20 20 | 3004
C1A005E4: 20 20 20 20 20 20 20 20-20 20 20 20 20 20 10 80 |               ..
C1A005F4: 00 00 00 0E 00 40 00 01-00 00 01 00 B7 02 10 00 | .....@..........
C1A00604: 3F 00 90 B0 0A 00 00 01-90 B0 0A 00 00 00 00 00 | ?...............
serial_number:             HXTA4692
firmware_revision: DMI26C10
model_number: BI-MMDMD1-3004
bytes_per_sector=00000200
bytes_per_track=00007E00
n_sectors_per_track=0000003F
n_cylinders=000002B7
n_heads=00000010
n_sectors_user_addressable=00000000

Now mount the partition:

boot> vfat mount 0
cmd vfat mount: partid=00000000
ptable signature=0000AA55
vfat mount: reading bpb_info
C1A00628: EB 3C 90 6D 6B 64 6F 73-66 73 00 00 02 10 01 00 | .<.mkdosfs......
C1A00638: 02 00 02 00 00 F8 AB 00-3F 00 10 00 00 00 00 00 | ........?.......
C1A00648: 50 B0 0A 00 00 00 29 2B-04 01 00 20 20 20 20 20 | P.....)+...
C1A00658: 20 20 20 20 20 20 46 41-54 31 36 20 20 20 0E 1F |       FAT16   ..
C1A00668: BE 5B 7C AC 22 C0 74 0B-56 B4 0E BB 07 00 CD 10 | .[|.".t.V.......
C1A00678: 5E EB F0 32 E4 CD 16 CD-19 EB FE 54             | ^..2.......T
oemname=mkdosfs
sectors_per_cluster=00000010
n_reserved_sectors=00000001
n_root_entries=00000200
root_dir_sectors=00000020
first_root_dir_sector=00000157
fat_size=000000AB
fat_size_bytes=00015600
n_fats=00000002
total_sectors=000AB050
n_data_sectors=000AAED9
first_data_sector=00000177
n_clusters=0000AAED
fat_type=00000002
root_dir_entries:
C1A02FA0: 41 62 00 6F 00 6F 00 74-00 00 00 0F 00 DD FF FF | Ab.o.o.t........
C1A02FB0: FF FF FF FF FF FF FF FF-FF FF 00 00 FF FF FF FF | ................
C1A02FC0: 42 4F 4F 54 20 20 20 20-20 20 20 10 00 00 00 00 | BOOT       .....
C1A02FD0: 21 00 21 00 00 00 00 00-21 00 02 00 00 00 00 00 | !.!.....!.......
C1A02FE0: 42 7A 00 00 00 FF FF FF-FF FF FF 0F 00 D8 FF FF | Bz..............
C1A02FF0: FF FF FF FF FF FF FF FF-FF FF 00 00 FF FF FF FF | ................
C1A03000: 01 68 00 33 00 36 00 30-00 30 00 0F 00 D8 5F 00 | .h.3.6.0.0...._.
C1A03010: 69 00 6D 00 61 00 67 00-65 00 00 00 2E 00 67 00 | i.m.a.g.e.....g.
C1A03020: 48 33 36 30 30 5F 7E 31-47 5A 20 20 00 00 00 00 | H3600_~1GZ  ....
C1A03030: 21 00 21 00 00 00                               | !.!...
fat:
C1A0B9B0: F8 FF FF FF F8 FF 04 00-05 00 06 00 07 00 08 00 | ................
C1A0B9C0: 09 00 0A 00 0B 00 0C 00-0D 00 0E 00 0F 00 10 00 | ................
C1A0B9D0: 11 00 12 00 13 00 14 00-15 00 16 00 17 00 18 00 | ................
C1A0B9E0: 19 00 1A 00 1B 00 1C 00-1D 00 1E 00 1F 00 20 00 | .............. .
first data:
C1A006A0: 41 62 00 6F 00 6F 00 74-00 00 00 0F 00 DD FF FF | Ab.o.o.t........
C1A006B0: FF FF FF FF FF FF FF FF-FF FF 00 00 FF FF FF FF | ................
C1A006C0: 42 4F 4F 54 20 20 20 20-20 20 20 10 00 00 00 00 | BOOT       .....
C1A006D0: 21 00 21 00 00 00 00 00-21 00 02 00 00 00 00 00 | !.!.....!.......
cmd vfat mount: listing the root directory
vfat_list_dir_entries: attr=0000000F
skipping long entries
boot
attr=00000010
first_cluster=00000002
n_bytes=00000000
h3600_~1.gz
attr=00000020
first_cluster=00000197
n_bytes=008C3EF8
h3800-~1.jff
attr=00000020
first_cluster=000001E7
n_bytes=01F80000
task-b~1.jff
attr=00000020
first_cluster=00001607
n_bytes=00580000
h3800_~1
attr=00000020
first_cluster=00001C7E
n_bytes=01F80000
snapsh~1.jff
attr=00000020
first_cluster=000018C7
n_bytes=01FC0000

Now read the file, named in the lowercase 8.3 format, into DRAM. The following command will read the roughly 32MB snapshot into DRAM at address 32MB (requiring 64MB in the iPAQ):

boot> vfat read 0xc2000000 snapsh~1.jff
vfat_find_file_entry: fname='snapsh~1.jff'
dirname=''
basename='snapsh~1.jff'
looking for file entry in root_dir_entries:
vfat_find_file_entry:
C1A03180: 53 4E 41 50 53 48 7E 31-4A 46 46 20 00 00 7C 36 | SNAPSH~1JFF ..|6
C1A03190: 21 2A 21 2A 00 00 7C 36-21 2A C7 18 00 00 FC 01 | !*!*..|6!*......
got file entry rc=00000000
entry.n_bytes=01FC0000
rc=01FC0000

Now program the root partition with the data that was read into DRAM:

boot> program root 0xc2000000 0x01fc0000
programming flash partition root
ram src =C2000000
len =01FC0000

programming flash...erasing ...
Erasing sector 00040000
Erasing sector 00080000
Erasing sector 000C0000
Erasing sector 00100000

...

Erasing sector 01F00000
Erasing sector 01F40000
Erasing sector 01F80000
Erasing sector 01FC0000
writing flash..
addr: 00040000 data: E0021985
addr: 00050000 data: FFFFFFFF
addr: 00060000 data: FFFFFFFF
addr: 00070000 data: FFFFFFFF

...

addr: 01FC0000 data: 00031985
addr: 01FD0000 data: 5FF71D11
addr: 01FE0000 data: F73FF3FF
addr: 01FF0000 data: 368CE5C0
verifying ...
formatting ... done.
boot>

Filesystems Recommended for Removable Media

JFFS2 is designed for linear flash, not for Compact Flash cards, which already have a wear-leveling mechanism internally, nor for hard drives, which do not require a wear-leveling mechanism.

Ext2 is not so great, because it is hard to remember to unmount the filesytem before pulling the card out, which leads to running fsck and loss of data.

Ext3 is good because it enables you to journal directory and file data.

Reiserfs is also good for removable block devices because it is a journaling filesystem.

출처
http://www.handhelds.org/handhelds-faq/filesystems.html

|
  Linux, Window에서 mac 어드레스 바꾸기 
작성일시 : 2007. 10. 5. 14:38 | 분류 : 컴퓨터/LINUX

리눅스
ifconfig eth0 down hw ether aa:bb:cc:dd:ee:ff
ifconfig eth0 up

윈도우
아래를 보시오;ㅁ;




Changing Your MAC Address In Window XP/Vista, Linux And Mac OS X
(Sometimes known as MAC spoofing)


First let me explain a few things about MAC addresses. MAC stands for Media Access Control and in a sense the MAC address is a computer뭩 true name on a LAN. An Ethernet MAC address is a six byte number, usually expressed as a twelve digit hexadecimal number (Example: 1AB4C234AB1F).


IPs are translated to MAC address by a protocol called ARP (Address Resolution Protocol). Let뭩 say a computer with and IP of 192.168.1.1 wants to send information to another computer on the LAN that has an IP of 192.168.1.2 . First 192.168.1.1 will send out a broadcast to all stations on the LAN asking who has the IP 192.168.1.2. Then the box that has 192.168.1.2 will respond to 192.168.1.1 with it뭩 MAC address which is cached in 192.168.1.1뭩 ARP table for later use. To put this in Socratic Dialog form (with just a touch of Stallone):


Host 1 (192.168.1.1): Yo everyone on the LAN (FF:FF:FF:FF:FF:FF), who has the IP 192.168.1.2? My MAC is DE:AD:BE:EF:CA:FE so you can respond back to me.

Host 2 (192.168.1.2): Hello DE:AD:BE:EF:CA:FE, I have IP 192.168.1.2 and my MAC address is 12:34:56:78:90:12 so you can send your IP packets to me.


 You can see the ARP table of a box by dropping out to a command prompt and typing 밶rp 뻕?in Windows or just 밶rp?in Linux. ARP can also work the other way by a host on the LAN sending its MAC address to another machine on the LAN for preemptive caching unless the host is configured to not accept un-requested ARP replies.


 A person might want to change the MAC address of a NIC for many reasons:


  1. To get past MAC address filtering on a router. Valid MAC addresses can be found by sniffing them and then the deviant user could assume the MAC of a valid host. Having two hosts on the same network can cause some network stability problems, but much of the time it's workable. This is one of the reasons why MIC Address filtering on a wireless router is pointless. An attacker can just sniff the MAC address out of the air while in monitor mode and set his WiFi NIC to use it. Interestingly, a lot of hotels use MAC filtering in their "pay to surf" schemes, so this method can be an instant in for cheap skate road warriors. 
  2. Sniffing other connections on the network. By assuming another host's MAC as their own they may receive packets not meant for them. However, ARP poisoning is generally a better method than MAC spoofing to accomplish this task.
  3. So as to keep their burned in MAC address out of IDS and security logs, thus keeping deviant behavior from being connected to their hardware. For example, two of the main things a DHCP server logs when it leases an IP to a client is the MAC address and host name. If you have a wireless router look around on it's web interface for where it logs this info. Luckily there are tools to randomize this information (MadMACs).
  4. To pull off a denial of service attack, for instance assuming the MAC of the gateway to a sub net might cause traffic problems. Also, a lot of WiFi routers will lock up if a client tries to connect with the same MAC as the router's BSSID.

Linux

To change your MAC address in Linux (and most *nix system) is easy as pie. All it takes is two easy to script commands:


    ifconfig eth0 down hw ether 00:00:00:00:00:01

    ifconfig eth0 up


These two little commands would set your eth0 interface to use the MAC 00:00:00:00:00:01. Just plug in the NIC you want to set and the MAC address you want to use into the commands above and your done. Changing your MAC address is one of those things that is much easier to do in Linux then under Windows.


Mac OS X


        For versions of OS X before Tiger (OS X 10.4) you will need this patch:


    http://slagheap.net/etherspoof/


Then you use a command like:


    sudo ifconfig en0 lladdr 00:00:00:00:00:01


I'm not much of a Macintosh guy, so I pulled most of this info from:

http://www.macgeekery.com/gspot/2006-04/mac_address_spoofing


My understanding is that there are complications with some AirPort cards so you may also want to read:

http://rgov.org/airport-spoof/


Windows 2000/XP/Vista: The Hard Way

 




            In XP you can use the regedit to edit the registry from a GUI or the reg command to edit it from the console, I뭠l be using regedit. Information on all your NICs can be found the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\  . Under this key you will find a bunch of sub keys labeled as 0000, 00001, 0002 and so forth. We can assume any MAC address we want by finding the key that controls the NIC we want to change, putting in a string value called 밡etworkAddress?and setting it to the MAC address we want to use formatted as a twelve digit hex number (example: 000000000001). To find out which key is which we can search through them for the value 밆riverDesc?until we find the one that matches the NIC we wish to alter. After you set 밡etworkAddress?to the address you want just restart the NIC by disabling it then enabling it (or in the case of PCMCIA cards, just eject and reinsert). You can confirm the MAC address change by using the 밽etmac?or 밿pconfig /all?commands.


Windows 2000/XP/Vista: The Easy Way


            Use Mac Makeup ( http://www.gorlani.com/publicprj/macmakeup/macmakeup.asp ), MadMACs (http://www.irongeek.com/i.php?page=security/madmacs-mac-spoofer), Smac ( http://www.klcconsulting.net/smac/ ) or Etherchange (http://ntsecurity.nu/toolbox/etherchange/ ). Mac Makeup is a cool little GUI and Command line tool that's freeware, the creator also offers a Plugin for Bart's PE builder. MadMACs is a tool to randomize your MAC address and host name on every reboot. Smac has a nice GUI and was free but has since gone commercial, there's no reason to bother with it as there are free tools that are just as good. I use MadMACs since I wrote it and it lets me keep my host information randomized.


        Have fun with your MAC addresses switching, but be careful not to cause network problems. My favorite MAC address is DEADBEEFCAFE, for other interesting MACs see:


http://www.binrev.com/forums/index.php?showtopic=15942


Enjoy.

출처
http://www.irongeek.com/i.php?page=security/changemac

|
  Kernel Bootline Command Parameter Reference 
작성일시 : 2007. 9. 15. 11:54 | 분류 : 컴퓨터/LINUX

console 
The console settings. When using this option, you will need to specify the serial console port and baud rate. For example: console=ttyS0,38400 where ttyS0 is the serial console port and 38400 is the baud rate for the serial port. Another example: console=ttyS0,384008N1 where 8 is is data bits, N is odd parity and 1 is stop bits.
maxcpus=<number> 
Allows to limit the number of processors to be used on a multiprocessor systems.
nfsroot 
If the root filesystem for a board is mounted from a remote NFS server, this option can be used to specify the NFS server and the NFS filesystem. This option can be used as: nfsroot=<server-name>:<remote filesystem>. For example: nfsroot=10.0.0.139:/opt/mips_le_fs, where 10.0.0.139 is the NFS server name and /opt/mips_le_fs is the remote filesystem exported by the NFS server.
nofpu 
Can be used to disable the FPU entirely. In this the kernel FPU emulation will take over floating point processing. Useful if a FPU is known to be defective, has accuracy problems and wrongly detected as present even though none exists.
nosmp 
Disable SMP. Same as maxcpus=0.
nowait 
Disable the use of the wait instruction for powersaving.
rd_start 
The base address of a loaded ramdisk image. This option was added in Linux 2.6.10-rc2. See also rd_size.
rd_size 
The size of a loaded ramdisk image. This option was added in Linux 2.6.10-rc2. See also rd_start.
root 
This option is used to specify the root filesystem. For example, if the root filesytem resides on the second partition of a SCSI device /dev/sda, then this can be specified as: root=/dev/sda2. Similarly, when the root filesystem is mounted over NFS, root=/dev/nfs can be used.
|
 Prev   1   2   3   4   5   Next