From: Mikhail Zaturenskiy <mzaturenskiy.st@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Subject: Re: switching from initrd to initramfs
Date: Wed, 8 Jul 2009 17:56:01 -0500 [thread overview]
Message-ID: <97dd5fd20907081556t8626132sf32c8a6c00c4264c@mail.gmail.com> (raw)
In-Reply-To: <97dd5fd20907081225g2dc4a8dep74407ece12223162@mail.gmail.com>
> I was hoping to convert this working initrd to initramfs before I try
> and create my own initrd, I'm still learning about this process. I got
> this to work yesterday morning, but I'm not sure what changed or what
> I'm doing differently...
> Can somebody help me figure out what's missing?
Never mind, got it! :) For reference, here is what I did:
First I made a custom init file called "init_mz" with the following contents:
#!/bin/sh
echo "hello! processing init_mz"
#Create all the symlinks to /bin/busybox
echo "installing busybox links..."
busybox --install -s
echo "done installing busybox links..."
#Mount things needed by this script
echo "mounting proc..."
mount -t proc proc /proc
echo "done mounting proc..."
echo "mounting sysfs..."
mount -t sysfs sysfs /sys
echo "done mounting sysfs..."
#Create device nodes
echo "creating /dev nodes..."
mknod /dev/null c 1 3
mknod /dev/tty c 5 0
mdev -s
echo "done creating /dev nodes..."
echo "exec-ing sh..."
exec /bin/sh
At this point booting with the "rdinit=/init_mz" kernel argument worked.
Then I removed pretty much everything unnecessary from my root tree,
cross-compiled a busybox v1.14.2 with defconfg (except
statically-linked), and created the few necessary links, so my tree
looks like this:
************
|-- bin
| |-- busybox
| |-- echo -> busybox
| |-- mount -> busybox
| `-- sh -> busybox
|-- dev
|-- init_mz
|-- proc
|-- sbin
|-- sys
`-- usr
|-- bin
`-- sbin
**************
I could probably also get rid of /dev /proc /sbin /sys /usr* /bin/echo
and /bin/mount and just create those on the fly in the init_mz file.
I'm building the initramfs ramdisk using:
find | cpio -ovc | gzip -v9 > ../initramfs.cpio.gz
mkimage -T ramdisk -C gzip -n 'Test Ramdisk Image' -d
../initramfs.cpio.gz ../uCpio
For my kernel arguments I'm using "console=ttyCPM0,9600n8
root=/dev/ram rw rdinit=/init_mz" and that is all! I now have a
functional initramfs that's 0.97MB large.
For a while I was confused because "ls" output had file names with
strange symbols such as "1;34mbin0m" for "bin", but I figured out that
it's because supposedly those represent font colors and I'm using
HyperTerminal which doesn't support them.
I hope somebody will find this useful.
Mikhail Zaturenskiy
prev parent reply other threads:[~2009-07-08 22:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-08 19:25 switching from initrd to initramfs Mikhail Zaturenskiy
2009-07-08 22:56 ` Mikhail Zaturenskiy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=97dd5fd20907081556t8626132sf32c8a6c00c4264c@mail.gmail.com \
--to=mzaturenskiy.st@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).