vscode 插件与配置
C
git blame
git len
仓库
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
git 历史补全
git clone --bare git://git.kernel.org/pub/scm/linux/kernel/git/history/history.git
cd linux/.git/
echo ../../../history.git/objects >> objects/info/alternates
echo 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 e7e173af42dbf37b1d946f9ee00219cb3b2bea6a >> info/grafts
echo 7a2deb32924142696b8174cdf9b38cd72a11fc96 379a6be1eedb84ae0d476afbc4b4070383681178 >> info/grafts
git replace --convert-graft-file
编译
sudo apt install git build-essential bc bison flex libssl-dev libncurses-dev libelf-dev qemu-system-x86 libguestfs-tools wget -y
cd linux
make menuconfig
sed -i "s/CONFIG_VIRTIO_PCI=.*/CONFIG_VIRTIO_PCI=y/g" .config
sed -i "s/CONFIG_VIRTIO_BLK=.*/CONFIG_VIRTIO_BLK=y/g" .config
sed -i "s/CONFIG_VIRTIO_NET=.*/CONFIG_VIRTIO_NET=y/g" .config
sed -i "s/CONFIG_EXT4_FS=.*/CONFIG_EXT4_FS=y/g" .config
make bzImage -j`nproc`
# make bindeb-pkg -j`nproc`
使用虚拟机
wget https://cloud.debian.org/images/cloud/buster/20220328-962/debian-10-generic-amd64-20220328-962.qcow2 -O ../vm.qcow2
qemu-img resize vm.qcow2 100G
virt-customize \
--run-command '/bin/bash /bin/growpart /dev/sda 1' \
--run-command 'resize2fs /dev/sda1' -a vm.qcow2
virt-customize \
--run-command 'cn=$(lsb_release -cs); echo "
deb http://mirrors.byted.org/debian $cn main contrib non-free
deb http://mirrors.byted.org/debian $cn-backports main contrib non-free
deb http://mirrors.byted.org/debian-security $cn/updates main contrib non-free
deb http://apt.byted.org/private $cn-private $cn-main" > /etc/apt/sources.list' \
--run-command "sed -i '3d' /etc/fstab" \
--uninstall cloud-init,openssh-server \
--install dhcpcd5,openssh-server \
--root-password password:root \
--ssh-inject root -a vm.qcow2
运行虚拟机
sudo qemu-system-x86_64 \
-enable-kvm \
-nographic \
-drive file=../guest.qcow2,if=virtio \
-device virtio-net,netdev=n0,mac=52:55:00:d1:55:00 \
-netdev user,hostfwd=tcp::2222-:22,id=n0 \
-m 8G \
-smp cores=2,threads=1,sockets=1 \
-object memory-backend-ram,id=mem0,size=4G \
-object memory-backend-ram,id=mem1,size=4G \
-numa node,memdev=mem0,cpus=0,nodeid=0 \
-numa node,memdev=mem1,cpus=1,nodeid=1 \
-kernel arch/x86/boot/bzImage \
-append 'nokaslr root=/dev/vda1 console=ttyS0 earlyprintk=ttyS0'
cat > /etc/systemd/system/serial-getty@ttyS0.service.d/override.conf << EOF
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I $TERM
EOF
|