gen_initramfs.sh (9668097599aa5fb87351bc2263e06a1c24718d40) gen_initramfs.sh (4538f41305c3f2c35463c996663dbf6307030ad7)
1#!/bin/sh
2# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org>
3# Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org>
4#
5# Released under the terms of the GNU GPL
6#
7# Generate a cpio packed initramfs. It uses gen_init_cpio to generate
8# the cpio archive, and then compresses it.

--- 14 unchanged lines hidden (view full) ---

23 <uid> is only meaningful if <cpio_source> is a
24 directory. "squash" forces all files to uid 0.
25 -g <gid> Group ID to map to group ID 0 (root).
26 <gid> is only meaningful if <cpio_source> is a
27 directory. "squash" forces all files to gid 0.
28 <cpio_source> File list or directory for cpio archive.
29 If <cpio_source> is a .cpio file it will be used
30 as direct input to initramfs.
1#!/bin/sh
2# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org>
3# Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org>
4#
5# Released under the terms of the GNU GPL
6#
7# Generate a cpio packed initramfs. It uses gen_init_cpio to generate
8# the cpio archive, and then compresses it.

--- 14 unchanged lines hidden (view full) ---

23 <uid> is only meaningful if <cpio_source> is a
24 directory. "squash" forces all files to uid 0.
25 -g <gid> Group ID to map to group ID 0 (root).
26 <gid> is only meaningful if <cpio_source> is a
27 directory. "squash" forces all files to gid 0.
28 <cpio_source> File list or directory for cpio archive.
29 If <cpio_source> is a .cpio file it will be used
30 as direct input to initramfs.
31 -d Output the default cpio list.
32
33All options except -o and -l may be repeated and are interpreted
34sequentially and immediately. -u and -g states are preserved across
35<cpio_source> options so an explicit "-u 0 -g 0" is required
36to reset the root/group mapping.
37EOF
38}
39
40# awk style field access
41# $1 - field number; rest is argument string
42field() {
43 shift $1 ; echo $1
44}
45
31
32All options except -o and -l may be repeated and are interpreted
33sequentially and immediately. -u and -g states are preserved across
34<cpio_source> options so an explicit "-u 0 -g 0" is required
35to reset the root/group mapping.
36EOF
37}
38
39# awk style field access
40# $1 - field number; rest is argument string
41field() {
42 shift $1 ; echo $1
43}
44
46default_initramfs() {
47 cat <<-EOF >> ${output}
48 # This is a very simple, default initramfs
49
50 dir /dev 0755 0 0
51 nod /dev/console 0600 0 0 c 5 1
52 dir /root 0700 0 0
53 # file /kinit usr/kinit/kinit 0755 0 0
54 # slink /init kinit 0755 0 0
55 EOF
56}
57
58filetype() {
59 local argv1="$1"
60
61 # symlink test must come before file test
62 if [ -L "${argv1}" ]; then
63 echo "slink"
64 elif [ -f "${argv1}" ]; then
65 echo "file"

--- 192 unchanged lines hidden (view full) ---

258 [ "$root_uid" = "-1" ] && root_uid=$(id -u || echo 0)
259 shift
260 ;;
261 "-g") # map $1 to gid=0 (root)
262 root_gid="$1"
263 [ "$root_gid" = "-1" ] && root_gid=$(id -g || echo 0)
264 shift
265 ;;
45filetype() {
46 local argv1="$1"
47
48 # symlink test must come before file test
49 if [ -L "${argv1}" ]; then
50 echo "slink"
51 elif [ -f "${argv1}" ]; then
52 echo "file"

--- 192 unchanged lines hidden (view full) ---

245 [ "$root_uid" = "-1" ] && root_uid=$(id -u || echo 0)
246 shift
247 ;;
248 "-g") # map $1 to gid=0 (root)
249 root_gid="$1"
250 [ "$root_gid" = "-1" ] && root_gid=$(id -g || echo 0)
251 shift
252 ;;
266 "-d") # display default initramfs list
267 default_initramfs
268 ;;
269 "-h")
270 usage
271 exit 0
272 ;;
273 *)
274 case "$arg" in
275 "-"*)
276 unknown_option

--- 35 unchanged lines hidden ---
253 "-h")
254 usage
255 exit 0
256 ;;
257 *)
258 case "$arg" in
259 "-"*)
260 unknown_option

--- 35 unchanged lines hidden ---