
Where did you get "fsimage.tar" from?
I made it using info obtained from MontaVista Support. Essentially I used thier Target Configuration Tool - the script is pasted below. An excerpt from the tech support follows:
We recommend using TCT to build a root filesystem image. The program you use is /opt/hardhat/host/bin/targetconf.
If you need a non-GUI tool to build an initrd, we have one that is used with our Compaq iPAQ LSP. This is not supported for general use in creating ramdisk images, but it should work for you, and I've provided it here.
Instructions:
1. If you've relocated your MontaVista Linux installation to somewhere other than the default location (/opt/hardhat/...), then you need to edit the script and change the line
basedir = "/opt/hardhat"
to point to the correct base directory for your installation.
2. ctargetconf can only be used to build a filesystem. It will not build a kernel as is done in targetconf.
3. Create a project in TCT but do not include a "Custom kernel". Basically, you are creating a TCT project that will only build a filesystem, i.e.,
New Project -> (Fill in proper fields in "TCT: New Project" window, select LSP, ***BUT*** make sure to unselect "Use Custom Kernel"). Then create a config file and choose all desired packages. Save the config.
4. From your TCT project directory, copy the .project and *.cfg file to your working directory where ctargetconf is located.
5. Build a filesystem image.
./ctargetconf -c test1.cfg -o fsimage.tar
To see command options, just do,
./ctargetconf
6. Making the initrd image:
The above builds a tarball of the files in the root filesystem. To make an actual initrd image, you have to make a file of the correct size, make an ext2 filesystem on this file, mount the new filesystem, copy (preserving symbolic links) the files from your tarball into the new filesystem, then unmount the filesystem, sync, and compress the filesystem. The following makes a 16 MB ramdisk image from fsimage.tar:
mkdir mountpoint dd if=/dev/zero of=ramdisk bs=1k count=16384 /sbin/mke2fs -q -F -m0 ramdisk mount -o loop ramdisk mountpoint cd mount tar xf fsimage.tar sync sleep 1 sync cd .. umount mountpoint sync gzip -9 ramdisk
What does it contain.
tar -xvf fsimage.tar ls -al total 36 drwxr-xr-x 9 root root 4096 Apr 1 18:27 . drwxr-xr-x 4 root root 4096 Apr 1 18:11 .. drwxr-xr-x 2 root root 4096 Apr 1 18:11 bin drwxr-xr-x 2 root root 4096 Apr 1 18:11 dev drwxr-xr-x 6 root root 4096 Apr 1 18:11 etc drwxr-xr-x 2 root root 4096 Apr 1 18:11 lib drwxr-xr-x 2 root root 4096 Apr 1 18:11 sbin drwxr-xr-x 5 root root 4096 Apr 1 18:11 usr drwxr-xr-x 4 root root 4096 Apr 1 18:11 var
Ummm... I don't even see a filename here. I don;t see if there is an "init" binary or a shell or any library or any device.
Sorry about that - I need to learn how to cut and paste properly ;-)
Which sort of output do you expect when providing such input? GIGO...
I expect none - it was a mistake.
The mounted volume contains:
ls -al mountpoint total 26 drwxr-xr-x 10 root root 1024 Mar 20 15:34 . drwxr-xr-x 4 root root 4096 Apr 1 18:28 .. drwxr-xr-x 2 root root 1024 Mar 20 15:34 bin drwxr-xr-x 2 root root 2048 Mar 20 15:34 dev drwxr-xr-x 6 root root 1024 Mar 20 15:34 etc drwxr-xr-x 2 root root 2048 Mar 20 15:34 lib drwxr-xr-x 2 root root 12288 Mar 20 15:34 lost+found drwxr-xr-x 2 root root 1024 Mar 20 15:34 sbin drwxr-xr-x 5 root root 1024 Mar 20 15:34 usr drwxr-xr-x 4 root root 1024 Mar 20 15:34 var
Wolfgang Denk
#!/usr/bin/env python
# # FILE: ctargetconf # # DESCRIPTION: # ctargetconf is a scalled back, commandline version of targetconf. # # AUTHOR: MontaVista Software, Inc. source@mvista.com # # Copyright 2000-2001 MontaVista Software Inc. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN # NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 675 Mass Ave, Cambridge, MA 02139, USA. #
import string import sys import os import os.path import getopt
# # Find module library and add to search path #
# The following assumes this script is installed under: # ${basedir}/devkit/lsp/${lsp_name}/sub_dir/ thisdir = os.path.dirname(os.path.abspath(sys.argv[0])) #basedir = os.path.normpath(os.path.join(thisdir, '../../../../')) basedir = "/opt/hardhat" libpath = os.path.join(basedir, 'host', 'lib', 'python') if os.path.isdir(libpath): sys.path.insert(1, libpath)
# # Set relocatable base path #
from MontaVista.Configurator.PEBackend import SetHHLBase
SetHHLBase(basedir)
from MontaVista.Configurator.PEBackend import Project, ProjectConfig, LspDatum from MontaVista.Configurator.PECfgComponents import PackageSelectorConfig, TargetOptions
def _outcmd ( strdata ): if (SuppressOutput == "FALSE"): sys.stdout.write(strdata) def _errcmd ( strdata ): sys.stderr.write(strdata) def _donecmd ( ): sys.stderr.write("Done.\n")
WorkingDir=None UseProjectFile="FALSE" ProjectFile=None LSPname=None Config=None StripFiles=None OutputFile=None SuppressOutput="FALSE" DBVerify=None ToolPrefix="FALSE"
def usage (): sys.stderr.write("uTCT The command line adventure\n\n") sys.stderr.write("\t-d <Working Directory> or --working-direcotry <Work dir> : If ommited the Current is chosen\n") sys.stderr.write("\t-p or --project-file : Load Project file - optional project file\n") sys.stderr.write("\t-c <config file> or --package-configuration <config file> : Package Configuation (Default)\n") sys.stderr.write("\nThese options will override the project file if provided:\n\n") sys.stderr.write("\t-s or --strip-files : Strip files\n") sys.stderr.write("\t-u or --no-strip-files : Don't Strip files (Default)\n") sys.stderr.write("\t-l <lsp name> or --lsp-name <lsp name> : Set Lsp Name\n") sys.stderr.write("\t-n <project name> or --project-name <project name> : Set Project Name\n") sys.stderr.write("\t-o <output file> or --output-file <output file> : Output Filesystem file\n") sys.stderr.write("\t-q or --quiet : Suppress Most Filesystem generation\n") sys.stderr.write("\t--db-verify : Compare Configfile against Database\n") sys.stderr.write("\t--get-tool-prefix : Output Tool prefix\n\n") sys.exit(1) try: opts, args = getopt.getopt(sys.argv[1:], "d:pc:sul:n:o:q", ["working-directory=","project-file", "package-configuration=","strip-files", \
"no-strip-files","lsp-name=","project-name=","output-file=","quiet","db-veri fy", "get-tool-prefix" ]) except: usage()
for o, a in opts: if ( o == "-d" or o == "--working-directory"): WorkingDir=a if ( o == "-p" or o == "--project-file"): UseProjectFile="TRUE" if ( o == "-c" or o == "--package-configuration"): Config = a if ( o == "-l" or o == "--lsp-name"): LSPname = a if ( o == "-n" or o == "--project-name"): print o + " " + a if ( o == "-s" or o == "--strip-files"): StripFiles="TRUE" if ( o == "-u" or o == "--no-strip-files" ): StripFiles="FALSE" if ( o == "-o" or o == "--output-file" ): OutputFile = a if ( o == "-q" or o == "--quiet"): SuppressOutput = "TRUE" if ( o == "--db-verify"): DBVerify="TRUE" if ( o == "--get-tool-prefix"): ToolPrefix="TRUE"
if ( Config == None and ToolPrefix != "TRUE" ): sys.stderr.write("You must supply a Package Config file\n\n") usage()
if (WorkingDir == None): WorkingDir=os.getcwd()
if (Config != None): PackConfig = os.path.split(Config)
myProject = Project()
if ( UseProjectFile == "TRUE" ): myProject.Load(WorkingDir)
elif (LSPname != None): myProject.path=WorkingDir
if ( LSPname != None): LSP=LspDatum(LSPname) if(ToolPrefix == "TRUE"): print LSP.GetArchBin() + "/" + LSP.GetArchPrefix() sys.exit(1) myProject.SetLSP(LSP) myProject.lspname = LSP.GetName()
if ( UseProjectFile == "FALSE" and LSPname == None): myProject.Load(WorkingDir)
myProject.SetKernelType("Prebuilt")
myProjectConfig = ProjectConfig(myProject.GetWorkDir(), myProject)
if ( PackConfig[0] != ""): temp = myProjectConfig.GetWorkDir() myProjectConfig.workdir = PackConfig[0] + "/" if ( not myProjectConfig.LoadConfig(PackConfig[1])): sys.stderr.write("Could not read " + Config + "\n") sys.exit(1) myProjectConfig.workdir = temp
elif ( os.path.isfile(myProjectConfig.GetWorkDir() + "/" + PackConfig[1])): myProjectConfig.LoadConfig(PackConfig[1])
elif ( os.path.isfile(PackConfig[1])): temp = myProjectConfig.workdir myProjectConfig.workdir = os.getcwd() + "/" if ( not myProjectConfig.LoadConfig(PackConfig[1])): sys.stderr.write("Could not read " + Config + "\n") sys.exit(1) myProjectConfig.workdir = temp
else: sys.stderr.write("Could not find " + Config + "\n") sys.exit(1)
MyLSP=myProject.GetLSP()
pinfodirlist = MyLSP.GetPackageInfoDBDirList()
packageSelCfg = PackageSelectorConfig(myProject, pinfodirlist) packageSelCfg.SetConfig(myProjectConfig)
sys.stderr.write("Building Package Database...") packageSelCfg.collectprocess.Wait() sys.stderr.write("Done.\n")
MissingRequiredPackages = packageSelCfg.GetMissingRequiredPackages()
ConflictingPackages = packageSelCfg.GetConflicts()
MissingPackages = packageSelCfg.GetMissingPackages()
if ( MissingRequiredPackages != [] or MissingPackages != [] or ConflictingPackages != [] ): if ( MissingRequiredPackages != [] ): print ("Missing Required Package(s):") for MisReqPack in MissingRequiredPackages: print MisReqPack if ( MissingPackages != [] ): print "Missing Package(s):" for MisPack in MissingPackages: print MisPack if ( ConflictingPackages != [] ): print "Conflicting Package(s):" for ConPack in ConflictingPackages: print MisReqPack sys.stderr.write("Could not reconcile database and package configuration file\n") sys.exit(1)
if ( DBVerify == "TRUE" ): print "Database Verified" sys.exit(1)
Options = TargetOptions(myProject)
Options.SetConfig(myProjectConfig)
if ( StripFiles == "TRUE"): Options.SetOption('strip',1) elif ( StripFiles == "FALSE"): Options.SetOption('strip',0)
if ( OutputFile != None ): Options.SetOption('fsimage', OutputFile)
BuildTarfile = myProjectConfig.GetConfigBuilder( outcmd = _outcmd, errcmd = _errcmd, donecmd = _donecmd)
sys.stderr.write("Building Target Filesystem...")
if (SuppressOutput == "FALSE"): sys.stderr.write("\n")
BuildTarfile.Start()
sys.exit(0)