Code Monkey home page Code Monkey logo

leetcode's People

Stargazers

 avatar

Watchers

 avatar

leetcode's Issues

centos内存镜像打包流程

1.安装febootstrap
https://www.dwhd.org/20160630_111307.html

2.构建目录结构

febootstrap -i bash -i wget -i yum -i telnet -i iputils -i iproute -i vim -i gzip -i tar centos76 centos76-extend http://mirrors.aliyun.com/centos/7/os/x86_64/
chroot ~/febootstrap/centos76-extend yum install elrepo-release -y
chroot ~/febootstrap/centos76-extend/ yum --enablerepo=elrepo-kernel install kernel-ml kernel-ml-devel.x86_64
cd centos76-extend/
time tar -cf - . | xz -v --threads=24 > ~/febootstrap/initramfs/rootfs.tar.xz
cd initramfs/
wget -O ~/febootstrap/initramfs/bin/busybox https://busybox.net/downloads/binaries/1.21.1/busybox-x86_64
cat <<EOF > init 
#!/bin/sh

[ -d /dev ] || mkdir -m 0755 /dev
[ -d /root ] || mkdir -m 0700 /root
[ -d /sys ] || mkdir /sys
[ -d /proc ] || mkdir /proc
[ -d /tmp ] || mkdir /tmp
mkdir -p /var/lock
mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
mount -t proc -o nodev,noexec,nosuid proc /proc
# Some things don't work properly without /etc/mtab.
ln -sf /proc/mounts /etc/mtab

grep -q '\<quiet\>' /proc/cmdline || echo "Loading, please wait..."
# Note that this only becomes /dev on the real filesystem if udev's scripts
# are used; which they will be, but it's worth pointing out
if ! mount -t devtmpfs -o mode=0755 udev /dev; then
        echo "W: devtmpfs not available, falling back to tmpfs for /dev"
        mount -t tmpfs -o mode=0755 udev /dev
        [ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1
        [ -e /dev/null ] || mknod /dev/null c 1 3
fi
mkdir /dev/pts
mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true
mount -t tmpfs -o "noexec,nosuid,size=10%,mode=0755" tmpfs /run
mkdir /run/initramfs
# compatibility symlink for the pre-oneiric locations
ln -s /run/initramfs /dev/.initramfs
# Set modprobe env
export MODPROBE_OPTIONS="-qb"
# mdadm needs hostname to be set. This has to be done before the udev rules are called!
if [ -f "/etc/hostname" ]; then
        /bin/hostname -b -F /etc/hostname 2>&1 1>/dev/null
fi

exec /sbin/init
EOF
find . -print0 | cpio --null -ov --format=newc | gzip -9 > ../build/initramfs.gz

initramfs.gz就是需要的内存镜像,如果需要对内存镜像做定制化处理,可是使用chroot命令。例如:

# 按照包
chroot ~/febootstrap/centos76-extend yum install elrepo-release -y

3.参考链接
https://cloud.tencent.com/developer/article/1454524
https://www.dwhd.org/20160630_111307.html
https://cloud.tencent.com/developer/article/1584786
http://linuxcoming.com/blog/2019/06/21/build_ram_os.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.