Ubuntu 18.04 x86_64定製deepin LiveCD x86 ISO

參考:custom-debian-live-environment

1. 準備工作

安裝製作所需的工具

sudo apt-get install \
    debootstrap \
    squashfs-tools \
    xorriso \
    grub-pc-bin \
    grub-efi-amd64-bin \
    mtools

創建目錄

mkdir $HOME/LIVE_BOOT

2. 系統自舉並配置deepin

安裝自舉系統

sudo debootstrap \
    --arch=i386 \
    --variant=minbase \
    stable \
    $HOME/LIVE_BOOT/chroot \
    http://mirrors.ustc.edu.cn/deepin/

chroot進入deepin環境

sudo chroot $HOME/LIVE_BOOT/chroot

[chroot]後的步驟

設置設置機主機名

echo "deepin-live" > /etc/hostname

查找支持的內核及initrd

apt-cache search linux-image

安裝內核及init進程初始化相關內容

apt-get update && \
apt-get install --no-install-recommends \
    linux-image-686 \
    live-boot \
    systemd-sysv

安裝基本軟件

apt-get install --no-install-recommends \
    network-manager net-tools wireless-tools wpagui \
    curl openssh-client \
    blackbox xserver-xorg-core xserver-xorg xinit xterm \
    vim && \
apt-get clean

安裝deepin DDE界面

apt-get install --no-install-recommends dde dde-file-manager

apt-get install lightdm

apt-get install lightdm-gtk-greeter

編輯$HOME/LIVE_BOOT/chroot/etc/lightdm/lightdm.conf,刪除下面三條語句的註釋並修改爲相應的值

greeter-session=lightdm-gtk-greeter
greeter-show-manual-login=true
user-session=deepin

編輯$HOME/LIVE_BOOT/chroot/root/.profile,增加語言及時區配置

LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:en"
export LANG
export LANGUAGE

TZ='Asia/Shanghai'; export TZ

打開zh_CN.UTF-8的支持

編輯$HOME/LIVE_BOOT/chroot/etc/locale.gen,找到如下語句並刪除前面的註釋

# zh_CN.UTF-8 UTF-8

執行下面的語句進行更新

$HOME/LIVE_BOOT/chroot/usr/sbin/locale-gen

$HOME/LIVE_BOOT/chroot/usr/sbin/update-locale

更改root密碼

passwd root

[chroot]退出

exit

3. 創建deepin LiveCD相關文件

創建配置目錄

mkdir -p $HOME/LIVE_BOOT/{scratch,image/live}

創建squashfs文件

sudo mksquashfs \
    $HOME/LIVE_BOOT/chroot \
    $HOME/LIVE_BOOT/image/live/filesystem.squashfs \
    -e boot

拷貝內核及initrd文件

cp $HOME/LIVE_BOOT/chroot/boot/vmlinuz-* \
    $HOME/LIVE_BOOT/image/vmlinuz && \
cp $HOME/LIVE_BOOT/chroot/boot/initrd.img-* \
    $HOME/LIVE_BOOT/image/initrd

創建grub配置

cat <<'EOF' >$HOME/LIVE_BOOT/scratch/grub.cfg

search --set=root --file /DEEPIN_CUSTOM

insmod all_video

set default="0"
set timeout=30

menuentry "Deepin Live" {
    linux /vmlinuz boot=live quiet
    initrd /initrd
}
EOF

創建CUSTOM文件

touch $HOME/LIVE_BOOT/image/DEEPIN_CUSTOM

4. BIOS引導光盤創建,其它類型的創建參考”custom-debian-live-environment

創建BIOS image

grub-mkstandalone \
    --format=i386-pc \
    --output=$HOME/LIVE_BOOT/scratch/core.img \
    --install-modules="linux normal iso9660 biosdisk memdisk search tar ls" \
    --modules="linux normal iso9660 biosdisk search" \
    --locales="" \
    --fonts="" \
    "boot/grub/grub.cfg=$HOME/LIVE_BOOT/scratch/grub.cfg"

與grub2的cdboot.img進行鏈接

cat \
    /usr/lib/grub/i386-pc/cdboot.img \
    $HOME/LIVE_BOOT/scratch/core.img \
> $HOME/LIVE_BOOT/scratch/bios.img

生成liveCD iso文件

xorriso \
    -as mkisofs \
    -iso-level 3 \
    -full-iso9660-filenames \
    -volid "DEEPIN_CUSTOM" \
    --grub2-boot-info \
    --grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img \
    -eltorito-boot \
        boot/grub/bios.img \
        -no-emul-boot \
        -boot-load-size 4 \
        -boot-info-table \
        --eltorito-catalog boot/grub/boot.cat \
    -output "${HOME}/LIVE_BOOT/deepin-custom.iso" \
    -graft-points \
        "${HOME}/LIVE_BOOT/image" \
        /boot/grub/bios.img=$HOME/LIVE_BOOT/scratch/bios.img

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章