没有找到linuxrc却发现Init

#!/bin/sh

[ -d /dev ] || mkdir -m 0755 /dev
[ -d /root ] || mkdir -m 0700 /root
[ -d /sys ] || mkdir /sys
[ -d /proc ] || mkdir /proc
[ -d /tmp ] || mkdir /tmp
mkdir -p /var/lock
mount -t sysfs -o nodev,noexec,nosuid none /sys 
mount -t proc -o nodev,noexec,nosuid none /proc

grep -q ‘\<quiet\>‘ /proc/cmdline || echo "Loading, please wait..."

# Note that this only becomes /dev on the real filesystem if udev‘s scripts
# are used; which they will be, but it‘s worth pointing out
if ! mount -t devtmpfs -o mode=0755 none /dev; then
 mount -t tmpfs -o mode=0755 none /dev
 mknod -m 0600 /dev/console c 5 1
 mknod /dev/null c 1 3
fi
mkdir /dev/pts
mount -t devpts -o noexec,nosuid,gid=5,mode=0620 none /dev/pts || true
> /dev/.initramfs-tools
mkdir /dev/.initramfs

# Export the dpkg architecture
export DPKG_ARCH=
. /conf/arch.conf

# Set modprobe env
export MODPROBE_OPTIONS="-qb"

# Export relevant variables
export ROOT=
export ROOTDELAY=
export ROOTFLAGS=
export ROOTFSTYPE=
export IPOPTS=
export HWADDR=
export break=
export init=/sbin/init
export quiet=n
export readonly=y
export rootmnt=/root
export debug=
export panic=
export blacklist=
export resume_offset=

# Bring in the main config
. /conf/initramfs.conf
for conf in conf/conf.d/*; do
 [ -f ${conf} ] && . ${conf}
done
. /scripts/functions

# Parse command line options
for x in $(cat /proc/cmdline); do
 case $x in
 init=*)
  init=${x#init=}
  ;;
 root=*)
  ROOT=${x#root=}
  case $ROOT in
  LABEL=*)
   ROOT="${ROOT#LABEL=}"

# support / in LABEL= paths (escape to \x2f)
   case "${ROOT}" in
   *[/]*)
   if [ -x "$(command -v sed)" ]; then
    ROOT="$(echo ${ROOT} | sed ‘s,/,\\x2f,g‘)"
   else
    if [ "${ROOT}" != "${ROOT#/}" ]; then
     ROOT="\x2f${ROOT#/}"
    fi
    if [ "${ROOT}" != "${ROOT%/}" ]; then
     ROOT="${ROOT%/}\x2f"
    fi
    IFS=‘/‘
    newroot=
    for s in $ROOT; do
     if [ -z "${newroot}" ]; then
      newroot="${s}"
     else
      newroot="${newroot}\\x2f${s}"
     fi
    done
    unset IFS
    ROOT="${newroot}"
   fi
   esac
   ROOT="/dev/disk/by-label/${ROOT}"
   ;;
  UUID=*)
   ROOT="/dev/disk/by-uuid/${ROOT#UUID=}"
   ;;
  /dev/nfs)
   [ -z "${BOOT}" ] && BOOT=nfs
   ;;
  esac
  ;;
 rootflags=*)
  ROOTFLAGS="-o ${x#rootflags=}"
  ;;
 rootfstype=*)
  ROOTFSTYPE="${x#rootfstype=}"
  ;;
 rootdelay=*)
  ROOTDELAY="${x#rootdelay=}"
  case ${ROOTDELAY} in
  *[![:digit:].]*)
   ROOTDELAY=
   ;;
  esac
  ;;
 resumedelay=*)
  RESUMEDELAY="${x#resumedelay=}"
  ;;
 loop=*)
  LOOP="${x#loop=}"
  ;;
 loopflags=*)
  LOOPFLAGS="-o ${x#loopflags=}"
  ;;
 loopfstype=*)
  LOOPFSTYPE="${x#loopfstype=}"
  ;;
 cryptopts=*)
  cryptopts="${x#cryptopts=}"
  ;;
 nfsroot=*)
  NFSROOT="${x#nfsroot=}"
  ;;
 netboot=*)
  NETBOOT="${x#netboot=}"
  ;;
 ip=*)
  IPOPTS="${x#ip=}"
  ;;
 hwaddr=*)
  HWADDR="${x#hwaddr=}"
  ;;
 boot=*)
  BOOT=${x#boot=}
  ;;
 resume=*)
  RESUME="${x#resume=}"
  ;;
 resume_offset=*)
  resume_offset="${x#resume_offset=}"
  ;;
 noresume)
  noresume=y
  ;;
 panic=*)
  panic="${x#panic=}"
  case ${panic} in
  *[![:digit:].]*)
   panic=
   ;;
  esac
  ;;
 quiet)
  quiet=y
  ;;
 ro)
  readonly=y
  ;;
 rw)
  readonly=n
  ;;
 debug)
  debug=y
  quiet=n
  exec >/dev/.initramfs/initramfs.debug 2>&1
  set -x
  ;;
 debug=*)
  debug=y
  quiet=n
  set -x
  ;;
 break=*)
  break=${x#break=}
  ;;
 break)
  break=premount
  ;;
 blacklist=*)
  blacklist=${x#blacklist=}
  ;;
 netconsole=*)
  netconsole=${x#netconsole=}
  ;;
 esac
done

if [ -z "${noresume}" ]; then
 export resume=${RESUME}
else
 export noresume
fi

[ -n "${netconsole}" ] && modprobe netconsole netconsole=${netconsole}

maybe_break top

# export BOOT variable value for compcache,
# so we know if we run from casper
export BOOT

# Don‘t do log messages here to avoid confusing usplash
run_scripts /scripts/init-top

maybe_break modules
log_begin_msg "Loading essential drivers..."
load_modules
log_end_msg

maybe_break premount
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-premount"
run_scripts /scripts/init-premount
[ "$quiet" != "y" ] && log_end_msg

maybe_break mount
log_begin_msg "Mounting root file system..."
. /scripts/${BOOT}
parse_numeric ${ROOT}
mountroot
log_end_msg

maybe_break bottom
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-bottom"
run_scripts /scripts/init-bottom
[ "$quiet" != "y" ] && log_end_msg

# Move virtual filesystems over to the real filesystem
mount -n -o move /sys ${rootmnt}/sys
mount -n -o move /proc ${rootmnt}/proc

# Check init bootarg
if [ -n "${init}" ] && [ ! -x "${rootmnt}${init}" ]; then
 echo "Target filesystem doesn‘t have ${init}."
 init=
fi

# Search for valid init
if [ -z "${init}" ] ; then
 for init in /sbin/init /etc/init /bin/init /bin/sh; do
  if [ ! -x "${rootmnt}${init}" ]; then
   continue
  fi
  break
 done
fi

# No init on rootmount
if [ ! -x "${rootmnt}${init}" ]; then
 panic "No init found. Try passing init= bootarg."
fi

# Confuses /etc/init.d/rc
if [ -n ${debug} ]; then
 unset debug
fi

# Chain to real filesystem
maybe_break init
exec run-init ${rootmnt} ${init} "[email protected]" <${rootmnt}/dev/console >${rootmnt}/dev/console 2>&1
panic "Could not execute run-init."

时间: 2024-08-08 05:37:50

没有找到linuxrc却发现Init的相关文章

SCCM 2012 R2 实战系列(六)—配置发现

安装好SCCM之后,我们可以在站点之中验证一下是否有报错,如果没有的话就证明SCCM已经正确安装完成了,SCCM安装完成后我们首先需要做的事情就是配置发现,配置好了发现之后在SCCM管理控制台中能看到客户端计算机和用户才能够进行管理 1.在管理->概述->层次结构配置->发现方法中找到AD林发现,这些发现方法大多都是默认禁用的,我们需要启用发现,然后让SCCM检测到AD中信息才能在SCCM中看到AD中的用户和客户端 2.勾选启用AD林发现 3.右键AD用户发现,点击属性 4.勾选启用AD

Android Init进程命令的执行和服务的启动

这里开始分析init进程中配置文件的解析,在配置文件中的命令的执行和服务的启动. 首先init是一个可执行文件,它的对应的Makfile是init/Android.mk. Android.mk定义了init程序在编译的时候,使用了哪些源码,以及生成方式.当init程序生成之后,最终会放到/init,即根目录的init文件.通常所说的init进程就是执行这个init程序. 执行这个init程序的代码是在KERNEL/init/main.c文件中的kernel_init()函数里,当kernel把一

adb push init.rc /

http://blog.csdn.net/jumper511/article/details/28856249 修改Android init.rc文件后,需要将修改后的文件上传到手机,但是发下如下问题 D:\test>adb push init.rc / failed to copy 'init.rc' to '//init.rc': Read-only file system 解决办法如下 D:\test>adb root adbd is already running as root D:

OC重写init方法

在创建一个对象的时候我们经常会用到init方法,单单是init只能是初始化,当我们在初始化的时候想要给这个对象加上默认的东西的时候, 系统提供的init方法就不能满足我们的需要,这时,就需要我们自己去重写init方法: 通常在使用init方法的时候,系统先会在自己这个类中查询是否实现(重写)这个方法,如果没有实现,就会逐层向上面的父类查找,直到 找到实现了的init方法,其他方法的执行顺序也是这样. 1.首先创建一个Person 类和一个Car 类 2.在Car类里面定义属性(我们要的效果是输出

S5PV210-kernel-内核启动过程分析

1.1.内核启动过程分析前的准备 1.拿到一个内核源码时,先目录下的无用文件删除 2.建立SI工程 3.makefile (1)makefile中不详细的去分析,几个关键的地方,makefile开始部分是kernel的版本号,这个版本号比较重要,因为在模块化驱动安装时会需要用到,要注意会查,会改,版本号在makefile中,改直接改的就行 (2)kernel顶层的makefile中定义的两个变量很重要,一个是ARCH,一个CROSS,ARCH表示我们当前的配置编译路径,如果我们的ARCH =AR

根文件系统挂载过程

目录 注册挂载rootfs文件系统 解压initramfs到rootfs中 prepare_namespace挂载磁盘上的文件系统 注册挂载rootfs文件系统 首先是rootfs的注册和挂载,rootfs作为一切后续文件操作的基石. start_kernel vfs_caches_init mnt_init init_rootfs注册rootfs文件系统 init_mount_tree 挂载rootfs文件系统 vfs_kern_mount mount_fs type->mount其实是roo

第4阶段——制作根文件系统之分析init_post()如何启动第1个程序(2)

本节目标: (1) 了解busybox(init进程和命令都放在busybox中) (2) 创建SI工程,分析busybox源码来知道init进程做了哪些事情 (3)  分析busybox中init进程 init_main() (3.1)熟悉init进程的inittab配置文件(位于/etc/inittab) (3.2)熟悉inittab配置文件中不同action的子进程区别 (3.3)了解init进程如何读取分析inittab,以及运行inittab文件中的各个子进程 (4) 了解制作一个最小

精通initramfs构建step by step

http://hi.baidu.com/jonathan2004/blog/item/db7bf38aad11759ea4c2721d.html 精通initramfs构建step by step (1)--hello world 2009-12-08 19:19 一.initramfs是什么 在2.6版本的linux内核中,都包含一个压缩过的cpio格式的打包文件.当内核启动时,会从这个打包文件中导出文件到内核的rootfs文件系统, 然后内核检查rootfs中是否包含有init文件,如果有则

Linux2.6 内核的 Initrd 机制解析

Linux 的 initrd 技术是一个非常普遍使用的机制,linux2.6 内核的 initrd 的文件格式由原来的文件系统镜像文件转变成了 cpio 格式,变化不仅反映在文件格式上, linux 内核对这两种格式的 initrd 的处理有着截然的不同.本文首先介绍了什么是 initrd 技术,然后分别介绍了 Linux2.4 内核和 2.6 内核的 initrd 的处理流程.最后通过对 Linux2.6 内核的 initrd 处理部分代码的分析,使读者可以对 initrd 技术有一个全面的认