Manual initrd/busybox for qemu/i386

博客内容描述了如何在i386 32位环境中配置和构建BusyBox,包括设置CFLAGS、CXXFLAGS和LDFLAGS,运行'make menuconfig',进行静态链接,并执行'make install'将BusyBox安装到根文件系统中。此外,还展示了QEMU模拟器启动内核和BusyBox根文件系统的流程。


###  for  i386 32bit build  

[lake@localhost busybox-1.33.0]$ CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 make defconfig

[lake@localhost busybox-1.33.0]$ CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32     make  menuconfig  --->  Static link busybox 
scripts/kconfig/mconf Config.in
#
# using defaults found in .config
#


*** End of configuration.
*** Execute 'make' to build the project or try 'make help'.

[lake@localhost busybox-1.33.0]$

[lake@localhost busybox-1.33.0]$ CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32     make    -j32
  ...............
  
  AR      shell/lib.a
  AR      libbb/lib.a
  LINK    busybox_unstripped
Static linking against glibc, can't use --gc-sections
Trying libraries: crypt m resolv rt
 Library crypt is not needed, excluding it
 Library m is needed, can't exclude it (yet)
 Library resolv is needed, can't exclude it (yet)
 Library rt is not needed, excluding it
 Library m is needed, can't exclude it (yet)
 Library resolv is needed, can't exclude it (yet)
Final link with: m resolv
[lake@localhost busybox-1.33.0]$ CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32     make     install
  ./_install//bin/arch -> busybox
  ............
  ./_install//usr/sbin/ubiupdatevol -> ../../bin/busybox
  ./_install//usr/sbin/udhcpd -> ../../bin/busybox


--------------------------------------------------
You will probably need to make your busybox binary
setuid root to ensure all configured applets will
work properly.
--------------------------------------------------

[lake@localhost busybox-1.33.0]$ cd _install/
[lake@localhost _install]$ ls
bin  linuxrc  sbin  usr
[lake@localhost _install]$ ls -l
total 12
drwxrwxr-x 2 lake sys 4096 Oct 27 08:51 bin
lrwxrwxrwx 1 lake sys   11 Oct 27 08:51 linuxrc -> bin/busybox
drwxrwxr-x 2 lake sys 4096 Oct 27 08:51 sbin
drwxrwxr-x 4 lake sys 4096 Oct 27 08:51 usr
[lake@localhost _install]$ mkdir -p bin sbin etc proc sys usr/bin usr/sbin
[lake@localhost _install]$ ls
bin  etc  linuxrc  proc  sbin  sys  usr
[lake@localhost _install]$ cat  >^Cetc/init
[lake@localhost _install]$ ls  -l
total 24
drwxrwxr-x 2 lake sys 4096 Oct 27 08:51 bin
drwxrwxr-x 2 lake sys 4096 Oct 27 08:52 etc
lrwxrwxrwx 1 lake sys   11 Oct 27 08:51 linuxrc -> bin/busybox
drwxrwxr-x 2 lake sys 4096 Oct 27 08:52 proc
drwxrwxr-x 2 lake sys 4096 Oct 27 08:51 sbin
drwxrwxr-x 2 lake sys 4096 Oct 27 08:52 sys
drwxrwxr-x 4 lake sys 4096 Oct 27 08:51 usr
[lake@localhost _install]$ cat  > init
#!/bin/sh

mount -t proc none /proc
mount -t sysfs none /sys
/bin/mount -t devtmpfs devtmpfs /dev

echo -e "\nBoot took $(cut -d' ' -f1 /proc/uptime) seconds\n"
exec /bin/sh   ####   better to /etc/inittab    /sbin/getty -n -l /bin/sh  115200  ttyS0 vt100
[lake@localhost _install]$ chmod u+x init
[lake@localhost _install]$   
[lake@localhost _install]$  find . -print0 | cpio --null -ov --format=newc | gzip -9  >  ../../rootfs-kernel4.4x-busybox1.33-x86.cpio.gz
.
./etc

./proc
./linuxrc
./init
.............
./usr/sbin/popmaildir
./usr/sbin/tftpd
4275 blocks
[lake@localhost _install]$

[lake@localhost lfs]$ qemu-system-x86_64    -kernel ./linux-stable/arch/x86/boot/bzImage  -initrd ./rootfs-kernel4.4x-busybox1.33-x86.cpio.gz   -nographic -append "console=ttyS0"
SeaBIOS (version rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org)


iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+07F90770+07EF0770 CA00

Booting from ROM...
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.4.230+ (lake@localhost) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #6 1
[    0.000000] x86/fpu: Legacy x87 FPU detected.
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000007fdffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000007fe0000-0x0000000007ffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[    0.000000] Notice: NX (Execute Disable) protection cannot be enabled: non-PAE kernel!
[    0.000000] SMBIOS 2.8 present.
[    0.000000] e820: last_pfn = 0x7fe0 max_arch_pfn = 0x100000
[    0.000000] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WC  UC- WT
[    0.000000] found SMP MP-table at [mem 0x000f5ab0-0x000f5abf] mapped at [c00f5ab0]
[    0.000000] Scanning 1 areas for low memory corruption
[    0.000000] RAMDISK: [mem 0x07ecd000-0x07fdffff]
[    0.000000] ACPI: Early table checksum verification disabled
[    0.000000] ACPI: RSDP 0x00000000000F58D0 000014 (v00 BOCHS )
[    0.000000] ACPI: RSDT 0x0000000007FE156F 000030 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: FACP 0x0000000007FE144B 000074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)
[    0.000000] ACPI: DSDT 0x0000000007FE0040 00140B (v01 BOCHS  BXPCDSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: FACS 0x0000000007FE0000 000040
[    0.000000] ACPI: APIC 0x0000000007FE14BF 000078 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)
[    0.000000] ACPI: HPET 0x0000000007FE1537 000038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)
[    0.000000] 0MB HIGHMEM available.
[    0.000000] 127MB LOWMEM available.
[    0.000000]   mapped low ram: 0 - 07fe0000
[    0.000000]   low ram: 0 - 07fe0000
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000001000-0x0000000000ffffff]
[    0.000000]   Normal   [mem 0x0000000001000000-0x0000000007fdffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000001000-0x000000000009efff]
[    0.000000]   node   0: [mem 0x0000000000100000-0x0000000007fdffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x0000000007fdffff]
[    0.000000] Using APIC driver default
[    0.000000] ACPI: PM-Timer IO Port: 0x608
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
[    0.000000] IOAPIC[0]: apic_id 0, version 32, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] smpboot: Allowing 1 CPUs, 0 hotplug CPUs
[    0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
[    0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[    0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
[    0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
[    0.000000] e820: [mem 0x08000000-0xfffbffff] available for PCI devices
[    0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419s
[    0.000000] setup_percpu: NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:1 nr_node_ids:1
[    0.000000] PERCPU: Embedded 17 pages/cpu @c7db9000 s39052 r0 d30580 u69632
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32382
[    0.000000] Kernel command line: console=ttyS0
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Initializing CPU#0
[    0.000000] Initializing HighMem for node 0 (00000000:00000000)
[    0.000000] Memory: 115968K/130552K available (7646K kernel code, 642K rwdata, 2604K rodata, 624K init, 588K bss)
[    0.000000] virtual kernel memory layout:
[    0.000000]     fixmap  : 0xfff16000 - 0xfffff000   ( 932 kB)
[    0.000000]     pkmap   : 0xff800000 - 0xffc00000   (4096 kB)
[    0.000000]     vmalloc : 0xc87e0000 - 0xff7fe000   ( 880 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc7fe0000   ( 127 MB)
[    0.000000]       .init : 0xc1aa6000 - 0xc1b42000   ( 624 kB)
[    0.000000]       .data : 0xc1777e58 - 0xc1aa4980   (3250 kB)
[    0.000000]       .text : 0xc1000000 - 0xc1777e58   (7647 kB)
[    0.000000] Checking if this processor honours the WP bit even in supervisor mode...Ok.
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  Build-time adjustment of leaf fanout to 32.
[    0.000000]  RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=1
[    0.000000] NR_IRQS:2304 nr_irqs:256 16
[    0.000000] Console: colour VGA+ 80x25
[    0.000000] console [ttyS0] enabled
[    0.000000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604467 ns
[    0.000000] tsc: Fast TSC calibration failed
[    0.000000] tsc: Unable to calibrate against PIT
[    0.000000] tsc: using HPET reference calibration
[    0.000000] tsc: Detected 2399.871 MHz processor
[    0.018373] Calibrating delay loop (skipped), value calculated using timer frequency.. 4799.74 BogoMIPS (lpj=239)
[    0.020546] pid_max: default: 32768 minimum: 301
[    0.022313] ACPI: Core revision 20150930
[    0.126472] ACPI: 1 ACPI AML tables successfully acquired and loaded
[    0.132121] Security Framework initialized
[    0.133211] SELinux:  Initializing.
[    0.137673] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.138165] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.213839] Initializing cgroup subsys freezer
[    0.228852] mce: CPU supports 10 MCE banks
[    0.241805] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
[    0.242151] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
[    0.244204] Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
[    0.246757] Spectre V2 : Spectre mitigation: LFENCE not serializing, switching to generic retpoline
[    0.247156] Spectre V2 : Mitigation: Full generic retpoline
[    0.248103] Spectre V2 : Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch
[    0.249328] Speculative Store Bypass: Vulnerable
[    0.675874] Freeing SMP alternatives memory: 32K
[    0.721646] Enabling APIC mode:  Flat.  Using 1 I/O APICs
[    0.741000] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.857000] smpboot: CPU0: AMD QEMU Virtual CPU version 2.5+ (family: 0x6, model: 0x6, stepping: 0x3)
[    0.863687] Performance Events: Broken PMU hardware detected, using software events only.
[    0.866123] Failed to access perfctr msr (MSR c0010007 is 0)
[    0.898256] Huh? What family is it: 0x6?!
[    0.898648] MCE: In-kernel MCE decoding enabled.
[    0.899726] x86: Booted up 1 node, 1 CPUs
[    0.900397] smpboot: Total of 1 processors activated (4799.74 BogoMIPS)
[    0.957130] devtmpfs: initialized
[    0.993392] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
[    0.995119] futex hash table entries: 256 (order: 2, 16384 bytes)
[    1.019670] RTC time:  1:09:23, date: 10/27/21
[    1.039571] kworker/u2:0 (13) used greatest stack depth: 7140 bytes left
[    1.054145] NET: Registered protocol family 16
[    1.088354] cpuidle: using governor ladder
[    1.089468] cpuidle: using governor menu
[    1.093718] ACPI: bus type PCI registered
[    1.107234] PCI: PCI BIOS revision 2.10 entry at 0xfd20c, last bus=0
[    1.108078] PCI: Using configuration type 1 for base access
[    1.123657] kworker/u2:1 (34) used greatest stack depth: 7056 bytes left
[    1.262207] kworker/u2:1 (236) used greatest stack depth: 7052 bytes left
[    1.301120] kworker/u2:0 (293) used greatest stack depth: 7032 bytes left
[    1.337879] ACPI: Added _OSI(Module Device)
[    1.338121] ACPI: Added _OSI(Processor Device)
[    1.338430] ACPI: Added _OSI(3.0 _SCP Extensions)
[    1.339048] ACPI: Added _OSI(Processor Aggregator Device)
[    1.426460] ACPI: Interpreter enabled
[    1.430905] ACPI: (supports S0 S3 S4 S5)
[    1.431233] ACPI: Using IOAPIC for interrupt routing
[    1.434034] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    1.586900] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    1.589840] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI]
[    1.591717] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM
[    1.594282] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space und.
[    1.599144] acpi resource window ([0x100000000-0x17fffffff] ignored, not CPU addressable)
[    1.606936] PCI host bridge to bus 0000:00
[    1.608000] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
[    1.608657] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
[    1.609314] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
[    1.610126] pci_bus 0000:00: root bus resource [mem 0x08000000-0xfebfffff window]
[    1.611516] pci_bus 0000:00: root bus resource [bus 00-ff]
[    1.645126] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io  0x01f0-0x01f7]
[    1.645814] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io  0x03f6]
[    1.646224] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io  0x0170-0x0177]
[    1.648043] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io  0x0376]
[    1.653734] pci 0000:00:01.3: quirk: [io  0x0600-0x063f] claimed by PIIX4 ACPI
[    1.654147] pci 0000:00:01.3: quirk: [io  0x0700-0x070f] claimed by PIIX4 SMB
[    1.711330] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
[    1.714374] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
[    1.716102] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
[    1.717679] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
[    1.718690] ACPI: PCI Interrupt Link [LNKS] (IRQs *9)
[    1.728000] ACPI: Enabled 2 GPEs in block 00 to 0F
[    1.748000] vgaarb: setting as boot device: PCI:0000:00:02.0
[    1.748000] vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none
[    1.748159] vgaarb: loaded
[    1.748788] vgaarb: bridge control possible 0000:00:02.0
[    1.755774] SCSI subsystem initialized
[    1.764525] ACPI: bus type USB registered
[    1.767844] usbcore: registered new interface driver usbfs
[    1.770526] usbcore: registered new interface driver hub
[    1.771963] usbcore: registered new device driver usb
[    1.776356] pps_core: LinuxPPS API ver. 1 registered
[    1.776835] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    1.778587] PTP clock support registered
[    1.784366] PCI: Using ACPI for IRQ routing
[    1.822082] NetLabel: Initializing
[    1.822422] NetLabel:  domain hash size = 128
[    1.822852] NetLabel:  protocols = UNLABELED CIPSOv4
[    1.829490] NetLabel:  unlabeled traffic allowed by default
[    1.831421] HPET: 3 timers in total, 0 timers will be used for per-cpu timer
[    1.833337] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
[    1.834258] hpet0: 3 comparators, 64-bit 100.000000 MHz counter
[    1.842054] amd_nb: Cannot enumerate AMD northbridges
[    1.844023] clocksource: Switched to clocksource hpet
[    2.196492] kworker/u2:1 (453) used greatest stack depth: 6904 bytes left
[    2.198521] pnp: PnP ACPI init
[    2.222014] pnp: PnP ACPI: found 6 devices
[    2.354198] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
[    2.361079] NET: Registered protocol family 2
[    2.386756] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    2.388056] TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
[    2.389049] TCP: Hash tables configured (established 1024 bind 1024)
[    2.391808] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    2.392806] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    2.399869] NET: Registered protocol family 1
[    2.409845] RPC: Registered named UNIX socket transport module.
[    2.410600] RPC: Registered udp transport module.
[    2.411010] RPC: Registered tcp transport module.
[    2.411892] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    2.413197] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[    2.413838] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[    2.414954] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[    2.437564] Trying to unpack rootfs image as initramfs...
[    2.642736] Freeing initrd memory: 1100K
[    2.655278] Scanning for low memory corruption every 60 seconds
[    2.678703] audit: initializing netlink subsys (disabled)
[    2.682738] audit: type=2000 audit(1635296964.681:1): initialized
[    2.700597] HugeTLB registered 4 MB page size, pre-allocated 0 pages
[    2.778629] VFS: Disk quotas dquot_6.6.0
[    2.783884] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    2.817484] NFS: Registering the id_resolver key type
[    2.822969] Key type id_resolver registered
[    2.823642] Key type id_legacy registered
[    2.824554] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    2.837531] ntfs: driver 2.1.32 [Flags: R/O].
[    2.841890] fuse init (API version 7.23)
[    2.881779] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    2.883335] io scheduler noop registered
[    2.883879] io scheduler deadline registered
[    2.885844] io scheduler cfq registered (default)
[    2.892576] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[    2.904282] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
[    2.908440] ACPI: Power Button [PWRF]
[    2.925777] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    2.959125] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[    2.980194] Non-volatile memory driver v1.3
[    2.983148] Linux agpgart interface v0.103
[    2.995047] [drm] Initialized drm 1.1.0 20060810
[    3.124805] brd: module loaded
[    3.166918] loop: module loaded
[    3.216919] scsi host0: ata_piix
[    3.222853] scsi host1: ata_piix
[    3.225515] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc040 irq 14
[    3.226324] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc048 irq 15
[    3.251332] e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
[    3.251901] e100: Copyright(c) 1999-2006 Intel Corporation
[    3.254993] e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
[    3.255730] e1000: Copyright (c) 1999-2006 Intel Corporation.
[    3.429300] ata2.00: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/100
[    3.447714] ata2.00: configured for MWDMA2
[    3.530494] scsi 1:0:0:0: CD-ROM            QEMU     QEMU DVD-ROM     2.5+ PQ: 0 ANSI: 5
[    3.579156] sr 1:0:0:0: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[    3.580970] cdrom: Uniform CD-ROM driver Revision: 3.20
[    3.613717] sr 1:0:0:0: Attached scsi generic sg0 type 5
[    3.646669] tsc: Refined TSC clocksource calibration: 2399.984 MHz
[    3.647513] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x22982891228, max_idle_ns: 440795308081 ns
[    4.009037] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
[    4.337955] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 52:54:00:12:34:56
[    4.339771] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
[    4.342927] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[    4.343622] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    4.346638] PPP generic driver version 2.4.2
[    4.354806] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    4.355961] ehci-pci: EHCI PCI platform driver
[    4.357896] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    4.358925] ohci-pci: OHCI PCI platform driver
[    4.360655] uhci_hcd: USB Universal Host Controller Interface driver
[    4.362833] usbcore: registered new interface driver usblp
[    4.364969] usbcore: registered new interface driver usb-storage
[    4.369903] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[    4.385833] serio: i8042 KBD port at 0x60,0x64 irq 1
[    4.387874] serio: i8042 AUX port at 0x60,0x64 irq 12
[    4.396647] mousedev: PS/2 mouse device common for all mice
[    4.409020] rtc_cmos 00:00: RTC can wake from S4
[    4.420619] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1
[    4.430091] rtc_cmos 00:00: rtc core: registered rtc_cmos as rtc0
[    4.438207] rtc_cmos 00:00: alarms up to one day, y3k, 114 bytes nvram, hpet irqs
[    4.455449] device-mapper: ioctl: 4.34.0-ioctl (2015-10-28) initialised: dm-devel@redhat.com
[    4.461020] hidraw: raw HID events driver (C) Jiri Kosina
[    4.482999] usbcore: registered new interface driver usbhid
[    4.483895] usbhid: USB HID core driver
[    4.488676] Netfilter messages via NETLINK v0.30.
[    4.491948] nf_conntrack version 0.5.0 (1829 buckets, 7316 max)
[    4.501352] ctnetlink v0.93: registering with nfnetlink.
[    4.515798] ip_tables: (C) 2000-2006 Netfilter Core Team
[    4.526883] Initializing XFRM netlink socket
[    4.528263] NET: Registered protocol family 17
[    4.531742] Key type dns_resolver registered
[    4.539500] Using IPI No-Shortcut mode
[    4.545662] registered taskstats version 1
[    4.561439]   Magic number: 9:772:155
[    4.562620] bdi 1:7: hash matches
[    4.564754] console [netcon0] enabled
[    4.565450] netconsole: network logging started
[    4.858232] Freeing unused kernel memory: 624K
[    4.863988] clocksource: Switched to clocksource tsc
[    4.865920] Write protecting the kernel text: 7648k
[    4.867320] Write protecting the kernel read-only data: 2608k

Boot took 5.15 seconds

/bin/sh: can't access tty; job control turned off
/ # [    5.271469] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3

/ #
/ # lsmod
[   10.985574] lsmod (935) used greatest stack depth: 6532 bytes left
/ # ifconfig
/ # ps
PID   USER     TIME  COMMAND
    1 0         0:03 /bin/sh
    2 0         0:00 [kthreadd]
    3 0         0:00 [ksoftirqd/0]
    4 0         0:00 [kworker/0:0]
    5 0         0:00 [kworker/0:0H]
    6 0         0:00 [kworker/u2:0]
    7 0         0:00 [rcu_sched]
    8 0         0:00 [rcu_bh]
    9 0         0:00 [migration/0]
   10 0         0:00 [kdevtmpfs]
   11 0         0:00 [netns]
   12 0         0:00 [kworker/u2:1]
   14 0         0:00 [perf]
  285 0         0:00 [kworker/u2:2]
  336 0         0:00 [writeback]
  338 0         0:00 [crypto]
  339 0         0:00 [bioset]
  341 0         0:00 [kblockd]
  426 0         0:00 [ata_sff]
  446 0         0:00 [md]
  452 0         0:00 [kworker/0:1]
  544 0         0:00 [rpciod]
  565 0         0:00 [kswapd0]
  566 0         0:00 [vmstat]
  637 0         0:00 [fsnotify_mark]
  652 0         0:00 [nfsiod]
  659 0         0:00 [cifsiod]
  710 0         0:00 [acpi_thermal_pm]
  731 0         0:00 [bioset]
  732 0         0:00 [bioset]
  733 0         0:00 [bioset]
  734 0         0:00 [bioset]
  735 0         0:00 [bioset]
  736 0         0:00 [bioset]
  737 0         0:00 [bioset]
  738 0         0:00 [bioset]
  739 0         0:00 [bioset]
  740 0         0:00 [bioset]
  741 0         0:00 [bioset]
  742 0         0:00 [bioset]
  743 0         0:00 [bioset]
  744 0         0:00 [bioset]
  745 0         0:00 [bioset]
  746 0         0:00 [bioset]
  780 0         0:00 [bioset]
  783 0         0:00 [bioset]
  786 0         0:00 [bioset]
  789 0         0:00 [bioset]
  792 0         0:00 [bioset]
  795 0         0:00 [bioset]
  798 0         0:00 [bioset]
  801 0         0:00 [bioset]
  819 0         0:00 [scsi_eh_0]
  820 0         0:00 [scsi_tmf_0]
  823 0         0:00 [scsi_eh_1]
  824 0         0:00 [scsi_tmf_1]
  827 0         0:00 [kworker/u2:3]
  834 0         0:00 [kworker/u2:4]
  838 0         0:00 [bioset]
  843 0         0:00 [kworker/0:2]
  874 0         0:00 [kpsmoused]
  925 0         0:00 [deferwq]
  927 0         0:00 [kworker/0:3]
  937 0         0:00 ps
/ # ls -l /dev/
total 0
crw-------    1 0        0          10, 235 Oct 27 01:09 autofs
drwxr-xr-x    2 0        0               60 Oct 27 01:09 bsg
crw-------    1 0        0           5,   1 Oct 27 01:09 console
drwxr-xr-x    3 0        0               60 Oct 27 01:09 cpu
crw-------    1 0        0          10,  62 Oct 27 01:09 cpu_dma_latency
crw-rw-rw-    1 0        0           1,   7 Oct 27 01:09 full
crw-------    1 0        0          10, 229 Oct 27 01:09 fuse
crw-------    1 0        0          10, 228 Oct 27 01:09 hpet
crw-------    1 0        0          10, 183 Oct 27 01:09 hwrng
drwxr-xr-x    2 0        0              140 Oct 27 01:09 input
crw-------    1 0        0           1,   2 Oct 27 01:09 kmem
crw-r--r--    1 0        0           1,  11 Oct 27 01:09 kmsg
crw-------    1 0        0          10, 237 Oct 27 01:09 loop-control
brw-------    1 0        0           7,   0 Oct 27 01:09 loop0
brw-------    1 0        0           7,   1 Oct 27 01:09 loop1
brw-------    1 0        0           7,   2 Oct 27 01:09 loop2
brw-------    1 0        0           7,   3 Oct 27 01:09 loop3
brw-------    1 0        0           7,   4 Oct 27 01:09 loop4
brw-------    1 0        0           7,   5 Oct 27 01:09 loop5
brw-------    1 0        0           7,   6 Oct 27 01:09 loop6
brw-------    1 0        0           7,   7 Oct 27 01:09 loop7
drwxr-xr-x    2 0        0               60 Oct 27 01:09 mapper
crw-------    1 0        0          10, 227 Oct 27 01:09 mcelog
crw-------    1 0        0           1,   1 Oct 27 01:09 mem
crw-------    1 0        0          10,  59 Oct 27 01:09 memory_bandwidth
crw-------    1 0        0          10,  61 Oct 27 01:09 network_latency
crw-------    1 0        0          10,  60 Oct 27 01:09 network_throughput
crw-rw-rw-    1 0        0           1,   3 Oct 27 01:09 null
crw-------    1 0        0          10, 144 Oct 27 01:09 nvram
crw-------    1 0        0           1,   4 Oct 27 01:09 port
crw-------    1 0        0         108,   0 Oct 27 01:09 ppp
crw-rw-rw-    1 0        0           5,   2 Oct 27 01:09 ptmx
brw-------    1 0        0           1,   0 Oct 27 01:09 ram0
brw-------    1 0        0           1,   1 Oct 27 01:09 ram1
brw-------    1 0        0           1,  10 Oct 27 01:09 ram10
brw-------    1 0        0           1,  11 Oct 27 01:09 ram11
brw-------    1 0        0           1,  12 Oct 27 01:09 ram12
brw-------    1 0        0           1,  13 Oct 27 01:09 ram13
brw-------    1 0        0           1,  14 Oct 27 01:09 ram14
brw-------    1 0        0           1,  15 Oct 27 01:09 ram15
brw-------    1 0        0           1,   2 Oct 27 01:09 ram2
brw-------    1 0        0           1,   3 Oct 27 01:09 ram3
brw-------    1 0        0           1,   4 Oct 27 01:09 ram4
brw-------    1 0        0           1,   5 Oct 27 01:09 ram5
brw-------    1 0        0           1,   6 Oct 27 01:09 ram6
brw-------    1 0        0           1,   7 Oct 27 01:09 ram7
brw-------    1 0        0           1,   8 Oct 27 01:09 ram8
brw-------    1 0        0           1,   9 Oct 27 01:09 ram9
crw-rw-rw-    1 0        0           1,   8 Oct 27 01:09 random
crw-------    1 0        0         254,   0 Oct 27 01:09 rtc0
crw-------    1 0        0          21,   0 Oct 27 01:09 sg0
crw-------    1 0        0          10, 231 Oct 27 01:09 snapshot
brw-------    1 0        0          11,   0 Oct 27 01:09 sr0
crw-rw-rw-    1 0        0           5,   0 Oct 27 01:09 tty
crw-------    1 0        0           4,   0 Oct 27 01:09 tty0
crw-------    1 0        0           4,   1 Oct 27 01:09 tty1
crw-------    1 0        0           4,  10 Oct 27 01:09 tty10
crw-------    1 0        0           4,  11 Oct 27 01:09 tty11
crw-------    1 0        0           4,  12 Oct 27 01:09 tty12
crw-------    1 0        0           4,  13 Oct 27 01:09 tty13
crw-------    1 0        0           4,  14 Oct 27 01:09 tty14
crw-------    1 0        0           4,  15 Oct 27 01:09 tty15
crw-------    1 0        0           4,  16 Oct 27 01:09 tty16
crw-------    1 0        0           4,  17 Oct 27 01:09 tty17
crw-------    1 0        0           4,  18 Oct 27 01:09 tty18
crw-------    1 0        0           4,  19 Oct 27 01:09 tty19
crw-------    1 0        0           4,   2 Oct 27 01:09 tty2
crw-------    1 0        0           4,  20 Oct 27 01:09 tty20
crw-------    1 0        0           4,  21 Oct 27 01:09 tty21
crw-------    1 0        0           4,  22 Oct 27 01:09 tty22
crw-------    1 0        0           4,  23 Oct 27 01:09 tty23
crw-------    1 0        0           4,  24 Oct 27 01:09 tty24
crw-------    1 0        0           4,  25 Oct 27 01:09 tty25
crw-------    1 0        0           4,  26 Oct 27 01:09 tty26
crw-------    1 0        0           4,  27 Oct 27 01:09 tty27
crw-------    1 0        0           4,  28 Oct 27 01:09 tty28
crw-------    1 0        0           4,  29 Oct 27 01:09 tty29
crw-------    1 0        0           4,   3 Oct 27 01:09 tty3
crw-------    1 0        0           4,  30 Oct 27 01:09 tty30
crw-------    1 0        0           4,  31 Oct 27 01:09 tty31
crw-------    1 0        0           4,  32 Oct 27 01:09 tty32
crw-------    1 0        0           4,  33 Oct 27 01:09 tty33
crw-------    1 0        0           4,  34 Oct 27 01:09 tty34
crw-------    1 0        0           4,  35 Oct 27 01:09 tty35
crw-------    1 0        0           4,  36 Oct 27 01:09 tty36
crw-------    1 0        0           4,  37 Oct 27 01:09 tty37
crw-------    1 0        0           4,  38 Oct 27 01:09 tty38
crw-------    1 0        0           4,  39 Oct 27 01:09 tty39
crw-------    1 0        0           4,   4 Oct 27 01:09 tty4
crw-------    1 0        0           4,  40 Oct 27 01:09 tty40
crw-------    1 0        0           4,  41 Oct 27 01:09 tty41
crw-------    1 0        0           4,  42 Oct 27 01:09 tty42
crw-------    1 0        0           4,  43 Oct 27 01:09 tty43
crw-------    1 0        0           4,  44 Oct 27 01:09 tty44
crw-------    1 0        0           4,  45 Oct 27 01:09 tty45
crw-------    1 0        0           4,  46 Oct 27 01:09 tty46
crw-------    1 0        0           4,  47 Oct 27 01:09 tty47
crw-------    1 0        0           4,  48 Oct 27 01:09 tty48
crw-------    1 0        0           4,  49 Oct 27 01:09 tty49
crw-------    1 0        0           4,   5 Oct 27 01:09 tty5
crw-------    1 0        0           4,  50 Oct 27 01:09 tty50
crw-------    1 0        0           4,  51 Oct 27 01:09 tty51
crw-------    1 0        0           4,  52 Oct 27 01:09 tty52
crw-------    1 0        0           4,  53 Oct 27 01:09 tty53
crw-------    1 0        0           4,  54 Oct 27 01:09 tty54
crw-------    1 0        0           4,  55 Oct 27 01:09 tty55
crw-------    1 0        0           4,  56 Oct 27 01:09 tty56
crw-------    1 0        0           4,  57 Oct 27 01:09 tty57
crw-------    1 0        0           4,  58 Oct 27 01:09 tty58
crw-------    1 0        0           4,  59 Oct 27 01:09 tty59
crw-------    1 0        0           4,   6 Oct 27 01:09 tty6
crw-------    1 0        0           4,  60 Oct 27 01:09 tty60
crw-------    1 0        0           4,  61 Oct 27 01:09 tty61
crw-------    1 0        0           4,  62 Oct 27 01:09 tty62
crw-------    1 0        0           4,  63 Oct 27 01:09 tty63
crw-------    1 0        0           4,   7 Oct 27 01:09 tty7
crw-------    1 0        0           4,   8 Oct 27 01:09 tty8
crw-------    1 0        0           4,   9 Oct 27 01:09 tty9
crw-------    1 0        0           4,  64 Oct 27 01:09 ttyS0
crw-------    1 0        0           4,  65 Oct 27 01:09 ttyS1
crw-------    1 0        0           4,  66 Oct 27 01:09 ttyS2
crw-------    1 0        0           4,  67 Oct 27 01:09 ttyS3
crw-rw-rw-    1 0        0           1,   9 Oct 27 01:09 urandom
crw-------    1 0        0         250,   0 Oct 27 01:09 usbmon0
crw-------    1 0        0           7,   0 Oct 27 01:09 vcs
crw-------    1 0        0           7,   1 Oct 27 01:09 vcs1
crw-------    1 0        0           7, 128 Oct 27 01:09 vcsa
crw-------    1 0        0           7, 129 Oct 27 01:09 vcsa1
crw-------    1 0        0          10,  63 Oct 27 01:09 vga_arbiter
crw-rw-rw-    1 0        0           1,   5 Oct 27 01:09 zero
/ #

####################  
####  better console/tty control, start shell from  getty/inittab instead of /init or /etc/init.d/rcS
###  !!!!!!!!!!!!     -append "rdinit=/linuxrc" 
###########  etc/inittab  =======>  cat  > etc/inittab 
[lake@localhost _install]$ find etc
etc
etc/init.d
etc/init.d/rcS
etc/inittab
[lake@localhost _install]$

[lake@localhost _install]$ ls -l etc/
total 0
[lake@localhost _install]$ cat  > etc/inittab
console::sysinit:/etc/init.d/rcS

## series console shell
::respawn:/sbin/getty -n -l /bin/sh  115200  ttyS0 vt100


##tty no login
::respawn:/sbin/getty -n -l /bin/sh  115200  tty1 vt100
::respawn:/sbin/getty -n -l /bin/sh  115200  tty2 vt100
::respawn:/sbin/getty -n -l /bin/sh  115200  tty3 vt100
::respawn:/sbin/getty -n -l /bin/sh  115200  tty4 vt100

#::respawn:/bin/sh
::restart:/sbin/init

[lake@localhost _install]$ mkdir -p etc/init.d

[lake@localhost _install]$ mv init  etc/init.d/rcS

[lake@localhost _install]$ cat > etc/init.d/rcS 
#!/bin/sh

mount -t proc none /proc
mount -t sysfs none /sys
mount -t ramfs none /tmp 

/sbin/mdev -s  ###create dynamic device node in /dev

[lake@localhost _install]$ mkdir -p  tmp 
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值