Difference between revisions of "Ramdisk"

From ZeptoOS
Jump to navigationJump to search
Line 8: Line 8:
  
 
* BGP-ION-ramdisk-for-CNL.elf
 
* BGP-ION-ramdisk-for-CNL.elf
** Default ION ramdisk for ZeptoOS
+
** '''Default ION ramdisk''' for ZeptoOS
 
* BGP-ION-ramdisk-for-CNK.elf  
 
* BGP-ION-ramdisk-for-CNK.elf  
 
** Use this one if you need to run IBM CNK on Compute node
 
** Use this one if you need to run IBM CNK on Compute node
** IBM CIOD starts intead of ZOID
+
** IBM CIOD is used instead of ZOID
  
Our ramdisks are similar to IBM default ION ramdisk but we add some
+
Our ION ramdisks are similar to IBM default ION ramdisk but we add some
 
extra files to support our features. The extra files are located in
 
extra files to support our features. The extra files are located in
ramdisk/ION/ramdisk-add. The build-ramdisk script is used to create
+
ramdisk/ION/ramdisk-add. The build-ramdisk script from IBM BGP driver is used to create
 
ION ramdisk. The default path of the build-ramdisk script is
 
ION ramdisk. The default path of the build-ramdisk script is
 
/bgsys/drivers/ppcfloor. The build-ramdisk script path can be
 
/bgsys/drivers/ppcfloor. The build-ramdisk script path can be
Line 23: Line 23:
 
CN ramdisk is embedded into CN kernel
 
CN ramdisk is embedded into CN kernel
 
image(BGP-CN-zImage-with-initrd.elf).  CN ramdisk is created by our
 
image(BGP-CN-zImage-with-initrd.elf).  CN ramdisk is created by our
local ramdisk build scritp( ramdisk/CN/create-bgp-cn-linux-ramdisk.pl
+
local ramdisk build script( ramdisk/CN/create-bgp-cn-linux-ramdisk.pl
). Both build-ramdisk and create-bgp-cn-linux-ramdisk.pl uses the
+
). Both build-ramdisk and create-bgp-cn-linux-ramdisk.pl is a wrapper script of the  
gen_init_cpio command which is from Linux kernel.
+
Linux kernel's gen_init_cpio command.
  
 
==How to create ramdisk images==
 
==How to create ramdisk images==
Line 39: Line 39:
  
 
If you want to create CN ramdisk(technically create CN kernel image
 
If you want to create CN ramdisk(technically create CN kernel image
with new ramdisk contents), do:
+
with new ramdisk contents), type:
  
 
<pre>
 
<pre>
Line 71: Line 71:
 
The line that you added is a gen_init_cpio command. You can also
 
The line that you added is a gen_init_cpio command. You can also
 
create a directory, device file, symbolick link, pipe file, socket
 
create a directory, device file, symbolick link, pipe file, socket
file as well. "$cwd" in the previous example is
+
file as well.  
create-bgp-cn-linux-ramdisk.pl specific variable. It will be replaced
 
with the directory where the script is located. $cwd will be
 
ramdisk/CN/ for example.
 
  
 
<pre>
 
<pre>
Line 94: Line 91:
 
<min>      minor number of nod
 
<min>      minor number of nod
 
</pre>
 
</pre>
 +
 +
"$cwd" in the previous example is create-bgp-cn-linux-ramdisk.pl specific stuff.
 +
It will be replaced with the directory where the script is located. "$cwd" is basically used to point
 +
ramdisk/CN/tree/.  You can write "$cwd/tree/etc/yourfile" instead of "/full/path/BGP/tree/etc/yourfile".
  
  

Revision as of 14:19, 27 April 2009

Both CN Linux kernel and ION Linux kernel requires ramdisk to boot. Ramdisk images basically contain minimum Linux utilities, init scripts , configuration files, kernel modules, etc, which are required by OS boot process.

ION ramdisk is an ELF file that contains a cpio format archive of system files. Two ION ramdisk images are currently generated.

  • BGP-ION-ramdisk-for-CNL.elf
    • Default ION ramdisk for ZeptoOS
  • BGP-ION-ramdisk-for-CNK.elf
    • Use this one if you need to run IBM CNK on Compute node
    • IBM CIOD is used instead of ZOID

Our ION ramdisks are similar to IBM default ION ramdisk but we add some extra files to support our features. The extra files are located in ramdisk/ION/ramdisk-add. The build-ramdisk script from IBM BGP driver is used to create ION ramdisk. The default path of the build-ramdisk script is /bgsys/drivers/ppcfloor. The build-ramdisk script path can be configured by the main configure script.

CN ramdisk is also a gzip'ed cpio format archive of system files, but CN ramdisk is embedded into CN kernel image(BGP-CN-zImage-with-initrd.elf). CN ramdisk is created by our local ramdisk build script( ramdisk/CN/create-bgp-cn-linux-ramdisk.pl ). Both build-ramdisk and create-bgp-cn-linux-ramdisk.pl is a wrapper script of the Linux kernel's gen_init_cpio command.

How to create ramdisk images

CN kernel image, ION kernel image and ION ramdisk images are always (re-)created from prebuild objects if you type make at the top level directory (without any make target),

In case you actually need to create ION ramdisk individually (without rebuilding other images), you can do:

$ make bgp-ion-ramdisk-cnl

If you want to create CN ramdisk(technically create CN kernel image with new ramdisk contents), type:

$ make bgp-cn-linux

NOTE: ramdisk/CN/bgp-cn-ramdisk.cpio.gz is a newly built CN ramdisk.

How to modify ramdisk contents

For ION ramdisk, you can copy files to a directory under ramdisk/ION/ramdisk-add/ and build ramdisk. Here is an example.

$ vi ramdisk/ION/ramdisk-add/etc/yourfile
$ make bgp-ion-ramdisk-cnl

BGP-ION-ramdisk-for-CNL.elf contains /etc/yourfile.

For CN ramdisk, you can add some commands to the @cmdlists array in ramdisk/CN/create-bgp-cn-linux-ramdisk.pl. Here is an example to add a file.

$ vi ramdisk/CN/tree/etc/yourfile
$ vi ramdisk/CN/create-bgp-cn-linux-ramdisk.pl # the following line to @cmdlists 
     "file /etc/yourfile   $cwd/tree/etc/yourfile 0755  0  0",
$ make bgp-cn-linux

The line that you added is a gen_init_cpio command. You can also create a directory, device file, symbolick link, pipe file, socket file as well.

file <name> <location> <mode> <uid> <gid>
dir <name> <mode> <uid> <gid>
nod <name> <mode> <uid> <gid> <dev_type> <maj> <min>
slink <name> <target> <mode> <uid> <gid>
pipe <name> <mode> <uid> <gid>
sock <name> <mode> <uid> <gid>

<name>      name of the file/dir/nod/etc in the archive
<location>  location of the file in the current filesystem
<target>    link target
<mode>      mode/permissions of the file
<uid>       user id (0=root)
<gid>       group id (0=root)
<dev_type>  device type (b=block, c=character)
<maj>       major number of nod
<min>       minor number of nod

"$cwd" in the previous example is create-bgp-cn-linux-ramdisk.pl specific stuff. It will be replaced with the directory where the script is located. "$cwd" is basically used to point ramdisk/CN/tree/. You can write "$cwd/tree/etc/yourfile" instead of "/full/path/BGP/tree/etc/yourfile".


How to extract files from existing ramdisk image

If you want to extract file from existing ramdisk image, do the following steps (ION ramdisk only).

$ ./packages/tools/z-extract-cpio-from-ramdisk.sh  existingramdisk.elf  ramdisk.cpio
$ mkdir treeroot && cd treeroot
$ cpio -idv < ../ramdisk.cpio