- tar -xzvf linux-major-minor-VERSION.tar.gz -C /usr/src
- cd /usr/src
- ln -sv linux-major-minor-VERSION linux
- make allnoconfig
- make menuconfig
在此处配置的信息:
1. 64-bit kernel
2. Enable loadable module support --> Module unloading
3. Processor type and features --> 默认即可
4. Bus options --> PCI support
5. Executable file formats --> Kernel support for ELF binaries, Write ELF core dumps with partial segments, Kernel support for scripts starting with #!, Kernel support for MISC binaries
6. Network support --> Network options --> TCP/IP networking
7. Device drivers --> Generic Driver Options --> Maintain a devtmpfs filesystem to mount at /dev, Automount devtmpfs at /dev, after the kernel mounted the rootfs
8. SCSI device support --> SCSI device support, SCSI disk support, SCSI low-level drivers --> BusLogic SCSI support
9. Device Drivers --> Fusion MPT device support --> Fusion MPT ScsiHost \*
10. Network device support --> Ethernet driver support
11. Input device support --> Keyboards
12. File systems --> 含有Ext2/3/4的都选上
``
6. make -j 4 bzImage ;; 使用bzImage表示只编译内核, 如果直接使用make表示编译内核和模块
7. 注意这里不适用make moudel_install或者make install, 因为不是要将该内核装在本机上, 而是状态别的硬盘上
8. mkdir /mnt/sysroot
9. 使用fdisk /dev/sdb对目标硬盘进行分区
10. 使用mke2fs -t ext4 /dev/sdb1, mke2fs -t ext4 /dev/sdb2格式化分区
11. mount /dev/sdb2 /mnt/sysroot
12. mkdir /mnt/sysroot/boot
13. grun-install --root-directory=/mnt/sysroot /dev/sdb
14. vim /mnt/sysroot/boot/grub/grub.conf --> 进行配置
default=0
timeout=5
title MyLinux
root (hd0,0)
kernel /bzImage or root=/dev/sda2 init=/bin/bash
15. mkdir -pv /mnt/sysroot/{bin,sbin,lib64,lib,usr/{local/{lib,lib64,bin,sbin}},bin,sbin,lib,lib64} etc tmp var
16. 拷贝一些命令和对应的so文件到对应的目录中
17. cp arsh/x86/boot/bzImage /mnt/sysroot/boot
OK
#### 使用Busybox来提供lib文件
1. tar -xf busybox-major-minor-VERSION.tar.gz -C /usr/src
2. ls -sv busybox-major-minor-VERSION busybox
3. cd busybox
4. make menuconfig
5. 选择通用项, 修改为static安装
5. yum install -y glibc-statis glibs-devel
6. make && make install
7. cp -rv ./_install/* /mnt/sysroot/ --> 替换掉第一个环节的一些目录
8. cd /mnt/sysroot
9. mkdir -pv etc/rc.d
10. vim inittab
格式
id:runlevels:action:process(run command)
::sysinit:/etc/rc.d/rc.sysinit
::respawn:getty 9600 tty1 --> 其中的9600为固定的
::respawn:getty 9600 tty2
::respawn:getty 9600 tty2
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
11. vim etc/rc.d/rc.sysinit
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t ext4 /dev/sda1 /boot
mount -t ext4 -o remount,rw /dev/sda2 /
```
- 也可以填写fstab
- OK
编译安装dropbear
- ./configrue
- make scp && make install --> 使用make scp是为了以后通过ssh连接, 可用scp命令远程复制传输文件
- mkdir /etc/dropbear
- cd /etc/dropbear
- dropbearkey -t rsa -f dropbear_rsa_host_key
- dropbearkey -t dss -f dropbear_dss_host_key
- 启动服务, dropbear -E -F -p 6666