Copyright © 2008, 2009, 2010, 2011, 2012, 2013, 2014 Guillaume Kielwasser
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".
Revision History | ||
---|---|---|
Revision 0.1 | 09 Sept 2008 | G. Kielwasser |
Initial dump | ||
Revision 0.2 | 19 Oct 2009 | G. Kielwasser |
Initial write | ||
Revision 0.3 | 06 Aug 2010 | G. Kielwasser |
Main contribution | ||
Revision 0.4 | 06 Aug 2012 | G. Kielwasser |
Fit installation of gnuwakes 0.2 build number 025 | ||
Revision 0.5 | 09 Aug 2013 | G. Kielwasser |
Added documentation on how to create the initramfs; Added details on the kernel configuration; Modified installation guide to fir build number 42 | ||
Revision 0.6 | 27 May 2014 | G. Kielwasser |
Updated to fit Wakes version 0.3 | ||
Revision 0.7 | 22 June 2014 | G. Kielwasser |
Updated to fit Wakes version 0.4 |
About this document
Understanding this document assume a certain knowledge of UNIX administration. It can serve as reminder of infrequently used admin commands, but not as novice guidance for beginners.
Table of Contents
Table of Contents
Table of Contents
Linux is a clone of the operating system Unix, written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net. It aims towards POSIX and Single UNIX Specification compliance.
Make sure you have no stale .o files and dependencies lying around:
make mrproper
Run the text based color menus, radiolists & dialogs kernel configuration tools:
make menuconfig
Configure the kernel based on
arch/x86/configs/i386_defconfig
and the following
recommandations.
Append an extra string to the end of your kernel version. Keep it empty.
Symbol: LOCALVERSION [=] Type : string Prompt: Local version - append to kernel release Location: -> General setup
Sets the default system hostname before userspace calls sethostname(2).
Symbol: DEFAULT_HOSTNAME [=wakes] Type : string Prompt: Default hostname Location: -> General setup
Adds support for so called swap devices or swap files in your kernel that are used to provide more virtual memory than the actual RAM present in your computer.
Symbol: SWAP [=y] Type : boolean Prompt: Support for paging of anonymous memory (swap) Location: -> General setup Depends on: MMU [=y] && BLOCK [=y]
Stack utilization instrumentation: disable to avoid
messages like "lvm used greatest stack depth:
5956 bytes left
"
Symbol: DEBUG_STACK_USAGE [=n] Prompt: Stack utilization instrumentation Depends on: DEBUG_KERNEL Location: -> Kernel hacking
This option enables the complete Linux kernel ".config" file contents to be saved in the kernel. It can be extracted from a running kernel by reading /proc/config.gz or using the script scripts/extract-ikconfig provided with the kernel sources.
Symbol: IKCONFIG [=y] Prompt: Kernel .config support Location: -> General setup
Symbol: IKCONFIG_PROC [=y] Prompt: Enable access to .config through /proc/config.gz Depends on: IKCONFIG && PROC_FS Location: -> General setup -> Kernel .config support (IKCONFIG [=y])
The initial RAM filesystem is a ramfs which is loaded by the boot loader (loadlin or lilo) and that is mounted as root before the normal boot procedure. It is typically used to load modules needed to mount the "real" root file system, etc.
Symbol: BLK_DEV_INITRD [=y] Type : boolean Prompt: Initial RAM filesystem and RAM disk (initramfs/initrd) support Location: -> General setup Depends on: BROKEN [=n] || !FRV
Physical Address Extension, necessary if you have a 32-bit processor and more than 4 gigabytes of physical RAM.
Symbol: HIGHMEM64G [=y] Type : boolean Prompt: 64GB Location: -> Processor type and features -> High Memory Support (<choice> [=y]) Depends on: <choice> && !M486 [=n] Selects: X86_PAE [=y]
Advanced Configuration and Power Interface is an open industry specification that provides a robust functional replacement for several legacy configuration and power management interfaces, including the Plug-and-Play BIOS specification (PnP BIOS), the MultiProcessor Specification (MPS), and the Advanced Power Management (APM) specification.
Symbol: ACPI [=y] Type : boolean Prompt: ACPI (Advanced Configuration and Power Interface) Support Location: -> Power management and ACPI options Depends on: !IA64_HP_SIM && (IA64 || X86 [=y]) && PCI [=y] Selects: PNP [=n]
With SysRq (Alt+PrintScreen) you will be able to flush the buffer cache to disk, reboot the system immediately or dump some status information.
Symbol: MAGIC_SYSRQ [=y] Type : boolean Prompt: Magic SysRq key Location: -> Kernel hacking Depends on: !UML
kexec is a system call that implements the ability to shutdown your current kernel, and to start another kernel. It is like a reboot but it is independent of the system firmware. And like a reboot you can start any kernel with it, not just Linux.
Symbol: KEXEC [=y] Type : boolean Prompt: kexec system call Location: -> Processor type and features
Generate crash dump after being started by kexec.
Symbol: CRASH_DUMP [=y] Type : boolean Prompt: kernel crash dumps Location: -> Processor type and features Depends on: X86_64 [=n] || X86_32 [=y] && HIGHMEM [=y]
This enables support for systems with more than one CPU.
Symbol: SMP [=y] Type : boolean Prompt: Symmetric multi-processing support Location: -> Processor type and features
This option is needed for the systems that have more than 8 CPUs.
Symbol: X86_BIGSMP [=y] Type : boolean Prompt: Support for big SMP systems with more than 8 CPUs Location: -> Processor type and features Depends on: X86_32 [=y] && SMP [=y]
This option adds support for grouping sets of processes together, for use with process control subsystems such as Cpusets, CFS, memory controls or device isolation.
Symbol: CGROUPS [=y] Type : boolean Prompt: Control Group support Location: -> General setup Depends on: EVENTFD [=y] Selected by: SCHED_AUTOGROUP [=n]
Provides a way to freeze and unfreeze all tasks in a cgroup.
Symbol: CGROUP_FREEZER [=y] Type : boolean Prompt: Freezer cgroup subsystem Location: -> General setup -> Control Group support (CGROUPS [=y]) Depends on: CGROUPS [=y]
Provides a cgroup implementing whitelists for devices which a process in the cgroup can mknod or open.
Symbol: CGROUP_DEVICE [=y] Type : boolean Prompt: Device controller for cgroups Location: -> General setup -> Control Group support (CGROUPS [=y]) Depends on: CGROUPS [=y]
This option will let you create and manage CPUSETs which allow dynamically partitioning a system into sets of CPUs and Memory Nodes and assigning tasks to run only within those sets. This is primarily useful on large SMP or NUMA systems.
Symbol: CPUSETS [=y] Type : boolean Prompt: Cpuset support Location: -> General setup -> Control Group support (CGROUPS [=y]) Depends on: CGROUPS [=y]
Provides a simple Resource Controller for monitoring the total CPU consumed by the tasks in a cgroup.
Symbol: CGROUP_CPUACCT [=y] Type : boolean Prompt: Simple CPU accounting cgroup subsystem Location: -> General setup -> Control Group support (CGROUPS [=y]) Depends on: CGROUPS [=y]
This option enables controller independent resource accounting infrastructure that works with cgroups.
Symbol: RESOURCE_COUNTERS [=y] Type : boolean Prompt: Resource counters Location: -> General setup -> Control Group support (CGROUPS [=y]) Depends on: CGROUPS [=y]
This option extends the per-cpu mode to restrict monitoring to threads which belong to the cgroup specified and run on the designated cpu.
Symbol: CGROUP_PERF [=y] Type : boolean Prompt: Enable perf_event per-cpu per-container group (cgroup) monitoring Location: -> General setup -> Control Group support (CGROUPS [=y]) Depends on: PERF_EVENTS [=y] && CGROUPS [=y]
This feature lets CPU scheduler recognize task groups and control CPU bandwidth allocation to such task groups. It uses cgroups to group tasks.
Symbol: CGROUP_SCHED [=y] Type : boolean Prompt: Group CPU scheduler Location: -> General setup -> Control Group support (CGROUPS [=y]) Depends on: CGROUPS [=y]
Generic block IO controller cgroup interface. This is the common cgroup interface which should be used by various IO controlling policies.
Symbol: BLK_CGROUP [=y] Type : boolean Prompt: Block IO controller Location: -> General setup -> Control Group support (CGROUPS [=y]) Depends on: CGROUPS [=y] && BLOCK [=y]
This allows your Linux host to run other operating systems inside virtual machines (guests). It supports hosting fully virtualized guest machines using hardware virtualization extensions. It also provides support for KVM on Intel processors equipped with the VT extensions and AMD processors equipped with the AMD-V (SVM) extensions.
Symbol: VIRTUALIZATION [=y] Type : boolean Prompt: Virtualization Depends on: HAVE_KVM [=y] || X86 [=y]
Symbol: KVM [=m] Type : tristate Prompt: Kernel-based Virtual Machine (KVM) support Location: -> Virtualization (VIRTUALIZATION [=y]) Depends on: VIRTUALIZATION[=y] && HAVE_KVM[=y] && HIGH_RES_TIMERS [=y] && NET [=y]
Symbol: KVM_INTEL [=m] Prompt: KVM for Intel processors support Depends on: VIRTUALIZATION && KVM Location: -> Virtualization (VIRTUALIZATION [=y]) -> Kernel-based Virtual Machine (KVM) support (KVM [=m])
Symbol: KVM_AMD [=m] Prompt: KVM for AMD processors support Depends on: VIRTUALIZATION && KVM Location: -> Virtualization (VIRTUALIZATION [=y]) -> Kernel-based Virtual Machine (KVM) support (KVM [=m])
This enables options for running Linux under various hyper-visors. This option enables basic hypervisor detection and platform setup.
Symbol: HYPERVISOR_GUEST [=y] Type : boolean Prompt: Linux guest support Location: -> Processor type and features Selected by: X86_VSMP [=n] && X86_64 [=n] && PCI [=y] && X86_EXTENDED_PLATFORM [=n] && SMP [=y]
This changes the kernel so it can modify itself when it is run under a hypervisor, potentially improving performance significantly over full virtualization.
Symbol: PARAVIRT [=y] Type : boolean Prompt: Enable paravirtualization code Location: -> Processor type and features -> Linux guest support (HYPERVISOR_GUEST [=y]) Depends on: HYPERVISOR_GUEST [=y] Selected by: X86_VSMP [=n] && X86_64 [=n] && PCI [=y] && X86_EXTENDED_PLATFORM [=n] && SMP [=y]
This option enables various optimizations for running under the KVM hypervisor.
Symbol: KVM_GUEST [=y] Type : boolean Prompt: KVM Guest support (including kvmclock) Location: -> Processor type and features -> Linux guest support (HYPERVISOR_GUEST [=y]) Depends on: HYPERVISOR_GUEST [=y] && PARAVIRT [=y] Selects: PARAVIRT_CLOCK [=y]
Lguest is a tiny in-kernel hypervisor. Selecting this will allow your kernel to boot under lguest.
Symbol: LGUEST_GUEST [=y] Type : boolean Prompt: Lguest guest support Location: -> Processor type and features -> Linux guest support (HYPERVISOR_GUEST [=y]) Depends on: HYPERVISOR_GUEST [=y] && X86_32 [=y] && PARAVIRT [=y] Selects: TTY [=y] && VIRTUALIZATION [=y] && VIRTIO [=y] && VIRTIO_CONSOLE [=y]
This is the Linux Xen port. Enabling this will allow the kernel to boot in a paravirtualized environment under the Xen hypervisor.
Symbol: XEN [=y] Type : boolean Prompt: Xen guest support Location: -> Processor type and features -> Linux guest support (HYPERVISOR_GUEST [=y]) -> Enable paravirtualization code (PARAVIRT [=y]) Depends on: HYPERVISOR_GUEST [=y] && PARAVIRT [=y] && \ (X86_64 [=n] || X86_32 [=y] && X86_PAE [=y] && \ !X86_VISWS [=n]) && X86_TSC [=y] Selects: PARAVIRT_CLOCK [=y] && XEN_HAVE_PVMMU [=n]
This drivers provides support for virtio based paravirtual device drivers over PCI. Most QEMU based VMMs should support these devices (like KVM or Xen).
Symbol: VIRTIO_PCI [=y] Type : tristate Prompt: PCI driver for virtio devices Location: -> Device Drivers -> Virtio drivers Depends on: PCI [=y] Selects: VIRTIO [=y]
This driver supports increasing and decreasing the amount of memory within a KVM guest.
Symbol: VIRTIO_BALLOON [=y] Type : tristate Prompt: Virtio balloon driver Location: -> Device Drivers -> Virtio drivers Depends on: VIRTIO [=y]
This is the virtual block driver for virtio. It can be used with lguest or QEMU based VMMs (like KVM or Xen).
Symbol: VIRTIO_BLK [=y] Type : tristate Prompt: Virtio block driver Location: -> Device Drivers -> Block devices (BLK_DEV [=y]) Depends on: BLK_DEV [=y] && VIRTIO [=y]
This is the virtual network driver for virtio. It can be used with lguest or QEMU based VMMs (like KVM or Xen).
Symbol: VIRTIO_NET [=y] Type : tristate Prompt: Virtio network driver Location: -> Device Drivers -> Network device support (NETDEVICES [=y]) -> Network core driver support (NET_CORE [=y]) Depends on: NETDEVICES [=y] && NET_CORE [=y] && VIRTIO [=y]
Virtio console for use with lguest and other hypervisors.
Symbol: VIRTIO_CONSOLE [=y] Type : tristate Prompt: Virtio console Location: -> Device Drivers -> Character devices Depends on: VIRTIO [=y] && TTY [=y] Selects: HVC_DRIVER [=y] Selected by: LGUEST_GUEST [=y] && PARAVIRT_GUEST [=y] && X86_32 [=y] && PARAVIRT [=y]
This driver provides kernel-side support for the virtual Random Number Generator hardware.
Symbol: HW_RANDOM_VIRTIO [=y] Type : tristate Prompt: VirtIO Random Number Generator support Location: -> Device Drivers -> Character devices -> Hardware Random Number Generator Core support (HW_RANDOM [=y]) Depends on: HW_RANDOM [=y] && VIRTIO [=y]
Support multiple physical spindles through a single logical device. Required for RAID and logical volume management.
Symbol: MD [=y] Type : boolean Prompt: Multiple devices driver support (RAID and LVM) Location: -> Device Drivers Depends on: BLOCK [=y]
This driver lets you combine several hard disk partitions into one logical block device. This can be used to simply append one partition to another one or to combine several redundant hard disks into a RAID1/4/5 device so as to provide protection against hard disk failures. This is called "Software RAID" since the combining of the partitions is done by the kernel.
Symbol: BLK_DEV_MD [=y] Type : tristate Prompt: RAID support Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) Depends on: MD [=y] Selected by: DM_RAID [=y] && MD [=y] && BLK_DEV_DM [=y]
This mode combines the hard disk partitions by simply appending one to the other.
Symbol: MD_LINEAR [=y] Type : tristate Prompt: Linear (append) mode Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) -> RAID support (BLK_DEV_MD [=y]) Depends on: MD && BLK_DEV_MD
This mode combines the hard disk partitions into one logical device in such a fashion as to fill them up evenly, one chunk here and one chunk there. This will increase the throughput rate if the partitions reside on distinct disks.
Symbol: MD_RAID0 [=y] Type : tristate Prompt: RAID-0 (striping) mode Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) -> RAID support (BLK_DEV_MD [=y]) Depends on: MD && BLK_DEV_MD
A RAID-1 set consists of several disk drives which are exact copies of each other. In the event of a mirror failure, the RAID driver will continue to use the operational mirrors in the set, providing an error free MD (multiple device) to the higher levels of the kernel. In a set with N drives, the available space is the capacity of a single drive, and the set protects against a failure of (N - 1) drives.
Symbol: MD_RAID1 [=y] Type : tristate Prompt: RAID-1 (mirroring) mode Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) -> RAID support (BLK_DEV_MD [=y]) Depends on: MD && BLK_DEV_MD
RAID-10 provides a combination of striping (RAID-0) and mirroring (RAID-1) with easier configuration and more flexible layout. Unlike RAID-0, but like RAID-1, RAID-10 requires all devices to be the same size (or at least, only as much as the smallest device will be used).
Symbol: MD_RAID10 [=y] Type : tristate Prompt: RAID-10 (mirrored striping) mode Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) -> RAID support (BLK_DEV_MD [=y]) Depends on: MD && BLK_DEV_MD
A RAID-5 set of N drives with a capacity of C MB per drive provides the capacity of C * (N - 1) MB, and protects against a failure of a single drive. For a given sector (row) number, (N - 1) drives contain data sectors, and one drive contains the parity protection. For a RAID-4 set, the parity blocks are present on a single drive, while a RAID-5 set distributes the parity across the drives in one of the available parity distribution methods.
A RAID-6 set of N drives with a capacity of C MB per drive provides the capacity of C * (N - 2) MB, and protects against a failure of any two drives. For a given sector (row) number, (N - 2) drives contain data sectors, and two drives contains two independent redundancy syndromes. Like RAID-5, RAID-6 distributes the syndromes across the drives in one of the available parity distribution methods.
Symbol: MD_RAID456 [=y] Type : tristate Prompt: RAID-4/RAID-5/RAID-6 mode Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) -> RAID support (BLK_DEV_MD [=y]) Depends on: MD && BLK_DEV_MD
The "faulty" module allows for a block device that occasionally returns read or write errors. It is useful for testing.
Symbol: MD_FAULTY [=y] Type : tristate Prompt: Faulty test module for MD Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) -> RAID support (BLK_DEV_MD [=y]) Depends on: MD [=y] && BLK_DEV_MD [=y]
Allows a block device to be used as cache for other devices; uses a btree for indexing and the layout is optimized for SSDs.
Symbol: BCACHE [=y] Type : tristate Prompt: Block device as cache Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) Depends on: MD [=y]
Device-mapper is a low level volume manager. It works by allowing people to specify mappings for ranges of logical sectors. Various mapping types are available, in addition people may write their own modules containing custom mappings if they wish.
Symbol: BLK_DEV_DM [=y] Type : tristate Prompt: Device mapper support Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) Depends on: MD [=y]
This device-mapper target allows you to create a device that transparently encrypts the data on it. You'll need to activate the ciphers you're going to use in the cryptoapi configuration.
Symbol: DM_CRYPT [=y] Type : tristate Prompt: Crypt target support Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) -> Device mapper support (BLK_DEV_DM [=y]) Selects: CRYPTO && CRYPTO_CBC Depends on: MD && BLK_DEV_DM
Allow volume managers to take writable snapshots of a device.
Symbol: DM_SNAPSHOT [=y] Type : tristate Prompt: Snapshot target Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) -> Device mapper support (BLK_DEV_DM [=y]) Depends on: MD && BLK_DEV_DM
Provides thin provisioning and snapshots that share a data store.
Symbol: DM_THIN_PROVISIONING [=y] Type : tristate Prompt: Thin provisioning target Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) -> Device mapper support (BLK_DEV_DM [=y]) Depends on: MD && BLK_DEV_DM
dm-cache attempts to improve performance of a block device by moving frequently used data to a smaller, higher performance device. Different 'policy' plugins can be used to change the algorithms used to select which blocks are promoted, demoted, cleaned etc. It supports writeback and writethrough modes.
Symbol: DM_CACHE [=y] Type : tristate Prompt: Cache target (EXPERIMENTAL) Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) -> Device mapper support (BLK_DEV_DM [=y]) Depends on: MD && BLK_DEV_DM
Allow volume managers to mirror logical volumes, also needed for live data migration tools such as 'pvmove'.
Symbol: DM_MIRROR [=y] Type : tristate Prompt: Mirror target Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) -> Device mapper support (BLK_DEV_DM [=y]) Depends on: MD && BLK_DEV_DM
A dm target that supports RAID1, RAID10, RAID4, RAID5 and RAID6 mapping.
Symbol: DM_RAID [=y] Type : tristate Prompt: RAID 1/4/5/6/10 target Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) -> Device mapper support (BLK_DEV_DM [=y]) Depends on: MD && BLK_DEV_DM
A target that discards writes, and returns all zeroes for reads. Useful in some recovery situations.
Symbol: DM_ZERO [=y] Type : tristate Prompt: Zero target Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) Depends on: MD && BLK_DEV_DM
Allow volume managers to support multipath hardware.
Symbol: DM_MULTIPATH [=y] Type : tristate Prompt: Multipath target Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) Depends on: MD && BLK_DEV_DM && (SCSI_DH || !SCSI_DH)
A target that delays reads and/or writes and can send them to different devices. Useful for testing.
Symbol: DM_DELAY [=y] Type : tristate Prompt: I/O delaying target Location: -> Device Drivers -> Multiple devices driver support (RAID and LVM) (MD [=y]) Depends on: MD && BLK_DEV_DM
Symbol: VLAN_8021Q [=y] Prompt: 802.1Q VLAN Support Depends on: NET Location: -> Networking support (NET [=y]) -> Networking options
Symbol: BRIDGE [=y] Prompt: 802.1d Ethernet Bridging Depends on: NET Location: -> Networking support (NET [=y]) -> Networking options Selects: LLC && STP
Symbol: TUN [=y] Prompt: Universal TUN/TAP device driver support Depends on: NETDEVICES Location: -> Device Drivers -> Network device support (NETDEVICES [=y]) Selects: CRC32
Symbol: BONDING [=y] Prompt: Bonding driver support Depends on: NETDEVICES && INET && (IPV6 || IPV6=n) Location: -> Device Drivers -> Network device support (NETDEVICES [=y])
Symbol: 8139CP [=y] Prompt: RealTek RTL-8139 C+ PCI Fast Ethernet Adapter support (EXPERIME Depends on: NETDEVICES && NET_ETHERNET && NET_PCI && PCI && EXPERIMEN Location: -> Device Drivers -> Network device support (NETDEVICES [=y]) -> Ethernet (10 or 100Mbit) (NET_ETHERNET [=y]) Selects: CRC32 && MII
Symbol: EXT4_FS [=y] Prompt: The Extended 4 (ext4) filesystem Depends on: BLOCK Location: -> File systems Selects: JBD2 && CRC16
Symbol: REISERFS_FS [=y] Prompt: Reiserfs support Depends on: BLOCK Location: -> File systems Selects: CRC32
Symbol: JFS_FS [=y] Prompt: JFS filesystem support Depends on: BLOCK Location: -> File systems Selects: NLS && CRC32
Symbol: XFS_FS [=y] Prompt: XFS filesystem support Depends on: BLOCK Location: -> File systems Selects: EXPORTFS
Symbol: BTRFS_FS [=y] Prompt: Btrfs filesystem support Depends on: BLOCK Location: -> File systems
Symbol: NTFS_FS [=y] Prompt: NTFS file system support Depends on: BLOCK Location: -> File systems -> DOS/FAT/NT Filesystems Selects: NLS
Check the different kernel options and make sure they are set correctly:
#!/bin/ksh . ./.config check_param () { for p in $* do printf "%-20s = " "$p" eval print -- \$CONFIG_$p done } paramlist=" LOCALVERSION DEFAULT_HOSTNAME SWAP DEBUG_STACK_USAGE IKCONFIG IKCONFIG_PROC BLK_DEV_INITRD HIGHMEM64G ACPI MAGIC_SYSRQ KEXEC CRASH_DUMP SMP X86_BIGSMP NR_CPUS CGROUPS CGROUP_FREEZER CGROUP_DEVICE CPUSETS CGROUP_CPUACCT RESOURCE_COUNTERS CGROUP_PERF CGROUP_SCHED BLK_CGROUP VIRTUALIZATION KVM KVM_INTEL KVM_AMD HYPERVISOR_GUEST PARAVIRT KVM_GUEST LGUEST_GUEST XEN VIRTIO_PCI VIRTIO_BALLOON VIRTIO_BLK VIRTIO_NET VIRTIO_CONSOLE HW_RANDOM_VIRTIO MD BLK_DEV_MD MD_LINEAR MD_RAID0 MD_RAID1 MD_RAID10 MD_RAID456 MD_FAULTY BCACHE BLK_DEV_DM DM_CRYPT DM_SNAPSHOT DM_THIN_PROVISIONING DM_CACHE DM_MIRROR DM_RAID DM_ZERO DM_MULTIPATH DM_DELAY DM_FLAKEY VLAN_8021Q BRIDGE TUN BONDING 8139CP EXT4_FS REISERFS_FS JFS_FS XFS_FS BTRFS_FS NTFS_FS INOTIFY_USER " check_param $paramlist
If you configured any of the parts of the kernel as modules,
install them in /lib/modules/2.6.30.1
:
make modules_install
Export the kernel's header files in a form suitable for use by userspace programs:
make headers_install
Kernel version
version=$(<include/config/kernel.release)
Install Linux kernel image:
cp arch/i386/boot/bzImage /boot/vmlinuz-$version
System.map is used by module-init tools and some debugging tools to retrieve the actual addresses of symbols in the kernel.
cp System.map /boot/System.map-$version
Save kernel configuration file:
cp .config /boot/config-$version
Recreate the according initramfs:
mkinitramfs $version
Table of Contents
initrd provides the capability to load a RAM disk by the boot loader. This RAM disk can then be mounted as the root file system and programs can be run from it. Afterwards, a new root file system can be mounted from a different device. The previous root (from initrd) is then moved to a directory and can be subsequently unmounted.
Recent kernels have support for populating a ramdisk from a compressed cpio archive. On such systems, the creation of a ramdisk image doesn't need to involve special block devices or loopbacks; you merely create a directory on disk with the desired initrd content, cd to that directory, and run (as an example):
find . | cpio --quiet -H newc -o | gzip -9 -n > /boot/imagefile.img
Examining the contents of an existing image file is just as simple:
mkdir /tmp/imagefile cd /tmp/imagefile gzip -cd /boot/imagefile.img | cpio -imd --quiet
This section describes how to create an initramfs from scratch. We assume we are working in a dedicated directory:
mkdir /tmp/initrd cd /tmp/initrd
for dynamically linked programs:
LD_TRACE_LOADED_OBJECTS=1 /lib/ld-linux.so.2 /sbin/lvm
for statically linked programs:
LANG=C readelf -e /usr/lib/klibc/bin/run-init | grep 'interpreter:'
mkdir -p bin sbin dev etc etc/udev/rules.d lib lib/udev/rules.d \ lib/modules/3.10.1 root usr/share
We mainly use busybox for our initrd, but instead of using pivot_root and chroot to run the init file on the new root filesystem, we use run-init from the klibc project:
cp /usr/lib/klibc/bin/run-init bin
It needs the klibc interpreter:
cp /lib/klibc-HD4lPOAFFcrZF9wKjmJlHFIQD-4.so lib
for p in /bin/busybox /bin/ksh /bin/disp /usr/bin/loadkeys /bin/bc do cp $p bin done for p in /sbin/lvm /sbin/udevd /sbin/udevadm do cp $p sbin done
for l in libc.so.6 ld-linux.so.2 libdl.so.2 libm.so.6 \ libdevmapper.so.1.02 libreadline.so.5 librt.so.1 libncurses.so.5 \ libncursesw.so.5 libpthread.so.0 libnss_files.so.2 do cp /lib/$l lib done
busybox:
cd bin ./busybox --list | while read p; do ln -s busybox $p; done rm modprobe cd ../sbin ln -s ../bin/busybox modprobe cd ..
lvm:
cd sbin ./lvm help 2>&1 | grep '^ [^ ]' | sed 1,2d | grep -v '^ help ' | \ awk '{ print $1 }' | while read p; do ln -s lvm $p; done cd ..
selective copy:
for m in fs/ext4/ext4.ko lib/crc16.ko fs/jbd2/jbd2.ko \ fs/mbcache.ko drivers/scsi/sg.ko drivers/scsi/sr_mod.ko \ drivers/scsi/sd_mod.ko drivers/cdrom/cdrom.ko drivers/ata/ata_piix.ko \ drivers/ata/libata.ko drivers/scsi/scsi_mod.ko md/dm-mod.ko do cp /lib/modules/3.10.1/kernel/$m lib/modules/3.10.1 done
global copy:
rsync -a /lib/modules/3.10.1 lib/modules
depmod:
cd lib/modules/3.10.1 depmod -b $(pwd)/../../.. 3.10.1 cd ../../..
#!/bin/ksh shell_escape () { export PATH=/bin:/sbin [ -d /dev ] || mkdir -m 0755 /dev [ -d /root ] || mkdir --mode=0700 /root [ -d /sys ] || mkdir /sys [ -d /proc ] || mkdir /proc [ -d /tmp ] || mkdir /tmp mountpoint -q /sys || mount -t sysfs none /sys -onodev,noexec,nosuid mountpoint -q /proc || mount -t proc none /proc -onodev,noexec,nosuid [ -d /dev/pts ] || mkdir /dev/pts [ -e /dev/console ] || mknod /dev/console c 5 1 [ -e /dev/null ] || mknod /dev/null c 1 3 /sbin/udevd --daemon udevadm trigger udevadm settle for mod in dm_mod ext4 iso9660 do modprobe -q $mod done } print ' __ __ _ \ \ / / | | \ \ /\ / /_ _| | _____ ___ \ \/ \/ / _` | |/ / _ \/ __| \ /\ / (_| | < __/\__ \ \/ \/ \__,_|_|\_\___||___/ A GNU/Linux operating system. ' print ' ############################################################################## # # # Starting initramfs boot scripts # # # ############################################################################## ' export PATH=/bin:/sbin [ -d /dev ] || mkdir -m 0755 /dev [ -d /root ] || mkdir --mode=0700 /root [ -d /sys ] || mkdir /sys [ -d /proc ] || mkdir /proc [ -d /tmp ] || mkdir /tmp disp "Mounting /sys" \ mount -t sysfs none /sys -onodev,noexec,nosuid disp "Mounting /proc" \ mount -t proc none /proc -onodev,noexec,nosuid mkdir /dev/pts [ -e /dev/console ] || mknod /dev/console c 5 1 [ -e /dev/null ] || mknod /dev/null c 1 3 disp "Starting udev" /sbin/udevd --daemon rc=$? udevadm trigger udevadm settle disp $rc for mod in dm_mod ext4 iso9660 do disp "Loading $mod" modprobe -q $mod done for x in $(</proc/cmdline) do case $x in lang=*) lang=${x#lang=} disp "Setting $lang keyboard layout" loadkeys $lang ;; root=*) root=${x#root=} ;; esac done disp "Stopping udevd" for f in /proc/*/exe do l=$(readlink $f) if [ "$l" == /sbin/udevd ] then pid=$(print $f | cut -d'/' -f3) kill $pid rc=$? break fi done disp $rc case $root in /dev/*/*) vg=$(print $root | cut -d'/' -f3) if vgdisplay | grep "VG Name" | awk '{ print $NF }' | grep -qw $vg then disp "Activate $vg" vgchange -a y $vg disp "Mounting $root" mount $root /root else print "" print "error: vg $vg not found, exiting to shell." . /etc/profile shell_escape exec /bin/ksh fi ;; esac if [ -n "$root" ] then disp "Unmounting /sys" umount /sys disp "Unmounting /proc" umount /proc print "" exec run-init /root /sbin/init else print "" . /etc/profile shell_escape exec /bin/ksh fi
chmod 755 init
find . | cpio --quiet -H newc -o | gzip -9 -n > /boot/initrd-3.10.1
Table of Contents
ISO file is generated from /wakes/cdrom
tree,
which contents 2 directories:
# ls -l /wakes/cdrom/ total 4 drwxr-xr-x 1 root root 0 Jul 5 22:53 depot drwxr-xr-x 1 root root 4096 Aug 5 10:52 isolinux
# ls -l /wakes/cdrom/isolinux total 15653 -rw-r--r-- 1 root root 6166439 Aug 5 11:07 initrd.gz -rw-r--r-- 1 root root 13432 Aug 5 11:44 isolinux.bin -rw-r--r-- 1 root root 311 Jul 8 23:08 isolinux.cfg -rw-r--r-- 1 root root 237 Oct 5 2009 isolinux.txt -rw-r--r-- 1 root root 3690848 Aug 9 2009 vmlinuz
/wakes/cdrom/isolinux/isolinux.txt
__ __ _ \ \ / / | | \ \ /\ / /_ _| | _____ ___ \ \/ \/ / _` | |/ / _ \/ __| \ /\ / (_| | < __/\__ \ \/ \/ \__,_|_|\_\___||___/ The Wakes GNU/Linux Operating System
/wakes/cdrom/isolinux/isolinux.cfg
default linux prompt 0 timeout 0 display isolinux.txt label linux kernel vmlinuz append initrd=initrd.gz boot=install quiet noapic
wakes=/wakes
-R Generate SUSP and RR records using the Rock Ridge protocol to further describe the files on the ISO-9660 filesystem. The Rock Ridge protocol is needed in order to add POSIX like file meta data like permissions, extended time stamps, user/group is'd, link counts, inode numbers and symbolic links. The Rock Ridge protocol allows to archive hierarchy trees with unlimited depth.
-f Follow all symbolic links when generating the filesystem. When this option is not in use, symbolic links will be entered using Rock Ridge if enabled, otherwise the file will be ignored.
mkisofs -R -f -b isolinux/isolinux.bin -c boot.catalog -no-emul-boot \ -boot-info-table -o $wakes/iso/wakes-full-alpha1-$new_num-$arch.iso \ $wakes/cdrom
Table of Contents
Initramfs used to host the Wakes installer is a debian one. In the
init
script we use the keyword
boot
to pass the install
argument:
boot=*) BOOT=${x#boot=} ;;
As $BOOT
is sourced:
. /scripts/${BOOT}
we created the file scripts/install
:
mountroot () { /wakes/install.sh }
and we use the moutroot
function to start the
Wakes installer;
mountroot
The Wakes installer is divided into 3 phases:
1. wait_disk
2. initial_menu
3. choice_install
The actual installation is made by choice_install
.
create partition
fdisk $disk
create root volume group
pvcreate -ff $sys_part vgcreate rootvg $sys_part lvcreate -l 90%VG rootvg
format root partion
/sbin/mke2fs -j /dev/mapper/rootvg-lvol0
mount root partion
create_dir $rootmnt mount /dev/mapper/rootvg-lvol0 $rootmnt
create root tree
create_dir $rootmnt/sys $rootmnt/dev $rootmnt/proc $rootmnt/tmp \ $rootmnt/var $rootmnt/var/lock $rootmnt/var/run $rootmnt/var/log \ $rootmnt/etc $rootmnt/root $rootmnt/var/tmp $rootmnt/mnt $rootmnt/boot \ $rootmnt/var/wkpkg $rootmnt/var/wkpkg/rep $rootmnt/var/wkpkg/db \ $rootmnt/var/wkpkg/run $rootmnt/var/wkpkg/build \ $rootmnt/var/wkpkg/mnt/cdrom $rootmnt/var/wkpkg/cat $rootmnt/mnt
install packages
for pkg in $pkg_list do /bin/wkpkg -d $rootmnt -i $pkg done
create boot partition
mke2fs -j $boot_part create_dir $rootmnt/boot mount $boot_part $rootmnt/boot
install linux kernel
/bin/wkpkg -d $rootmnt -i linux
install grub
create_dir $rootmnt/boot/grub cp $rootmnt/usr/lib/grub/i386-pc/* $rootmnt/boot/grub cat <<EOF > $rootmnt/boot/grub/menu.lst default 0 timeout 10 title Wakes GNU/Linux, kernel 2.6.30.1 root (hd0,0) kernel /vmlinuz root=/dev/mapper/rootvg-lvol0 ro quiet initrd /initrd boot title Install Wakes GNU/Linux root (hd0,0) kernel /vmlinuz-install boot=install quiet initrd /initrd-install boot EOF
setup grub
grub --no-curses --batch <<EOF > /dev/null 2>&1 root ($gpart) setup ($gdisk) quit EOF
install config files
cp -r /wakes/X11 $rootmnt/etc
create passwd
cat <<EOF > $rootmnt/etc/passwd root:\$1\$8/H0/gjl\$L5QE8vjJw5BTt/QAu41gk/:0:0:root:/root:/bin/ksh nobody:x:99:99:Unprivileged User:/dev/null:/bin/false sshd:x:50:50:sshd PrivSep:/var/lib/sshd:/bin/false rsyncd:x:48:48:rsyncd Daemon:/home/rsync:/bin/false EOF
create group
cat <<EOF > $rootmnt/etc/group root:x:0: bin:x:1: sys:x:2: kmem:x:3: tty:x:4: tape:x:5: daemon:x:6: floppy:x:7: disk:x:8: lp:x:9: uucp:x:10: audio:x:11: video:x:12: utmp:x:13: usb:x:14: cdrom:x:15: mail:x:34: nogroup:x:99: sshd:x:50: rsyncd:x:48: EOF
create inittab
cat <<EOF > $rootmnt/etc/inittab # Begin /etc/inittab id:3:initdefault: si::sysinit:/etc/rc.d/init.d/rc sysinit l0:0:wait:/etc/rc.d/init.d/rc 0 l1:S1:wait:/etc/rc.d/init.d/rc 1 l2:2:wait:/etc/rc.d/init.d/rc 2 l3:3:wait:/etc/rc.d/init.d/rc 3 l4:4:wait:/etc/rc.d/init.d/rc 4 l5:5:wait:/etc/rc.d/init.d/rc 5 l6:6:wait:/etc/rc.d/init.d/rc 6 #ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now su:S016:once:/sbin/sulogin 1:2345:respawn:/sbin/agetty tty1 9600 2:2345:respawn:/sbin/agetty tty2 9600 3:2345:respawn:/sbin/agetty tty3 9600 #4:2345:respawn:/sbin/agetty tty4 9600 #5:2345:respawn:/sbin/agetty tty5 9600 #6:2345:respawn:/sbin/agetty tty6 9600 # Run xdm as a separate service x:5:respawn:/usr/X11R6/bin/xdm -nodaemon # End /etc/inittab EOF
create hosts
cat <<EOF > $rootmnt/etc/hosts 127.0.0.1 localhost EOF
create ld.so.conf
# Begin /etc/ld.so.conf /usr/local/lib /opt/lib # End /etc/ld.so.conf EOF
create resolv.conf
cat <<EOF > $rootmnt/etc/resolv.conf nameserver 89.2.0.1 nameserver 89.2.0.2 EOF
create network
cat <<EOF > $rootmnt/etc/sysconfig/network HOSTNAME=$hostname EOF
create clock
cat <<EOF > $rootmnt/etc/sysconfig/clock # Begin /etc/sysconfig/clock UTC=1 # End /etc/sysconfig/clock EOF
create profile
cat <<EOF > $rootmnt/etc/profile # Begin /etc/profile # Default PATH export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/i686-pc-linux-gnu/bin # For ksh -o vi export EDITOR=vi if [ "\`id -u\`" -eq 0 ] then PS1="\`id -un\`@\`uname -n\` # " else PS1='$ ' fi # End /etc/profile EOF
create nsswitch.conf
cat <<EOF > $rootmnt/etc/nsswitch.conf # Begin /etc/nsswitch.conf passwd: files group: files shadow: files hosts: files dns networks: files protocols: files services: files ethers: files rpc: files # End /etc/nsswitch.conf EOF
create fstab
cat <<EOF > $rootmnt/etc/fstab # Begin /etc/fstab # file system mount-point type options dump fsck # order xxxxxxxxx / ext3 defaults 1 1 yyyyyyyyy /boot ext3 defaults 1 1 #/dev/zzzz swap swap pri=1 0 0 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 devpts /dev/pts devpts gid=4,mode=620 0 0 tmpfs /dev/shm tmpfs defaults 0 0 # End /etc/fstab EOF
create wkpkg.conf
cat <<EOF > $rootmnt/etc/wkpkg.conf # # cat /etc/wkpkg.conf # Default network depot http://www.gnuwakes.org/depot main #usb://depot main #ftp://www.gnuwakes.org/depot main #cdrom://depot main #disk://var/wkpkg/rep main EOF
configure fstab
sed -i "s%xxxxxxxxx %/dev/mapper/rootvg-lvol0 %; s%yyyyyyyyy %$boot_part %" \ $rootmnt/etc/fstab
do some configuration...
cd $rootmnt/usr/bin && ln -s gcc cc && cd / cd $rootmnt && ln -s /usr usr/X11R6 cd $rootmnt && mkdir usr/share/fonts && \ ln -s /usr/lib/X11/fonts/OTF usr/share/fonts/OTF && \ ln -s /usr/lib/X11/fonts/TTF usr/share/fonts/TTF mkdir -p $rootmnt/usr/lib/X11/xdm print "DisplayManager*userPath: /bin:/usr/bin:/sbin:/usr/sbin" \ >> $rootmnt/usr/lib/X11/xdm/xdm-config print "DisplayManager*systemPath: /bin:/usr/bin:/sbin:/usr/sbin" \ >> $rootmnt/usr/lib/X11/xdm/xdm-config [ -f /usr/bin/i686-pc-linux-gnu-gcc-4.1.2 ] && \ ln -s /usr/bin/i686-pc-linux-gnu-gcc-4.1.2 /usr/bin/gcc
confiigure network
cd $rootmnt/etc/sysconfig/network-devices mkdir ifconfig.eth0 cat << EOF > ifconfig.eth0/ipv4 ONBOOT=yes SERVICE=ipv4-static IP=$ip_address GATEWAY=$gateway PREFIX=$prefix EOF
setup Wakes version
print "0.1" > $rootmnt/etc/wakes_version
install root passsword
print -n "Enter root password: " stty -echo read passwd stty echo print "" crypted=$(crypt $passwd) grep -v '^root:' $rootmnt/etc/passwd > $rootmnt/etc/passwd.tmp print "root:$crypted:0:0:root:/root:/bin/ksh" > $rootmnt/etc/passwd cat $rootmnt/etc/passwd.tmp >> $rootmnt/etc/passwd rm $rootmnt/etc/passwd.tmp
umount $rootmnt/boot
umount $rootmnt/boot
create /dev/console
[ -c $rootmnt/dev/console ] || mknod $rootmnt/dev/console c 5 1
reboot
reboot
Table of Contents
Configuration file /etc/wkpkg.conf
:
# Default network depot http://www.gnuwakes.org/depot main #usb://depot main #ftp://www.gnuwakes.org/depot main #cdrom://depot main #disk://wakes/rep main
Working directory /var/wkpkg
:
# ls -l /var/wkpkg total 24 drwxr-xr-x 7 root root 4096 Jul 28 23:08 build drwxr-xr-x 2 root root 4096 Jul 16 02:22 cat drwxr-xr-x 198 root root 4096 Jul 19 01:32 db drwxr-xr-x 3 root root 4096 Jul 16 02:22 mnt drwxr-xr-x 3 root root 4096 Jul 16 02:22 rep drwxr-xr-x 3 root root 4096 Aug 9 14:40 run
Directory structure:
build
: where you create new packages
cat
: where is the index catalog
db
: database of installed packages
mnt
: to mount device with repository
rep
:
repo where wkpkg
download packages before
installing them (for remote sources)
run
: to edit packages
create the following structure:
# ls -l total 24 -rw-r--r-- 1 root root 186 Sep 6 2009 Buildfile drwxr-xr-x 2 root root 4096 Sep 6 2009 binaries drwxr-xr-x 2 root root 4096 Sep 6 2009 build drwxr-xr-x 2 root root 4096 Sep 6 2009 infos drwxr-xr-x 2 root root 4096 Sep 6 2009 patchs drwxr-xr-x 2 root root 4096 Sep 6 2009 procedures
binaries
is the directory where the compiled
programs will stay and build
is where the
programs will be built with Buildfile
:
f_build () { $SOURCES_DIR/configure --prefix=/usr \ && make && make DESTDIR=$INSTALL_DIR install } f_clean () { return 0 }
In patch
put the patches. In
procedures
create the following files:
Configure Postinstall Postremove Preinstall Preremove
for a future use. Meta datas for the package are in the
directory infos
:
Architecture Category Depends Description Maintainer Version
And put the sources of the program in the directory
sources
. Then, build the program using
build
and create the package using:
wkpkg <package_name>
and create the binary package:
wkpkg -b <package_name>
Install python:
wkpkg -i python
Install freetype2:
wkpkg -i freetype2
Install fontconfig:
wkpkg -i fontconfig
Install libpng:
wkpkg -i libpng
Make xmlto running: ?
configure-docbook-sxl.sh
Set environment
export SOURCE=/tmp/src export PREFIX=/tmp/modular
Get the build tree
mkdir /tmp/src; cd /tmp/src git clone git://anongit.freedesktop.org/git/xorg/util/modular util/modular ./util/modular/build.sh $PREFIX --clone --cmd "git pull"
Get a mirror copy of Xorg tree
With FTP (prefered):
wget --recursive --no-host-directories --cut-dirs=3 \ --retr-symlinks ftp://ftp.x.org/pub/X11R7.2/src/
With HTTP:
wget --recursive --no-host-directories --cut-dirs=3 \ --reject "index*,*.gif,*.png" \ http://www.x.org/releases/X11R7.2/src/
Compile xcb-proto, libxcb, fontcacheproto
cd /wakes/xorg-2/src/extras tar -xjf xcb-proto-1.0.tar.bz2 cd xcb-proto-1.0 ./configure --prefix=/wakes/xorg-2/build make make install cd /wakes/xorg-2/src/extras tar -xjf libxcb-1.0.tar.bz2 cd libxcb-1.0 export PKG_CONFIG_PATH=/wakes/xorg-2/build/lib/pkgconfig ./configure --prefix=/wakes/xorg-2/build make make install cd /wakes/xorg-2/src/proto tar -xjf fontcacheproto-X11R7.0-0.1.2.tar.bz2 cd fontcacheproto-X11R7.0-0.1.2 ./configure --prefix=/wakes/xorg-2/build make make install if it fails because of ft_isdigit, just restart the build script.
Using build-from-tarballs.sh script (maybe deprecated....):
./build-from-tarballs.sh -e -bz2 /path/to/xorg.freedesktop.org/archive/X11R7.2/src/everything/
Short version: 1. download everything from http://xorg.freedesktop.org/archive/X11R7.3/src/everything/ 2. download damageproto 1.1 separately (http://xorg.freedesktop.org/archive/individual/proto/damageproto-1.1.0.tar.bz2) 3. download latest Mesa3D and unpack it somewhere near 4. download the build-from-tarballs.sh script (http://gitweb.freedesktop.org/?p=xorg/util/modular.git;a=blob_plain;f=build-from-tarballs.sh) 5. assuming you're installing to /usr/X11R7.3: - export PATH=/usr/X11R7.3/bin:$PATH - export PKG_CONFIG_PATH=/usr/X11R7.3/lib/pkgconfig:$PKG_CONFIG_PATH 6. ./build-from-tarballs.sh -m PATH_TO_MESA -n -bz2 -e /usr/X11R7.3
Xorg 7.5
for pkg in python freetype2 libpng pixman do wkpkg -i $pkg done configure-docbook-sxl.sh build_root=/wakes/xorg-1 mkdir $build_root mkdir $build_root/src mkdir $build_root/build cd $build_root/src wget --continue --recursive --no-host-directories \ --cut-dirs=3 --retr-symlinks --accept "*.bz2" \ --exclude-directories="pub/X11R7.5/src/everything" \ ftp://ftp.x.org/pub/X11R7.5/src/ #for module in proto util pthread-stubs libxcb #do # git clone git://anongit.freedesktop.org/git/xcb/$module xcb/$module #done mkdir xcb cd xcb for pkg in xcb-proto-1.7.1.tar.bz2 xcb-util-0.3.8.tar.bz2 \ libpthread-stubs-0.3.tar.bz2 libxcb-1.8.1.tar.bz2 do wget http://xcb.freedesktop.org/dist/$pkg tar -xjf $pkg done mv xcb-proto-1.7.1 proto mv xcb-util-0.3.8 util mv libpthread-stubs-0.3 pthread-stubs mv libxcb-1.8.1 libxcb rm *.bz2 cd .. wget http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.9.0.tar.gz tar -xzf fontconfig-2.9.0.tar.gz mv fontconfig-2.9.0 fontconfig rm fontconfig-2.9.0.tar.gz # mesa mkdir mesa cd mesa wget http://dri.freedesktop.org/libdrm/libdrm-2.4.34.tar.bz2 wget ftp://ftp.freedesktop.org/pub/mesa/8.0.2/MesaLib-8.0.2.tar.bz2 wget ftp://ftp.freedesktop.org/pub/mesa/demos/8.0.1/mesa-demos-8.0.1.tar.bz2 tar -xjf libdrm-2.4.34.tar.bz2 tar -xjf MesaLib-8.0.2.tar.bz2 tar -xjf mesa-demos-8.0.1.tar.bz2 mv libdrm-2.4.34 drm mv Mesa-8.0.2/ mesa mv mesa-demos-8.0.1 demos cd .. # XKeyboardConfig wget http://xlibs.freedesktop.org/xkbdesc/xkeyboard-config-2.0.tar.bz2 tar -xjf xkeyboard-config-2.0.tar.bz2 mv xkeyboard-config-2.0 xkeyboard-config rm xkeyboard-config-2.0.tar.bz2 cd .. git clone git://anongit.freedesktop.org/git/xorg/util/modular util/modular ./util/modular/build.sh --autoresume modules.run $build_root/build
Table of Contents
Download the latest Wakes version on www.gnuwakes.org, section "Downloads".
Table of Contents
Starting SeaBIOS (version 0.5.1-20100223_133805-squirrel.codemonkey.ws) gPXE (http://etherboot.org) - 00:03.0 C900 PCI2.10 PnP BBS PMM07E0@10 C900 Booting from CD-Rom... 902MB medium detected ISOLINUX 3.36 Debian-2007-08-30 Copyright (C) 1994-2007 H. Peter Anvin __ __ _ \ \ / / | | \ \ /\ / /_ _| | _____ ___ \ \/ \/ / _` | |/ / _ \/ __| \ /\ / (_| | < __/\__ \ \/ \/ \__,_|_|\_\___||___/ The Wakes GNU/Linux Operating System Loading vmlinuz............................................................ Loading initrd.gz............................................................... ................................. Ready.
__ __ _ \ \ / / | | \ \ /\ / /_ _| | _____ ___ \ \/ \/ / _` | |/ / _ \/ __| \ /\ / (_| | < __/\__ \ \/ \/ \__,_|_|\_\___||___/ A GNU/Linux operating system. Starting udev...............................................[ OK ] Setting hostname............................................[ OK ] Configuring loopback interface..............................[ OK ] Generating dropbear key.....................................[ OK ] Enter your keyboard layout [us]:
******************************* Wakes GNU/Linux 0.4 Installation [1] - Install Wakes on your hard disk [2] - Boot from the hard disk [0] - Exit to shell Choice:
Are you sure do you want to proceed to installation ? [Ynq]
Disk(s) attached to the system: [1] - /dev/sda: 21.4 GB [0] - Cancel Enter the disk where to install the system:
Select a partitioning strategy [1] - Automatic partitioning on the entire disk [2] - Manual partitioning with fdisk [3] - No partitioning, my disk is already partitioned [0] - Cancel Choice:
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklab el Building a new DOS disklabel with disk identifier 0xef380ca4. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. The number of cylinders for this disk is set to 1305. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Command (m for help):
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1305, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305): +128M Command (m for help): p Disk /dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xef380ca4 Device Boot Start End Blocks Id System /dev/sda1 1 16 128488+ 83 Linux Command (m for help):
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (17-1305, default 17): Using default value 17 Last cylinder or +size or +sizeM or +sizeK (17-1305, default 1305): Using default value 1305 Command (m for help): p Disk /dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xef380ca4 Device Boot Start End Blocks Id System /dev/sda1 1 16 128488+ 83 Linux /dev/sda2 17 1305 10353892+ 83 Linux Command (m for help):
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
Disk /dev/sda: 10.7 GB, 10737418240 bytes Device Boot Start End Blocks Id System /dev/sda1 1 16 128488+ 83 Linux /dev/sda2 17 1305 10353892+ 83 Linux Enter the root partition for the installation (/ partition):
All data on /dev/sda2 will be lost. Continue ? [Ynq]
mke2fs 1.40.8 (13-Mar-2008) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 582912 inodes, 2328576 blocks 116428 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2386558976 72 block groups 32768 blocks per group, 32768 fragments per group 8096 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 21 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. Creating swap logical volume... Logical volume "swap" created Formating swap partition... Setting up swapspace version 1, size = 134213632 bytes UUID=d6075ea7-d20c-4fb0-8918-21c77651f997 Creating root tree...OK
Disk /dev/sda: 21.4 GB, 21474836480 bytes Device Boot Start End Blocks Id System /dev/sda1 1 17 136521 83 Linux /dev/sda2 18 2610 20828272+ 83 Linux Enter the boot installation device (/boot partition):
Format partition ? [Ynq]
mke2fs 1.40.2 (12-Jul-2007) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 34136 inodes, 136520 blocks 6826 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=67371008 17 block groups 8192 blocks per group, 8192 fragments per group 2008 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 27 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. Mounting /boot partition...OK
TimeZone selection. Please select a continent or ocean. 1) Africa 2) Americas 3) Antarctica 4) Arctic Ocean 5) Asia 6) Atlantic Ocean 7) Australia 8) Europe 9) Indian Ocean 10) Pacific Ocean #?
Please select a country. 1) Aaland Islands 18) Greece 35) Norway 2) Albania 19) Guernsey 36) Poland 3) Andorra 20) Hungary 37) Portugal 4) Austria 21) Ireland 38) Romania 5) Belarus 22) Isle of Man 39) Russia 6) Belgium 23) Italy 40) San Marino 7) Bosnia & Herzegovina 24) Jersey 41) Serbia 8) Britain (UK) 25) Latvia 42) Slovakia 9) Bulgaria 26) Liechtenstein 43) Slovenia 10) Croatia 27) Lithuania 44) Spain 11) Czech Republic 28) Luxembourg 45) Sweden 12) Denmark 29) Macedonia 46) Switzerland 13) Estonia 30) Malta 47) Turkey 14) Finland 31) Moldova 48) Ukraine 15) France 32) Monaco 49) Vatican City 16) Germany 33) Montenegro 17) Gibraltar 34) Netherlands #?
Wakes depot selection [1] - cdrom [2] - disk [3] - network [0] - Cancel Choose depot source:
Network configuration [1] - DHCP [2] - Static IP [0] - Cancel Select an IP configuration:
Choose one or more categories to install 1 [x] coreos 2 [ ] crypt 3 [ ] devel 4 [ ] internet 5 [ ] multimedia 6 [ ] science 7 [ ] servers 8 [ ] virt 9 [ ] x11 0 - OK Select a category:
Installing operting system (coreos) installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/amanda.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/apg.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/bash.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/bc.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/binutils.wkb
installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/sysvinit.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/tar.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/tcsh.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/texinfo.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/texlive.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/transfig.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/ucspi-tcp.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/udev.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/unzip.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/util-linux-ng.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/vim.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/w3m.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/wakesbook.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/wget.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/which.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/wkpkg.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/wmclock.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/xfig.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/xinetd.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/xmlto.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/xz-utils.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/zip.wkb installing /root/var/wkpkg/mnt/cdrom/depot/0.4/main/binaries/i686/zlib.wkb
Installing config files...OK Configuring fstab...OK Configuring network script...OK Configuring TimeZone...OK Installation is done, press enter to reboot.
GNU GRUB version 0.97 (637K lower / 130036K upper memory) +-------------------------------------------------------------------------+ | Wakes GNU/Linux 0.4, kernel 3.12.20 | | | | | | | | | | | | | | | | | | | | | | | +-------------------------------------------------------------------------+ Use the and keys to select which entry is highlighted. Press enter to boot the selected OS, 'e' to edit the commands before booting, or 'c' for a command-line. The highlighted entry will be booted automatically in 10 seconds.
Setting the console log level to 1..........................[ OK ] Populating /dev with device nodes...........................[ OK ] Creating volume groups nodes................................[ OK ] Activating all swap files/partitions........................[ OK ] Recording existing mounts in /etc/mtab......................[ OK ] Cleaning file systems.......................................[ OK ] Retrying failed uevents, if any.............................[ OK ] Bringing up the loopback interface..........................[ OK ] Setting hostname to devlab..................................[ OK ] ############################################################################## # # # Starting runlevel 3 boot scripts # # # ############################################################################## Starting system log daemon..................................[ OK ] Starting kernel log daemon..................................[ OK ] pumping interface eth0 for dhcp.............................[ OK ] Generating public/private rsa key pair......................[ OK ] Starting SSH Server.........................................[ OK ] Welcome to the Wakes GNU/Linux operating system ! devlab login:
Table of Contents
Table of Contents
At the prompt, run the following command to modify the keyboard layout to the French keymap:
loadkeys fr
Table of Contents
X11 forwarding is disabled by default. To enable it, modify the sshd's configuration file /etc/ssh/sshd_config as the following:
sed -i 's/#X11Forwarding no/X11Forwarding yes/' /etc/ssh/sshd_config
And then reload OpenSSH daemon:
/etc/rc.d/init.d/sshd reload
The current connection may not survive to the daemon's reload...
Table of Contents
First, create a bridge device. Edit the script bridge.sh
:
#!/usr/bin/ksh # Configure a bridge device to use with qemu # Bridged interface if=eth0 # Bridge name bridge=br0 # Bridge network address=192.168.1.7 netmask=255.255.255.0 gateway=192.168.1.1 broadcast=192.168.1.255 case $1 in start) print "Configure $bridge bridge..." brctl addbr $bridge print "Add $if on $bridge..." brctl addif $bridge $if print "Activating promiscuous mode on $if..." ip addr flush dev $if ip link set $if promisc on ip link set up dev $if print "IP address on $bridge..." ip addr add $address/$netmask broadcast $broadcast dev $bridge ip link set $bridge up print "Set default route..." ip route add default via $gateway ;; stop) ip link set $bridge down brctl delbr $bridge ip addr flush dev $if ip link set $if promisc off ip link set down dev $if ;; *) print -u2 "usage: $0 start|stop" exit 1 ;; esac exit 0
Run the script to create the bridge:
./bridge.sh start
Then, edit the script that will add the qemu tap device on the bridge (/etc/qemu-ifup
):
#!/usr/bin/ksh tap=$1 bridge=br0 # put the $tap interface up ip link set up dev $tap # adding $tap to bridge interface $bridge... brctl addif $bridge $tap exit 0
You can now run qemu with tap network interfaces.
This is the command to launch Qemu with the previous kernel on a x86_64 plateform with a vnc output:
qemu-system-x86_64 \ -snapshot \ -curses \ -no-kqemu \ -hda /dev/sda \ -kernel /usr/src/linux-2.6.26.5/arch/x86/boot/bzImage \ -append "root=/dev/hda1" \ -vnc www.gnuwakes.org:0
Explanation:
-snapshot Write to temporary files instead of disk image files. In this case, the raw disk image you use is not written back. -hda file -hdb file -hdc file -hdd file Use file as hard disk 0, 1, 2 or 3 image. -vnc d Normally, QEMU uses SDL to display the VGA output. With this option, you can have QEMU listen on VNC display d and redirect the VGA display over the VNC session. -kernel bzImage Use bzImage as kernel image. -append cmdline Use cmdline as kernel command line "root=/dev/hda1" ==> /dev/sda1 (if physical disk is SATA) -initrd file Use file as initial ram disk.
To launch Qemu on an x86 compatible architecture without kqemu, on a physical disk image with the newly compiled kernel:
qemu \ -no-kqemu \ -hda /dev/sda \ -kernel /usr/src/linux-2.6.26.5/arch/x86/boot/bzImage \ -append "root=/dev/hda1"
Pay attention to the file /etc/fstab
when trying to boot on a physical partition. The root device with Qemu is always an hda device (ie /dev/hda1
), but on your machine it can be something else, like /dev/sda1
. Example of /etc/fstab
when booting your physical machine:
# cat /etc/fstab /dev/sda1 / ext3 errors=remount-ro 0 1 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0
When booting with Qemu, it must seem like this:
# cat /etc/fstab /dev/hda1 / ext3 errors=remount-ro 0 1 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0
To run Qemu with a bridged network and VNC, run:
#!/usr/bin/ksh root=/wakes/vm image=$root/devlab.img pidfile=$root/devlab.pid memory=128 tap=tap1 vnc=1 mac=52:54:00:12:34:58 case $1 in start) # with tun/tap network /usr/local/bin/qemu -daemonize -M pc -m $memory -hda $image \ -pidfile $pidfile -net nic,vlan=0,macaddr=$mac \ -net tap,vlan=0,ifname=$tap,script=/etc/qemu-ifup \ -boot c -vnc :$vnc -localtime -k fr ;; stop) kill $(cat $pidfile) rm $pidfile ;; console) vncviewer :$vnc ;; install) /usr/local/bin/qemu -M pc -m $memory -hda $image -localtime \ -net nic,vlan=0,macaddr=$mac \ -net tap,vlan=0,ifname=$tap,script=/etc/qemu-ifup \ -boot d -cdrom /wakes/iso/wakes.iso -vnc :$vnc -k fr ;; esac exit 0
And without VNC:
#!/usr/bin/ksh root=$(cd $(dirname $(readlink -f $0))/..; pwd) vm_name=$(basename $0 .sh) img=$root/vmdisk/$vm_name.img pidfile=$root/vmdisk/$vm_name.pid qemu=/usr/kvm/bin/qemu-system-x86_64 mac=$(print $vm_name | md5sum | \ sed 's/^\(..\)\(..\)\(..\)\(..\).*$/52:54:\1:\2:\3:\4/') [ ! -f "$img" ] && qemu-img create $img 10G case $1 in install) $qemu -boot d -hda $img \ -cdrom $root/iso/wakes-alpha1-001-i386.iso ;; start) $qemu -boot c -hda $img -pidfile $pidfile \ -net nic,vlan=0,macaddr=$mac \ -net tap,vlan=0,ifname=$vm_name,script=/etc/qemu-ifup ;; stop) kill $(cat $pidfile) rm $pidfile ;; *) print -u2 "usage: $0 install|start|stop" exit 1 ;; esac exit 0
Comment out the following lines in
/scripts/init-top/console_setup
in initrd:
if [ -f /etc/console-setup/boottime.kmap.gz ] && type loadkeys >/dev/null; then eval loadkeys /etc/console-setup/boottime.kmap.gz $verbose fi
#!/usr/bin/ksh root=$(cd $(dirname $(readlink -f $0))/..; pwd) wakes=/windows/perso/wakes mem=512 vm_name=$(basename $0 .sh) img=$wakes/vmdisk/$vm_name.img pidfile=$wakes/vmdisk/$vm_name.pid qemu=/usr/kvm/bin/qemu-system-x86_64 cdrom=$wakes/iso/wakes-full-alpha1-???-i386.iso mac=$(print $vm_name | md5sum | \ sed 's/^\(..\)\(..\)\(..\)\(..\).*$/52:54:\1:\2:\3:\4/') [ ! -f "$img" ] && qemu-img create $img 10G case $1 in install) $qemu -name $vm_name -boot once=d -hda $img -cdrom $cdrom ;; start) $qemu -name $vm_name -boot c -hda $img -pidfile $pidfile -cdrom $cdrom \ -net nic,vlan=0,macaddr=$mac -m $mem -vga vmware -k fr \ -net tap,vlan=0,ifname=$vm_name,script=/etc/qemu-ifup ;; stop) kill $(cat $pidfile) rm $pidfile ;; ssh) xterm -T $vm_name -bg black -fg green -e \ ssh -Y -o StrictHostKeyChecking=no $vm_name 2> /dev/null & ;; ncurses_start) xterm -geometry 80x25 -title "$vm_name console" -e \ $qemu -name $vm_name -boot c \ -drive file=$img,if=virtio,index=0,media=disk,boot=on \ -pidfile $pidfile -cdrom $cdrom \ -net nic,vlan=0,macaddr=$mac,model=virtio -m $mem -vga vmware -curses \ -net tap,vlan=0,ifname=$vm_name,script=/etc/qemu-ifup 2> /dev/null & ;; failsafe) xterm -geometry 80x25 -title "$vm_name console" -e \ $qemu -name $vm_name -boot c \ -drive file=$img,if=virtio,index=0,media=disk,boot=on \ -pidfile $pidfile -cdrom $cdrom \ -kernel /boot/vmlinuz-failsafe -initrd /boot/initrd-failsafe \ -append "root=/dev/mapper/rootvg-lvol0" \ -net nic,vlan=0,macaddr=$mac,model=virtio -m $mem -vga vmware -curses \ -net tap,vlan=0,ifname=$vm_name,script=/etc/qemu-ifup 2> /dev/null & ;; *) print -u2 "usage: $0 install|start|stop|ncurses_start|ssh" exit 1 ;; esac exit 0
First, create the allno.config
file. This file will be used to compile a Qemu compatible kernel.
cat << EOF > allno.config # allno.config CONFIG_BINFMT_ELF=y CONFIG_IDE=y CONFIG_BLK_DEV_IDE=y CONFIG_HAVE_IDE=y CONFIG_BLK_DEV_IDEDISK=y CONFIG_IDE_GENERIC=y CONFIG_VIDEO_SELECT=y CONFIG_EXT3_FS=y CONFIG_MPENTIUMII=y CONFIG_SYSVIPC=y CONFIG_TMPFS=y CONFIG_IOSCHED_DEADLINE=y CONFIG_NET=y CONFIG_UNIX=y CONFIG_INET=y CONFIG_PACKET=y CONFIG_NETDEVICES=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y CONFIG_IP_MULTICAST=y CONFIG_IP_MROUTE=y CONFIG_BLK_DEV_INITRD=y CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y CONFIG_ISO9660_FS=y CONFIG_JOLIET=y CONFIG_UDF_FS=y CONFIG_UDF_NLS=y CONFIG_BLK_DEV_IDECD=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y EOF
Then compile the kernel.
make mrproper make allnoconfig make
Explanation:
"make config" Plain text interface. "make menuconfig" Text based color menus, radiolists & dialogs. "make xconfig" X windows (Qt) based configuration tool. "make gconfig" X windows (Gtk) based configuration tool. "make oldconfig" Default all questions based on the contents of your existing ./.config file and asking about new config symbols. "make silentoldconfig" Like above, but avoids cluttering the screen with questions already answered. "make defconfig" Create a ./.config file by using the default symbol values from arch/$ARCH/defconfig. "make allyesconfig" Create a ./.config file by setting symbol values to 'y' as much as possible. "make allmodconfig" Create a ./.config file by setting symbol values to 'm' as much as possible. "make allnoconfig" Create a ./.config file by setting symbol values to 'n' as much as possible. "make randconfig" Create a ./.config file by setting symbol values to random values. The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also use the environment variable KCONFIG_ALLCONFIG to specify a filename that contains config options that the user requires to be set to a specific value. If KCONFIG_ALLCONFIG=filename is not used, "make *config" checks for a file named "all{yes/mod/no/random}.config" for symbol values that are to be forced. If this file is not found, it checks for a file named "all.config" to contain forced values.
In our case, the make allnoconfig
variants will check for the file allno.config
for symbol values that are to be forced (if the environment variable KCONFIG_ALLCONFIG
is not used).
kernel allno.config with sda disk support:
######################################## # Executable file formats / Emulations # ######################################## # Kernel support for ELF binaries CONFIG_BINFMT_ELF=y ################ # File systems # ################ # Ext3 journalling file system support CONFIG_EXT3_FS=y # /proc file system support CONFIG_PROC_FS=y # Virtual memory file system support (former shm fs) CONFIG_TMPFS=y # Inotify file change notification support CONFIG_INOTIFY=y # Inotify support for userspace CONFIG_INOTIFY_USER=y # ISO 9660 CDROM file system support CONFIG_ISO9660_FS=y ############################### # Processor type and features # ############################### # Pentium-II/Celeron(pre-Coppermine) CONFIG_MPENTIUMII=y # Paravirtualized guest support CONFIG_PARAVIRT_GUEST=y # KVM Guest support CONFIG_KVM_GUEST=y # KVM paravirtualized clock CONFIG_KVM_CLOCK=y ################# # General setup # ################# # Prompt for development and/or incomplete code/drivers CONFIG_EXPERIMENTAL=y # System V IPC CONFIG_SYSVIPC=y # Initial RAM filesystem and RAM disk (initramfs/initrd) support CONFIG_BLK_DEV_INITRD=y # Optimize for size CONFIG_CC_OPTIMIZE_FOR_SIZE=y # Kernel .config support CONFIG_IKCONFIG=y # Enable access to .config through /proc/config.gz CONFIG_IKCONFIG_PROC=y ########################## # Enable the block layer # ########################## # Enable the block layer CONFIG_BLOCK=y # Deadline I/O scheduler CONFIG_IOSCHED_DEADLINE=y ###################### # Networking support # ###################### # Networking support CONFIG_NET=y # Packet socket #CONFIG_PACKET=y # Unix domain sockets CONFIG_UNIX=y # TCP/IP networking CONFIG_INET=y ########################## # Bus options (PCI etc.) # ########################## # PCI support CONFIG_PCI=y ################## # Device Drivers # ################## # Block devices CONFIG_BLK_DEV=y # Virtio block driver (EXPERIMENTAL) CONFIG_VIRTIO_BLK=y # Network device support CONFIG_NETDEVICES=y # Ethernet (10 or 100Mbit) CONFIG_NET_ETHERNET=y # EISA, VLB, PCI and on board controllers CONFIG_NET_PCI=y # RealTek RTL-8139 C+ PCI Fast Ethernet Adapter support CONFIG_8139CP=y # PCI NE2000 and clones support (This driver also works for RealTek RTL-8029) CONFIG_NE2K_PCI=y # Virtio network driver (EXPERIMENTAL) CONFIG_VIRTIO_NET=y # Serial ATA (prod) and Parallel ATA (experimental) CONFIG_ATA=y # ATA SFF support (SFF is the legacy IDE interface) CONFIG_ATA_SFF=y # Intel PATA MPIIX support CONFIG_ATA_PIIX=y # SCSI device support CONFIG_SCSI=y # SCSI disk support CONFIG_BLK_DEV_SD=y # SCSI CDROM support CONFIG_BLK_DEV_SR=y # Multiple devices driver support (RAID and LVM) CONFIG_MD=y # Device mapper support CONFIG_BLK_DEV_DM=y ################## # Virtualization # ################## # Virtualization CONFIG_VIRTUALIZATION=y # PCI driver for virtio devices (EXPERIMENTAL) CONFIG_VIRTIO_PCI=y
With modules support:
# Enable loadable module support CONFIG_MODULES=y # Module unloading CONFIG_MODULE_UNLOAD=y ######################################## # Executable file formats / Emulations # ######################################## # Kernel support for ELF binaries CONFIG_BINFMT_ELF=y ################ # File systems # ################ # Ext3 journalling file system support CONFIG_EXT3_FS=m # /proc file system support CONFIG_PROC_FS=y # Virtual memory file system support (former shm fs) CONFIG_TMPFS=y # Inotify file change notification support CONFIG_INOTIFY=y # Inotify support for userspace CONFIG_INOTIFY_USER=y # ISO 9660 CDROM file system support CONFIG_ISO9660_FS=m ############################### # Processor type and features # ############################### # Pentium-II/Celeron(pre-Coppermine) CONFIG_MPENTIUMII=y # Paravirtualized guest support CONFIG_PARAVIRT_GUEST=y # KVM Guest support CONFIG_KVM_GUEST=y # KVM paravirtualized clock CONFIG_KVM_CLOCK=y ################# # General setup # ################# # Prompt for development and/or incomplete code/drivers CONFIG_EXPERIMENTAL=y # System V IPC CONFIG_SYSVIPC=y # Initial RAM filesystem and RAM disk (initramfs/initrd) support CONFIG_BLK_DEV_INITRD=y # Optimize for size CONFIG_CC_OPTIMIZE_FOR_SIZE=y # Kernel .config support CONFIG_IKCONFIG=y # Enable access to .config through /proc/config.gz CONFIG_IKCONFIG_PROC=y ########################## # Enable the block layer # ########################## # Enable the block layer CONFIG_BLOCK=y # Deadline I/O scheduler CONFIG_IOSCHED_DEADLINE=y ###################### # Networking support # ###################### # Networking support CONFIG_NET=y # Packet socket #CONFIG_PACKET=y # Unix domain sockets CONFIG_UNIX=m # TCP/IP networking CONFIG_INET=y ########################## # Bus options (PCI etc.) # ########################## # PCI support CONFIG_PCI=y ################## # Device Drivers # ################## # Block devices CONFIG_BLK_DEV=y # Virtio block driver (EXPERIMENTAL) CONFIG_VIRTIO_BLK=m # Network device support CONFIG_NETDEVICES=y # Ethernet (10 or 100Mbit) CONFIG_NET_ETHERNET=y # EISA, VLB, PCI and on board controllers CONFIG_NET_PCI=y # RealTek RTL-8139 C+ PCI Fast Ethernet Adapter support CONFIG_8139CP=m # PCI NE2000 and clones support (This driver also works for RealTek RTL-8029) CONFIG_NE2K_PCI=m # Virtio network driver (EXPERIMENTAL) CONFIG_VIRTIO_NET=m # Serial ATA (prod) and Parallel ATA (experimental) CONFIG_ATA=m # ATA SFF support (SFF is the legacy IDE interface) CONFIG_ATA_SFF=y # Intel PATA MPIIX support CONFIG_ATA_PIIX=m # SCSI device support CONFIG_SCSI=m # SCSI disk support CONFIG_BLK_DEV_SD=m # SCSI CDROM support CONFIG_BLK_DEV_SR=m # Multiple devices driver support (RAID and LVM) CONFIG_MD=y # Device mapper support CONFIG_BLK_DEV_DM=m ################## # Virtualization # ################## # Virtualization CONFIG_VIRTUALIZATION=y # PCI driver for virtio devices (EXPERIMENTAL) CONFIG_VIRTIO_PCI=m
Java installation:
cd /usr/lib/seamonkey-1.1.9/plugins ln -s /usr/java/plugin/i386/ns7/libjavaplugin_oji.so . export PATH=$PATH:/usr/java/bin export PLUGIN_HOME=/usr/lib/seamonkey-1.1.9/plugins export JAVA_HOME=/usr/java http://java.com/en/download/installed.jsp
Create new public key pair:
silcd -C /etc/silc
Adjust private key permissions:
chmod 600 /etc/silc/silcd.prv
To allow remote connections, modify /etc/silc/silcd.conf
:
Secondary { ip = "192.168.1.7"; port = 706; };
add the group nobody
:
groupadd nobody
start the silc server:
silcd
and run the silc client:
silc -c 192.168.1.7
adjust /usr/share/fvwm/system.fvwm2rc
:
+ "Chat%mini.telnet.xpm%" Exec exec \ xterm -title Chat -geometry 80x24-0+0 -name Chat -e silc -c 192.168.1.7
Install MySQL package:
wkpkg -i mysql
Install mysql
group:
groupadd mysql
Install mysql
user:
useradd -g mysql mysql
Make /var/mysql
writable for
mysql
user:
chown mysql:mysql /var/mysql
Install initial database:
mysql_install_db --user=mysql
Start MySQL server:
/usr/share/mysql/mysql.server start
Other MySQL commands:
/usr/bin/mysql_secure_installation mysqladmin -u root password 'new-password' mysqladmin -u root -h devlab01 password 'new-password' #/usr/bin/mysqld_safe & #mysqld_safe --user=mysql &
Table of Contents
xterm: /usr/share/X11/app-defaults/XTerm
or /usr/X11R7.5/lib/X11/app-defaults/XTerm
*charClass: 33:48,35:48,37-38:48,43-47:48,58:48,61:48,63-64:48,95:48,126:48
Num lock issue: /usr/share/fvwm/bindings
IgnoreModifiers L25
wallpaper:
xv -root -max -quit picture.jpg
menu font: /usr/share/fvwm/decorations
Table of Contents
watch -n 1 -d grep ^Commit /proc/meminfo
watch -n 1 -d free -m
ps -eo vsz,rss,pid,args | sed 1d | sort -n
sar -r
sar -S
vmstat 1
Program overcommit:
/* * * overcommit.c * * Allocate memory given the size in argument. * * Guillaume Kielwasser 2013/10/12 * */ #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #define VERSION "0.1" char *prog_name = NULL; int usage () { fprintf (stderr, "Usage: %s [-Vh] [-m] mem_Mb\n", prog_name); exit (EXIT_FAILURE); } int main (int argc, char **argv) { int opt; int V_FLAG = 0, H_FLAG = 0, M_FLAG = 0; char *version = VERSION; char *ptr = NULL; size_t mem = 0; unsigned long i = 0; prog_name = argv[0]; while ((opt = getopt (argc, argv, "Vhm")) != -1) { switch (opt) { case 'V': V_FLAG = 1; break; case 'h': H_FLAG = 1; break; case 'm': M_FLAG = 1; break; default: usage (); } } if (V_FLAG) { printf ("%s version %s\n", prog_name, version); return (EXIT_SUCCESS); } if (H_FLAG) usage (); if (argc != optind + 1) usage (); if ((mem = 1024*1024 * (size_t) atoi (argv[optind])) == 0) { fprintf (stderr, "%s: %s not a number\n", prog_name, argv[optind]); exit (EXIT_FAILURE); } if ((ptr = (char *) malloc (mem)) == NULL) { fprintf (stderr, "%s: malloc %lu failed (%s)\n", prog_name, mem, strerror (errno)); exit (EXIT_FAILURE); } if (M_FLAG) { for (i=0; i<mem; i++) memset (ptr++, 0, 1); } while (1) { sleep (1); } return (EXIT_SUCCESS); }
Makefile:
CC = gcc CFLAGS = -s -Wall -O3 overcommit: overcommit.c $(CC) $(CFLAGS) -o overcommit overcommit.c
Set the overcommit_memory tunable to 0:
sysctl -w vm.overcommit_memory=0
Obvious overcommits of address space are refused. Allows overcommit to reduce swap usage. This feature can be very useful because there are a lot of programs that malloc() huge amounts of memory "just-in-case" and don't use much of it.
Example on a system with 2Gb of RAM and 2Gb of swap:
$ grep -E 'MemTotal:|SwapTotal:' /proc/meminfo MemTotal: 1986160 kB SwapTotal: 2030588 kB
asking 3Gb of memory works:
$ ./overcommit 3000
but asking for 3.5Gb is not permitted (considered here as obvious overcommit):
$ ./overcommit 3500 ./overcommit: malloc 3670016000 failed (Cannot allocate memory)
FYI: /proc/meminfo CommitLimit has nothing to do with the obvious limit calculation; it only servers in "never overcommit" mode.
$ grep ^Commit /proc/meminfo CommitLimit: 3023668 kB Committed_AS: 1148268 kB
$ free -m total used free shared buffers cached Mem: 1939 821 1118 0 55 419 -/+ buffers/cache: 345 1593 Swap: 1982 16 1966
./overcommit -m 1000
$ ps -eo vsz,rss,pid,args | grep 'overcommi[t]' 1028160 1024404 6728 ./overcommit -m 1000
$ grep ^Commit /proc/meminfo
CommitLimit: 3023668 kB
Committed_AS: 2170544 kB
$ free -m
total used free shared buffers cached
Mem: 1939 1823 116 0 56 419
-/+ buffers/cache: 1347 592
Swap: 1982 16 1966
$ grep ^Commit /proc/meminfo CommitLimit: 3023668 kB Committed_AS: 1145828 kB
$ free -m total used free shared buffers cached Mem: 1939 821 1117 0 56 419 -/+ buffers/cache: 345 1594 Swap: 1982 16 1966
./overcommit 1000
$ ps -eo vsz,rss,pid,args | grep 'overcommi[t]' 1028160 356 7380 ./overcommit 1000
$ grep ^Commit /proc/meminfo CommitLimit: 3023668 kB Committed_AS: 2170132 kB
$ free -m total used free shared buffers cached Mem: 1939 821 1117 0 56 419 -/+ buffers/cache: 345 1594 Swap: 1982 16 1966
$ grep ^Commit /proc/meminfo CommitLimit: 3023668 kB Committed_AS: 1143952 kB
$ free -m total used free shared buffers cached Mem: 1939 830 1109 0 57 420 -/+ buffers/cache: 352 1587 Swap: 1982 16 1966
./overcommit 2900 &
./overcommit 2900 &
./overcommit 2900 &
$ ps -eo vsz,rss,pid,args | grep 'overcommi[t]' 2973760 356 7941 ./overcommit 2900 2973760 356 7942 ./overcommit 2900 2973760 356 7943 ./overcommit 2900
$ grep ^Commit /proc/meminfo CommitLimit: 3023668 kB Committed_AS: 10053432 kB
total used free shared buffers cached Mem: 1939 830 1109 0 57 420 -/+ buffers/cache: 352 1587 Swap: 1982 16 1966
$ sar -r 14:02:01 kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact 14:03:01 1135508 850652 42,83 58984 430348 1145256 28,51 362912 364516 14:04:01 1134036 852124 42,90 59032 430412 1145320 28,51 364476 364584 14:05:01 1134460 851700 42,88 59108 430292 1145192 28,51 364272 364772 14:06:01 1135304 850856 42,84 59196 430292 10054664 250,32 363160 364884 14:07:01 1134660 851500 42,87 59256 430312 10054680 250,32 363236 364980 14:08:01 1137496 848664 42,73 59360 430296 10054600 250,32 360792 364796 Average: 1142628 843532 42,47 40850 300155 1811622 45,10 361707 352409
$ free -m total used free shared buffers cached Mem: 1939 581 1358 0 4 68 -/+ buffers/cache: 509 1430 Swap: 1982 0 1982
$ grep ^Commit /proc/meminfo CommitLimit: 3023668 kB Committed_AS: 1444952 kB
./overcommit -m 3000
$ free -m total used free shared buffers cached Mem: 1939 1868 71 0 4 74 -/+ buffers/cache: 1789 150 Swap: 1982 1768 214
$ grep ^Commit /proc/meminfo CommitLimit: 3023668 kB Committed_AS: 4497040 kB
./overcommit -m 2000
$ ./overcommit -m 3000 Killed
$ free -m total used free shared buffers cached Mem: 1939 1867 71 0 0 47 -/+ buffers/cache: 1819 120 Swap: 1982 801 1181
$ grep ^Commit /proc/meminfo CommitLimit: 3023668 kB Committed_AS: 3473256 kB
Oct 13 18:04:24 voyager kernel: [158113.978944] Out of memory: Kill process 31659 (overcommit) score 766 or sacrifice child Oct 13 18:04:24 voyager kernel: [158113.978947] Killed process 31659 (overcommit) total-vm:3076160kB, anon-rss:1266632kB, file-rss:364kB
Set the overcommit_memory tunable to 1.
sysctl -w vm.overcommit_memory=1
When this flag is 1, the kernel pretends there is always enough memory until it actually runs out.
$ grep ^Commit /proc/meminfo CommitLimit: 3023668 kB Committed_AS: 1331804 kB
$ free -m total used free shared buffers cached Mem: 1939 575 1363 0 3 83 -/+ buffers/cache: 489 1450 Swap: 1982 0 1982
Let's allocate 95Tb of memory:
./overcommit 100000000
$ ps -eo vsz,rss,pid,args | grep 'overcommi[t]' 102400004160 356 19884 ./overcommit 100000000
$ grep ^Commit /proc/meminfo CommitLimit: 3023668 kB Committed_AS: 102401332116 kB
$ free -m total used free shared buffers cached Mem: 1939 576 1362 0 3 83 -/+ buffers/cache: 490 1449 Swap: 1982 0 1982
$ sar -r 21:00:02 kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact 21:01:02 1558000 428160 21.56 1480 63636 1341020 62.27 136816 172588 21:02:01 1402080 584080 29.41 2520 83792 1338016 33.31 164544 301580 21:03:01 1396800 589360 29.67 2552 88672 615741392 15329.35 165416 305964 21:04:01 1398452 587708 29.59 3312 84956 1333036 33.19 166904 302732 21:05:01 1396364 589796 29.70 3328 85044 1333036 33.19 169356 302828 21:06:01 1391520 594640 29.94 3644 86600 102401333260 2549359.16 172152 304568 21:07:01 1386324 599836 30.20 10256 100260 102401331020 2549359.11 162880 319300 21:08:01 1382360 603800 30.40 10448 100420 102401331660 2549359.12 166580 319156 Average: 537358 1448802 72.94 127415 279140 555181698 13821.67 797146 501741
Set the overcommit_memory tunable to 2.
sysctl -w vm.overcommit_memory=2
When this flag is 2, the kernel uses a "never overcommit" policy that attempts to prevent any overcommit of memory. When overcommit_memory is set to 2, the total committed address space of the system is not permitted to exceed swap plus the vm.overcommit_ratio percentage of physical RAM, ie, the CommitLimit of /proc/meminfo.
$ grep ^Commit /proc/meminfo CommitLimit: 3023668 kB Committed_AS: 1330612 kB
$ free -m total used free shared buffers cached Mem: 1939 594 1344 0 10 100 -/+ buffers/cache: 484 1455 Swap: 1982 0 1982
./overcommit 2000 ./overcommit: malloc 2097152000 failed (Cannot allocate memory)
As 1Gb of memory was already commited (Committed_AS), asking for 2 more Gb is not permitted (limit is CommitLimit).
The buffers remember what's in directories, what file permissions are, and keep track of what memory is being written from or read to for a particular block device. The cache only contains the contents of the files themselves.
Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free. To free pagecache: echo 1 > /proc/sys/vm/drop_caches To free dentries and inodes: echo 2 > /proc/sys/vm/drop_caches To free pagecache, dentries and inodes: echo 3 > /proc/sys/vm/drop_caches As this is a non-destructive operation and dirty objects are not freeable, the user should run `sync' first.
sync && echo 3 > /proc/sys/vm/drop_caches
$ free -m total used free shared buffers cached Mem: 1939 559 1380 0 0 81 -/+ buffers/cache: 477 1462 Swap: 1982 0 1982
find /usr -exec ls -l {} \; > /dev/null 2>&1
$ free -m total used free shared buffers cached Mem: 1939 846 1092 0 147 92 -/+ buffers/cache: 606 1333 Swap: 1982 0 1982
$ free -m total used free shared buffers cached Mem: 1939 552 1386 0 0 77 -/+ buffers/cache: 474 1465 Swap: 1982 0 1982
dd if=/dev/sda of=/dev/null
$ free -m total used free shared buffers cached Mem: 1939 1806 133 0 1219 77 -/+ buffers/cache: 509 1430 Swap: 1982 0 1982
$ free -m total used free shared buffers cached Mem: 1939 557 1381 0 0 78 -/+ buffers/cache: 479 1460 Swap: 1982 0 1982
dd if=/dev/zero of=/tmp/dd.tmp bs=1024 count=1048576
$ free -m total used free shared buffers cached Mem: 1939 1619 319 0 2 1103 -/+ buffers/cache: 513 1425 Swap: 1982 0 1982
$ free -m total used free shared buffers cached Mem: 1939 553 1386 0 0 78 -/+ buffers/cache: 474 1465 Swap: 1982 0 1982
$ dd if=/tmp/dd.tmp of=/dev/null 2097152+0 records in 2097152+0 records out 1073741824 bytes (1.1 GB) copied, 31.8524 s, 33.7 MB/s
$ free -m total used free shared buffers cached Mem: 1939 1591 348 0 1 1111 -/+ buffers/cache: 477 1461 Swap: 1982 0 1982
$ dd if=/tmp/dd.tmp of=/dev/null 2097152+0 records in 2097152+0 records out 1073741824 bytes (1.1 GB) copied, 1.61037 s, 667 MB/s
from http://www.linuxhowtos.org/System/Linux Memory Management.htm
VIRT stands for the virtual size of a process, which is the sum of memory it is actually using, memory it has mapped into itself (for instance the video card's RAM for the X server), files on disk that have been mapped into it (most notably shared libraries), and memory shared with other processes. VIRT represents how much memory the program is able to access at the present moment. RES stands for the resident size, which is an accurate representation of how much actual physical memory a process is consuming. (This also corresponds directly to the %MEM column.) This will virtually always be less than the VIRT size, since most programs depend on the C library. SHR indicates how much of the VIRT size is actually sharable memory or libraries). In the case of libraries, it does not necessarily mean that the entire library is resident. For example, if a program only uses a few functions in a library, the whole library is mapped and will be counted in VIRT and SHR, but only the parts of the library file containing the functions being used will actually be loaded in and be counted under RES.
./overcommit 2000
$ ps -eo vsz,rss,pid,args | grep 'overcommi[t]' 2052160 356 6179 ./overcommit 2000
$ grep ^Vm /proc/6179/status VmPeak: 2052160 kB VmSize: 2052160 kB VmLck: 0 kB VmPin: 0 kB VmHWM: 356 kB VmRSS: 356 kB VmData: 2048048 kB VmStk: 136 kB VmExe: 4 kB VmLib: 1884 kB VmPTE: 32 kB VmSwap: 0 kB
VmPeak peak virtual memory size VmSize total program size VmLck locked memory size VmHWM peak resident set size ("high water mark") VmRSS size of memory portions VmData size of data, stack, and text segments VmStk size of data, stack, and text segments VmExe size of text segment VmLib size of shared library code VmPTE size of page table entries VmSwap size of swap usage (the number of referred swapents)
./overcommit -m 1000
# ps -eo vsz,rss,pid,args | grep 'overcommi[t]' 1028160 1024404 6532 ./overcommit -m 1000
# grep ^Vm /proc/6532/status VmPeak: 1028160 kB VmSize: 1028160 kB VmLck: 0 kB VmPin: 0 kB VmHWM: 1024404 kB VmRSS: 1024404 kB VmData: 1024048 kB VmStk: 136 kB VmExe: 4 kB VmLib: 1884 kB VmPTE: 2028 kB VmSwap: 0 kB
stack.c:
#define SIZE 2147483648 main () { char a[SIZE]; while (1) { sleep (1); } }
gcc -o stack stack.c
ulimit -s unlimited
./stack
$ ps -eo vsz,rss,pid,args | grep 'stac[k]$' 2101176 348 16403 ./stack
$ grep ^Vm /proc/16403/status VmPeak: 2101176 kB VmSize: 2101176 kB VmLck: 0 kB VmPin: 0 kB VmHWM: 348 kB VmRSS: 348 kB VmData: 40 kB VmStk: 2097160 kB VmExe: 4 kB VmLib: 1884 kB VmPTE: 28 kB VmSwap: 0 kB
with command line options
fio --minimal \ --ramp_time=1 \ --runtime=3 \ --prio=0 \ --prioclass=1 \ --name=sread \ --readwrite=read \ --blocksize=1k \ --direct=1 \ --numjobs=2 \ --thread \ --ioscheduler=deadline \ --filename=/dev/sda
with config file
cat <<EOF > sread.fio ; -- start job file -- [sread] ramp_time=1 #loops=2 runtime=5 prio=0 prioclass=1 name=sread readwrite=read blocksize=4k direct=1 numjobs=32 thread ioscheduler=deadline filename=/dev/sda ; -- end job file -- EOF
Run fio against the config file and grab the total IOPS:
fio --minimal sread.fio | cut -d';' -f8 | awk '{ sum+=$1 } END { print sum }'
script:
#!/usr/bin/ksh dir=/sys/kernel/debug/tracing echo function > $dir/current_tracer echo 4096 > $dir/buffer_size_kb echo 1 > $dir/options/latency-format echo $$ > $dir/set_ftrace_pid echo 1 > $dir/tracing_on exec dd if=/dev/sda of=/dev/null bs=512 count=1 iflag=direct
command:
ksh ftrace.sh; echo 0 > /sys/kernel/debug/tracing/tracing_on
look at the trace:
less -FX /sys/kernel/debug/tracing/trace
Get some particular kernel function trace:
buf="" for f in SyS_exec SyS_read submit_bio __elv_add_request \ queue_unplugged dio_await_completion io_schedule \ __switch_to finish_task_switch dio_bio_complete \ dio_complete touch_atime fsnotify SyS_exit_group do buf="$buf: $f|" done re=$(print "$buf" | sed 's/|$//') grep -E "$re" /sys/kernel/debug/tracing/trace
dd-2013 2.... 60685us+: SyS_execve <-sysenter_do_call dd-2013 3.... 101504us+: SyS_read <-sysenter_do_call dd-2013 3.... 101799us+: submit_bio <-__blockdev_direct_IO dd-2013 3d... 101926us+: __elv_add_request <-blk_flush_plug_list dd-2013 3d... 101945us+: queue_unplugged <-blk_flush_plug_list dd-2013 3.... 102216us+: dio_await_completion <-__blockdev_direct_IO dd-2013 3.... 102225us+: io_schedule <-dio_await_completion dd-2013 3d... 102438us!: __switch_to <-__schedule dd-2013 0d... 102958us+: finish_task_switch <-__schedule dd-2013 0.... 103012us+: dio_bio_complete <-dio_await_completion dd-2013 0.... 103105us+: dio_complete <-__blockdev_direct_IO dd-2013 0.... 103147us+: touch_atime <-generic_file_aio_read dd-2013 0.... 103170us+: fsnotify <-vfs_read dd-2013 0.... 114779us+: SyS_exit_group <-sysenter_do_call
Live monitoring
blktrace -d /dev/sda -o - | blkparse -i -
or
btrace /dev/sda
See http://www.cse.unsw.edu.au/~aaronc/iosched/doc/blktrace.html
Trace example:
dd if=/dev/sda of=/dev/null bs=512 count=1 iflag=direct
8,0 0 1 0.000000000 2579 Q R 0 + 1 [dd] 8,0 0 2 0.000044978 2579 G R 0 + 1 [dd] 8,0 0 3 0.000055035 2579 P N [dd] 8,0 0 4 0.000066489 2579 I R 0 + 1 [dd] 8,0 0 5 0.000071797 2579 U N [dd] 1 8,0 0 6 0.000082692 2579 D R 0 + 1 [dd] 8,0 0 7 0.001489854 0 C R 0 + 1 [0]
Explaination:
Q - queued This notes intent to queue io at the given location. No real requests exists yet. G - get request To send any type of request to a block device, a struct request container must be allocated first. P - plug When io is queued to a previously empty block device queue, Linux will plug the queue in anticipation of future ios being added before this data is needed. I - inserted A request is being sent to the io scheduler for addition to the internal queue and later service by the driver. The request is fully formed at this time. U - unplug Some request data already queued in the device, start sending requests to the driver. This may happen automatically if a timeout period has passed (see next entry) or if a number of requests have been added to the queue. D - issued A request that previously resided on the block layer queue or in the io scheduler has been sent to the driver. C - complete A previously issued request has been completed. The output will detail the sector and size of that request, as well as the success or failure of it.
Function trace
Q trace_block_bio_queue -> generic_make_request_checks blk-core.c G trace_block_getrq -> __get_request blk-core.c P trace_block_plug -> blk_queue_bio blk-core.c I trace_block_rq_insert -> __elv_add_request elevator.c U trace_block_unplug -> queue_unplugged blk-core.c D trace_block_rq_issue -> blk_peek_request blk-core.c C trace_block_rq_complete -> blk_update_request blk-core.c
dd-2589 1.... 157357us+: SyS_read <-sysenter_do_call Q dd-2589 1.... 158025us+: generic_make_request_checks <-generic_make_request Q dd-2589 1d... 158082us+: acpi_pm_read <-ktime_get G dd-2589 1d... 158129us+: get_request <-blk_queue_bio G dd-2589 1d... 158178us+: acpi_pm_read <-ktime_get P dd-2589 1.... 158189us+: init_request_from_bio <-blk_queue_bio P dd-2589 1d... 158222us+: acpi_pm_read <-ktime_get I dd-2589 1d... 158277us+: __elv_add_request <-blk_flush_plug_list I dd-2589 1d... 158286us+: acpi_pm_read <-ktime_get U dd-2589 1d... 158322us+: queue_unplugged <-blk_flush_plug_list U dd-2589 1d... 158332us+: acpi_pm_read <-ktime_get D dd-2589 1d... 158363us+: blk_peek_request <-scsi_request_fn D dd-2589 1d... 158396us+: acpi_pm_read <-ktime_get
Version 1.3, 3 November 2008
Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
The purpose of this License is to make a manual, textbook, or other functional and useful document “free” in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.
This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.
We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.
This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.
A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.
A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.
The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.
The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.
A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not “Transparent” is called “Opaque”.
Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.
The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work’s title, preceding the beginning of the body of the text.
The “publisher” means any person or entity that distributes copies of the Document to the public.
A section “Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” of such a section when you modify the Document means that it remains a section “Entitled XYZ” according to this definition.
The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.
You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and you may publicly display copies.
If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.
If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.
It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.
You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:
If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles.
You may add a section Entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties — for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.
You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled “History” in the various original documents, forming one section Entitled “History”; likewise combine any sections Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections Entitled “Endorsements”.
You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.
A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an “aggregate” if the copyright resulting from the compilation is not used to limit the legal rights of the compilation’s users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document’s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.
Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.
If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.
You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it.
The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See Copyleft.
Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Document.
“Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A “Massive Multiauthor Collaboration” (or “MMC”) contained in the site means any set of copyrightable works thus published on the MMC site.
“CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization.
“Incorporate” means to publish or republish a Document, in whole or in part, as part of another Document.
An MMC is “eligible for relicensing” if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing.
To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:
Copyright © YEAR YOUR NAME Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the “with… Texts.” line with this:
with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation.
If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.