[Bug #4900] 更新4.2 700版支持efi说明文档

修改:     4.2-700-efi.md
Signed-off-by: zhang <dpzhang@linx-info.com>
This commit is contained in:
zhang
2020-11-19 09:43:31 +08:00
parent ea5dbd1742
commit 0a40174e94

View File

@@ -4,25 +4,28 @@
[rocky6.0.42.41-x86_64-security-20181101-700.iso](http://42.builder.rd.in.linx/stable-iso/4.2-x86_64-builds/20181101-700/rocky6.0.42.41-x86_64-security-20181101-700.iso)
---------------------
---
### 重新制作initrd.img
### 一、重新制作initrd.img
#### 光盘initrd.img
#### 1.光盘initrd.img
目前光盘引导中的initrd.img为正常安装的700版本系统中的/boot/initrd.img-2.6.32.700-Rocky4.2-x86_64文件重命名
md5=3596a5ee6924547e4c19487039939693
#### initrd解压
#### 2.initrd解压
```
gunzip -S .img initrd.img
cpio -vimd <initrd
```
#### initrd修改
##### 1. 解压后目录结构
#### 3.initrd修改
##### 1 解压后目录结构
```
root@Linx:/tmp/c# ls -l
@@ -37,9 +40,182 @@ drwxr-xr-x 2 root root 4096 5月 23 08:08 lib64
drwxr-xr-x 2 root root 4096 5月 23 08:08 sbin
drwxr-xr-x 6 root root 4096 5月 23 08:08 scripts
```
##### 2. 在bin目录添加list-devices脚本(该脚本来自于4.2 initrd)
##### 2 在bin目录添加list-devices脚本(该脚本来自于4.2 initrd)
```
#! /bin/sh -e
# get from debian-installer-utils list-devices-linux
##### 3. 修改scripts下的local文件
TYPE="$1"
case $TYPE in
maybe-floppy)
#logger -t list-devices "deprecated parameter maybe-floppy"
TYPE=floppy
;;
cd|disk|partition|floppy|maybe-usb-floppy|usb-partition) ;;
*)
echo "Usage: $0 cd|disk|partition|floppy|maybe-usb-floppy|usb-partition" >&2
exit 2
;;
esac
if [ ! -d /sys/block ]; then
exit 0
fi
if type udevadm >/dev/null 2>&1; then
device_info () {
udevadm info -q "$1" -p "$2" 2>/dev/null
}
elif type udevinfo >/dev/null 2>&1; then
device_info () {
udevinfo -q "$1" -p "$2" 2>/dev/null
}
else
exit 0
fi
device_name () {
local name
if ! name="$(device_info name "$1")"; then
name="$(printf %s "${1##*/}" | \
sed 's,!,/,g')"
fi
echo "/dev/$name"
}
is_sataraid () {
grep -qs ^DMRAID- "$1/dm/uuid"
}
is_sataraid_partition () {
# dmraid partitions are always slaved to another dm device
for slave in "$1"/slaves/dm-*; do
if [ -e "$slave" ]; then
return 0
fi
done
return 1
}
if type dmraid >/dev/null 2>&1; then
raiddevs="$(dmraid -r -c || true)"
else
raiddevs=
fi
# cloned-and-hacked from partman-base/init.d/parted
part_of_sataraid () {
local raiddev
for raiddev in $raiddevs; do
if [ "$(readlink -f "$raiddev")" = "$1" ]; then
return 0
fi
done
return 1
}
syspaths=
scan_partition=false
case $TYPE in
partition)
for x in /sys/block/*/*[0-9]; do
[ -d "$x" ] || continue
syspaths="${syspaths:+$syspaths }$x"
done
for x in /sys/block/dm-*; do
[ -d "$x" ] || continue
(is_sataraid "$x" && is_sataraid_partition "$x") || continue
syspaths="${syspaths:+$syspaths }$x"
done
TYPE=disk
# Also allow misdetected USB devices
scan_partition=:
;;
usb-partition)
for x in /sys/block/*/*; do
[ -d "$x" ] || continue
syspaths="${syspaths:+$syspaths }$x"
done
;;
*)
for x in /sys/block/*; do
[ -d "$x" ] || continue
case $x in
/sys/block/dm-*)
if is_sataraid "$x" && is_sataraid_partition "$x"; then
continue
fi
;;
*)
name="$(device_name "$x")"
if part_of_sataraid "$name"; then
continue
fi
;;
esac
syspaths="${syspaths:+$syspaths }$x"
done
;;
esac
for x in $syspaths; do
devpath="${x#/sys}"
match=false
case $TYPE in
floppy)
# TODO ugly special case for non-IDE floppies
case $devpath in
/block/fd[0-9]*)
match=:
;;
esac
;;
esac
if ! $match && [ "$TYPE" = cd ]; then
if device_info env "$devpath" | grep -q '^ID_CDROM='; then
match=:
fi
fi
if ! $match; then
if device_info env "$devpath" | grep -q "^ID_TYPE=$TYPE"; then
match=:
fi
fi
if ! $match && [ "$TYPE" = disk ]; then
case $devpath in
/block/cciss\!*|/block/ida\!*|/block/rd\!*|/block/mmcblk*|/block/vd[a-z]*|/block/xvd[a-z]*)
match=:
;;
/block/dm-*)
# for now, we only understand dmraid
if is_sataraid "/sys$devpath"; then
match=:
fi
;;
esac
fi
# Some USB sticks and CD drives are misdetected as floppy
# This allows to scan for those
if ! $match && ( $scan_partition || [ "$TYPE" = maybe-usb-floppy ] ); then
if device_info env "$devpath" | grep -q '^ID_BUS=usb' && \
device_info env "$devpath" | grep -q '^ID_TYPE=floppy'; then
match=:
fi
fi
# Disk partitions, but only on USB drives
if ! $match && [ "$TYPE" = usb-partition ]; then
if device_info env "$devpath" | grep -q '^ID_BUS=usb' && \
device_info env "$devpath" | grep -q '^ID_TYPE=disk'; then
match=:
fi
fi
if $match; then
device_name "/sys$devpath"
fi
done
```
##### (3)修改scripts下的local文件
```
root@Linx:/tmp# diff -uparN b/scripts/local a/scripts/local
@@ -112,38 +288,38 @@ root@Linx:/tmp# diff -uparN b/scripts/local a/scripts/local
# We've given up, but we'll let the user fix matters if they can
while [ ! -e "${ROOT}" ]; do
```
```
#### initrd压缩
#### 4.initrd压缩
```
find . | cpio -o -H newc | gzip -9 > ../initrd.img
```
--------------------------
---
## 制作镜像
## 二、制作镜像
### 解压镜像
#### 1.解压镜像
```
mount rocky6.0.42.41-x86_64-security-20181101-700.iso /mnt -o loop
mkdir cd2
cp -Ra /mnt/. ./cd2
```
------------------------------------------------------------------------------
### 替换initrd
#### 2.替换initrd
```
cp initrd.img ~/cd2/boot/
```
------------------------------------------------------------------------------
### 添加分区对vfat的支持
##### 1. 修改cd2/usr/lib/new_install/new_partition/interface_partition.py文件
#### 3.添加分区对vfat的支持
##### 1修改cd2/usr/lib/new_install/new_partition/interface_partition.py文件
```
--- /root/cd2/usr/lib/new_install/new_partition/interface_partition.py 2018-10-30 05:30:13.000000000 +0000
@@ -159,7 +335,7 @@ cp initrd.img ~/cd2/boot/
lb_fstype.setCurrent('ext3')
```
##### 2. 修改/root/cd2/usr/lib/new_install/text/ri_newt.py
##### 2修改/root/cd2/usr/lib/new_install/text/ri_newt.py
```
root@Linx:~/cd/usr/lib/new_install# diff -uparN /root/cd2/usr/lib/new_install/text/ri_newt.py text/ri_newt.py
@@ -178,15 +354,15 @@ root@Linx:~/cd/usr/lib/new_install# diff -uparN /root/cd2/usr/lib/new_install/te
------------------------------------------------------------------------------
### 制作efi 启动文件
## 三、制作efi 启动文件
#### 制作用于光盘启动bootx64.efi
#### 1.制作用于光盘启动bootx64.efi
##### 1. 在4.2系统中grub-2.02-beta2/grub-core目录下制作用于光盘启动bootx64.efi
##### 1 在4.2系统中grub-2.02-beta2/grub-core目录下制作用于光盘启动bootx64.efi
编写grub.cfg文件用于初始化efi中的环境变量和找到根引导/boot/grub/x86_64-efi/grub.cfg文件
早期引导的grub.cfg文件如下
早期引导的grub.cfg文件如下(为解决某些机器,如c30不能自动加载grub.cfg问题)
```
search --file /tag --set=root
@@ -200,14 +376,14 @@ configfile $prefix/grub.cfg
../grub-mkimage --config=grub.cfg -O x86_64-efi -d . -o bootx64.efi -p /boot/grub/x86_64-efi part_gpt part_msdos disk fat exfat ext2 ntfs xfs appleldr hfs iso9660 normal search_fs_file configfile linux linux16 chain loopback echo efi_gop efi_uga video_bochs video_cirrus file gfxmenu gfxterm gfxterm_background gfxterm_menu halt reboot help jpeg ls png true
```
##### 2. 拷贝efi所依赖的模块到x86_64-efi目录
##### 2 拷贝efi所依赖的模块到x86_64-efi目录
```
mkdir x86_64-efi
cp *.mod *.lst x86_64-efi/
```
##### 3. 在x86_64-efi目录下编写镜像启动的grub.cfg文件
##### 3在x86_64-efi目录下编写镜像启动的grub.cfg文件
```
set default="0"
@@ -226,7 +402,7 @@ menuentry 'Manu Install Rocky OS 4.2' --class rocky --class gnu-linux --class gn
insmod part_gpt
insmod fat
linux /boot/isolinux/vmlinuzI instmode=Text efimode=y root=/dev/cdrom vga=791 ro
initrd /boot/initrd.img
initrd /boot/isolinux/initrd.img
}
@@ -234,7 +410,7 @@ menuentry 'Auto Install Rocky OS 4.2' --class rocky --class gnu-linux --class gn
insmod part_gpt
insmod fat
linux /boot/isolinux/vmlinuzI instmode=Auto efimode=y root=/dev/cdrom vga=791 ro
initrd /boot/initrd.img
initrd /boot/isolinux/initrd.img
}
@@ -242,7 +418,7 @@ menuentry 'StateGrid AutoInstall Rocky OS 4.2' --class rocky --class gnu-linux -
insmod part_gpt
insmod fat
linux /boot/isolinux/vmlinuzI instmode=StateGrid efimode=y root=/dev/cdrom vga=791 ro
initrd /boot/initrd.img
initrd /boot/isolinux/initrd.img
}
@@ -250,28 +426,28 @@ menuentry 'Dmraid Install Rocky OS 4.2' --class rocky --class gnu-linux --class
insmod part_gpt
insmod fat
linux /boot/isolinux/vmlinuzI instmode=Dmraid efimode=y dmraid=true root=/dev/cdrom vga=791 ro
initrd /boot/initrd.img
initrd /boot/isolinux/initrd.img
}
```
##### 4. 在8.0系统下制作bootx64.img
##### 4 在8.0系统下制作efi.img
```
dd if=/dev/zero of=bootx64.img bs=1M count=20
mkfs.vfat bootx64.img
mount bootx64.img /mnt -o loop
mkfs.vfat efi.img
mount efi.img /mnt -o loop
mkdir -p /mnt/efi/boot/
cp bootx64.efi /mnt/efi/boot/
umount /mnt
cp bootx64.img cd2/boot/grub/
cp efi.img cd2/boot/grub/
cp -r x86_64-efi cd2/boot/grub/
```
#### 制作用于系统启动的bootx64.efi
#### 2.制作用于系统启动的bootx64.efi
##### 1. 在4.2系统中grub-2.02-beta2/grub-core目录下制作用于系统启动的bootx64.efi
##### 1 在4.2系统中grub-2.02-beta2/grub-core目录下制作用于系统启动的bootx64.efi
制作bootx64.efi文件
@@ -280,7 +456,7 @@ cp -r x86_64-efi cd2/boot/grub/
```
##### 2. 将bootx64.efi添加到光盘环境
##### 2将bootx64.efi添加到光盘环境
```
mkdir cd2/opt/efi/boot -p
@@ -288,7 +464,7 @@ cp bootx64.efi x86_64-efi/ -r cd2/opt/efi/boot/
```
------------------------------------------------------------------------------
### 添加efi自动安装脚本
## 三、添加efi自动安装脚本
#### 1.编写efi安装脚本
@@ -302,33 +478,38 @@ upgrubcmd="/usr/sbin/update-grub"
if [ $efimode == "y" ];then
source ./functions
source ./functions
efi_dir="/opt/efi/boot"
efi_dir="/Rocky/boot-efi"
mkdir -p $TARGET/boot/efi/efi/boot
mkdir -p $TARGET/boot/efi/efi/boot
cp ${efi_dir}/bootx64.efi $TARGET/boot/efi/efi/boot/
cp ${efi_dir}/bootx64.efi $TARGET/boot/efi/efi/boot
cp -r ${efi_dir}/x86_64-efi $TARGET/boot/efi/efi/boot/
cp -r ${efi_dir}/x86_64-efi $TARGET/boot/efi/efi/boot
cp $TARGET/boot/grub/grub.cfg $TARGET/boot/efi/efi/boot/x86_64-efi/
cp $TARGET/boot/grub/grub.cfg $TARGET/boot/efi/efi/boot/x86_64-efi
echo 'exec grub-mkconfig -o /boot/efi/efi/boot/x86_64-efi/grub.cfg $@ ' > $TARGET/$upgrubcmd
#echo 'exec grub-mkconfig -o /boot/efi/efi/boot/x86_64-efi/grub.cfg $@ ' >> $TARGET/$upgrubcmd
echo -e "Install efi successfully !"
sed -i 's/\/boot\/grub\/grub.cfg/\/boot\/efi\/efi\/boot\/x86_64-efi\/grub.cfg/' $TARGET/$upgrubcmd
ln -snf /boot/efi/efi/boot/x86_64-efi/grub.cfg $TARGET/boot/grub/grub.cfg
echo -e "Install efi successfully !"
else
echo -e "not efi mode !"
echo -e "not efi mode !"
fi
```
#### 2.增加对efi分区情况的限制
更改/cd2/usr/lib/new_install/text/ri_newt.py
```
root@Linx:~/cd2/usr/lib/new_install/text# diff -uparN /root/cd/usr/lib/new_install/text/ri_newt.py /root/cd2/usr/lib/new_install/text/ri_newt.py
--- /root/cd/usr/lib/new_install/text/ri_newt.py 2019-05-07 07:48:57.000000000 +0000
+++ /root/cd2/usr/lib/new_install/text/ri_newt.py 2019-06-05 06:51:50.000000000 +0000
zhang@linx:~/software/rocky/diff$ diff -uparN a/ri_newt.py b/ri_newt.py
--- a/ri_newt.py 2020-01-13 10:13:08.673809083 +0800
+++ b/ri_newt.py 2020-01-13 10:14:12.713809392 +0800
@@ -2,6 +2,7 @@
from snack import *
import sys
@@ -336,11 +517,13 @@ root@Linx:~/cd2/usr/lib/new_install/text# diff -uparN /root/cd/usr/lib/new_insta
+import logging
sys.path.append('../interface/')
sys.path.append('../new_partition/')
@@ -9,6 +10,12 @@ import ri_data
@@ -9,6 +10,14 @@ import ri_data
import partition_data as p_d
import interface_partition
+import os
+
+logger=logging.getLogger('debuglog')
+logger.setLevel(logging.DEBUG)
+fh=logging.FileHandler('/tmp/test.log')
@@ -348,97 +531,108 @@ root@Linx:~/cd2/usr/lib/new_install/text# diff -uparN /root/cd/usr/lib/new_insta
+logger.addHandler(fh)
+
config_xml = "../xml/install_cfg.xml"
class Screen:
@@ -478,6 +485,7 @@ class MountPoint(Screen):
self.mds.sort()
def check_mountpoint(self,flag='one'):
+ eficheck=0
nonmount_dir = ['/dev','/etc','/lib64','/lib','/bin','/sbin','/proc','/sys']
if flag == 'one':
mountpoint = Screen.entry.value()
@@ -497,6 +505,20 @@ class MountPoint(Screen):
return False
return True
elif flag == 'all':
+ for f in self.disks:
+ efidict={}
+ efidevs=p_d.Partition.dict[f]['partition'].keys()
+ if (f+'1') in efidevs:
+ logger.info('efi maybe' + f +'1')
+ logger.info('mountpoint is' +str(p_d.Partition.dict[f]['partition'][f+'1']['mount_point']))
+ logger.info('filesystem is' +str(p_d.Partition.dict[f]['partition'][f+'1']['filesystem']))
+ efidict['dev']=f+'1'
+ efidict['mountpoint']=str(p_d.Partition.dict[f]['partition'][f+'1']['mount_point'])
+ efidict['filesystem']=str(p_d.Partition.dict[f]['partition'][f+'1']['filesystem'])
+ if (efidict['mountpoint']=='/boot/efi' or efidict['mountpoint']=='/boot/efi/') and (efidict['filesystem'] == 'vfat'):
+ eficheck=1
+ break
+
list_mountpoint = []
for m in ri_data.Raid.dict.keys():
R = ri_data.Raid.dict[m]
@@ -511,9 +533,10 @@ class MountPoint(Screen):
list_mountpoint.append(p_d.Partition.dict[d]['partition'][p]['mount_point'])
if len(list_mountpoint) != len(list(set(list_mountpoint))) or '/' not in list_mountpoint:
return False
+ elif eficheck != 1:
+ return False
else:
return True
@@ -478,6 +487,7 @@ class MountPoint(Screen):
self.mds.sort()
def check_mountpoint(self,flag='one'):
+ eficheck=0
nonmount_dir = ['/dev','/etc','/lib64','/lib','/bin','/sbin','/proc','/sys']
if flag == 'one':
mountpoint = Screen.entry.value()
@@ -497,6 +507,21 @@ class MountPoint(Screen):
return False
return True
elif flag == 'all':
+ if os.path.exists("/sys/firmware/efi"):
+ for ddisk in self.disks:
+ efidict={}
+ efidevs=p_d.Partition.dict[ddisk]['partition'].keys()
+ for ddev in efidevs:
+ if ddev.startswith(ddisk) and ddev.endswith('1'):
+ logger.info('efi maybe ' + ddev)
+ logger.info('mountpoint is' +str(p_d.Partition.dict[ddisk]['partition'][ddev]['mount_point']))
+ logger.info('filesystem is' +str(p_d.Partition.dict[ddisk]['partition'][ddev]['filesystem']))
+ efidict['dev']=ddev
+ efidict['mountpoint']=str(p_d.Partition.dict[ddisk]['partition'][ddev]['mount_point'])
+ efidict['filesystem']=str(p_d.Partition.dict[ddisk]['partition'][ddev]['filesystem'])
+ if (efidict['mountpoint']=='/boot/efi' or efidict['mountpoint']=='/boot/efi/') and (efidict['filesystem'] == 'vfat'):
+ eficheck=1
+ break
list_mountpoint = []
for m in ri_data.Raid.dict.keys():
R = ri_data.Raid.dict[m]
@@ -513,7 +538,6 @@ class MountPoint(Screen):
return False
+ elif os.path.exists("/sys/firmware/efi") and eficheck != 1:
+ return False
else:
return True
-
def set_mountpoint(self, device):
disk = device.split(':')[0]
dev = device.split(':')[1]
@@ -524,7 +547,7 @@ class MountPoint(Screen):
Screen.label_mp = Label('mountpoint : ')
Screen.label_fs = Label('File System Type : ')
Screen.widget_label('')
- fs_list = ['ext2','ext3', 'ext4', 'vfat', 'linux-swap', 'reiserfs', 'xfs', 'jfs']
+ fs_list = ['ext2','ext3', 'ext4', 'linux-swap', 'reiserfs', 'xfs', 'jfs','vfat']
Screen.widget_listbox(3, fs_list)
Screen.widget_checkbox('Format the partition')
Screen.listbox.setCurrent('ext3')
@@ -551,7 +574,7 @@ class MountPoint(Screen):
s = Screen.yesno(self.title, 1, 8, 'TextboxReflowed', 'eLabel', 'Grid_Complex', 'eLabel', 'Checkbox','eLabel','ButtonBar')
if s == 0:
if not self.check_mountpoint(flag='one'):
- Screen.pop_window('Invalid mount point','The mount point you entered is invalid.\nMount point must start with "/".They cannot contain spaces.\nMount point cannot be "/dev","/etc","/lib","lib#
+ Screen.pop_window('Invalid mount point','The mount point you entered is invalid.\nMount point must start with "/boot/efi".They cannot contain spaces.\nMount point cannot be "/dev","/etc","/l#
continue
if MD:
if Screen.entry.value() != '' or Screen.checkbox.value() == 1:
@@ -561,7 +584,6 @@ class MountPoint(Screen):
ri_data.Raid.dict[disk].filesystem = Screen.listbox.current()
ri_data.Raid.dict[disk].mp = Screen.entry.value()
break
- #p_d.Partition.dict[disk]['partition'][dev]['format'] = 'yes'
else:
if Screen.entry.value() != '' or Screen.checkbox.value() == 1:
p_d.Partition.dict[disk]['partition'][dev]['format'] = 'yes'
@@ -629,7 +651,7 @@ class MountPoint(Screen):
break
else:
if not self.check_mountpoint(flag='all'):
- Screen.pop_window('Invalid mount point','Two file systems must not be assigned the same mount point.\nA root file system is needed.\nPlease correct this by changing mount points.', 50)
+ Screen.pop_window('Invalid mount point','Two file systems must not be assigned the same mount point.\nA root file system is needed.\nIn efi install mod the first partition mountpoint must be#
continue
break
return (s == 'help' and '0' or s)
def set_mountpoint(self, device):
disk = device.split(':')[0]
dev = device.split(':')[1]
@@ -524,7 +548,7 @@ class MountPoint(Screen):
Screen.label_mp = Label('mountpoint : ')
Screen.label_fs = Label('File System Type : ')
Screen.widget_label('')
- fs_list = ['ext2','ext3', 'ext4', 'linux-swap', 'reiserfs', 'xfs', 'jfs']
+ fs_list = ['ext2','ext3', 'ext4', 'linux-swap', 'reiserfs', 'xfs', 'jfs','vfat']
Screen.widget_listbox(3, *fs_list)
Screen.widget_checkbox('Format the partition')
Screen.listbox.setCurrent('ext3')
@@ -551,8 +575,12 @@ class MountPoint(Screen):
s = Screen.yesno(self.title, 1, 8, 'TextboxReflowed', 'eLabel', 'Grid_Complex', 'eLabel', 'Checkbox','eLabel','ButtonBar')
if s == 0:
if not self.check_mountpoint(flag='one'):
- Screen.pop_window('Invalid mount point','The mount point you entered is invalid.\nMount point must start with "/".They cannot contain spaces.\nMount point cannot be "/dev","/etc","/lib","lib64","/bin","/sbin","/proc","/sys".\nAnd when formatted linux-swap filesystem, the partition can not be mounted.', 50)
- continue
+ if os.path.exists("/sys/firmware/efi"):
+ Screen.pop_window('Invalid mount point','The mount point you entered is invalid.\nMount point must start with "/boot/efi".They cannot contain spaces.\nMount point cannot be "/dev","/etc","/lib","lib64","/bin","/sbin","/proc","/sys".\nAnd when formatted linux-swap filesystem, the partition can not be mounted.', 50)
+ continue
+ else:
+ Screen.pop_window('Invalid mount point','The mount point you entered is invalid.\nMount point must start with "/".They cannot contain spaces.\nMount point cannot be "/dev","/etc","/lib","lib64","/bin","/sbin","/proc","/sys".\nAnd when formatted linux-swap filesystem, the partition can not be mounted.', 50)
+ continue
if MD:
if Screen.entry.value() != '' or Screen.checkbox.value() == 1:
ri_data.Raid.dict[disk].fmt = 'yes'
@@ -561,7 +589,6 @@ class MountPoint(Screen):
ri_data.Raid.dict[disk].filesystem = Screen.listbox.current()
ri_data.Raid.dict[disk].mp = Screen.entry.value()
break
- #p_d.Partition.dict[disk]['partition'][dev]['format'] = 'yes'
else:
if Screen.entry.value() != '' or Screen.checkbox.value() == 1:
p_d.Partition.dict[disk]['partition'][dev]['format'] = 'yes'
@@ -629,8 +656,12 @@ class MountPoint(Screen):
break
else:
if not self.check_mountpoint(flag='all'):
- Screen.pop_window('Invalid mount point','Two file systems must not be assigned the same mount point.\nA root file system is needed.\nPlease correct this by changing mount points.', 50)
- continue
+ if os.path.exists("/sys/firmware/efi"):
+ Screen.pop_window('Invalid mount point','Two file systems must not be assigned the same mount point.\nA root file system is needed.\nIn efi install mod the first partition mountpoint must be /boot/efi/ and filesystem must be vfat.\nPlease correct this by changing mount points.', 50)
+ continue
+ else:
+ Screen.pop_window('Invalid mount point','Two file systems must not be assigned the same mount point.\nA root file system is needed.\nPlease correct this by changing mount points.', 50)
+ continue
break
return (s == 'help' and '0' or s)
```
------------------------------------------------------------------------------
### 制作镜像
## 四、制作镜像
#### 安装isolinux
#### 1.安装isolinux
```
apt-get install isolinux
```
#### mk_iso_4.2.sh脚本
#### 2.mk_iso_4.2.sh脚本
```
#!/bin/bash
@@ -447,13 +641,106 @@ apt-get install isolinux
isopath="$1"
output="$2"
xorriso -as mkisofs -r -checksum_algorithm_iso md5,sha1 -V `cat ${isopath}/tag| cut -b1-32` -o ${output} -J -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -partition_offset 16 -J -cache-inodes -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/bootx64.img -no-emul-boot -isohybrid-gpt-basdat -isohybrid-apm-hfsplus $isopath
xorriso -as mkisofs -r -checksum_algorithm_iso md5,sha1 -V `cat ${isopath}/tag| cut -b1-32` -o ${output} -J -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -partition_offset 16 -J -cache-inodes -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -isohybrid-apm-hfsplus $isopath
```
#### 执行脚本制作镜像
#### 3.执行脚本制作镜像
```
./mk_iso_4.2.sh cd2 linx4.2-700-uefi.iso
```
------------------------------------------------------------------------------
## 五、集成到自动编译工具
#### 1. 需要修改的库和文件
###### 修改new_install(根据上方叙述进行修改)
修改new_install/new_partition/interface_partition.py文件
修改new_install/text/ri_newt.py文件
添加new_install/operation/finish_install/99exec_install_efi.sh文件
###### 修改autobuild-tools
1.添加autobuild-tools/integration-tool/cfg/iso_env/x86_64/cfg/boot/grub/grub.cfg
2.添加autobuild-tools/integration-tool/cfg/iso_env/x86_64/cfg/boot/grub/x86_64-efi
3.添加autobuild-tools/integration-tool/cfg/iso_env/x86_64/cfg/boot/grub/efi.img
4.添加autobuild-tools/integration-tool/cfg/iso_env/x86_64/cfg/boot/grub/bootx64.efi
5.修改autobuild-tools/integration-tool/mk_iso
```
438 echo "info: 安装uefi引导文件"
439 mkdir -pv ${ISO_DIR}/opt/efi
440 mv ${ISO_DIR}/boot/grub/bootx64.efi ${ISO_DIR}/opt/efi/
441 cp -r ${ISO_DIR}/boot/grub/x86_64-efi ${ISO_DIR}/opt/efi/
442 mv ${ISO_DIR}/boot/grub/grub.cfg ${ISO_DIR}/x86_64-efi/
………………
551 xorriso -as genisoimage -r -checksum_algorithm_iso md5,sha1 -V `cat ${ISO_DIR}/tag| cut -b1-32` -o ${DAILY_BUILDS_DIR}/rocky$os_version-$ARCH-$B_S-`date "+%Y%m%d"`.iso -J -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin -partition_offset 16 -J -cache-inodes -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -isohybrid-apm-hfsplus $ISO_DIR
```
上述xorriso命令会出现报错
```
libisofs: NOTE : Automatically adjusted MBR geometry to 1021/245/32
libisofs: NOTE : Aligned image size to cylinder size by 635 blocks
libisofs: FAILURE : MBR template file seems not prepared for Apple Partition Map.
libisofs: FAILURE : Image write error
libisofs: MISHAP : > Caused by: Cannot patch isolinux boot image
libburn : FAILURE : Premature end of input encountered. Missing: 4098375680 bytes
xorriso : FAILURE : libburn indicates failure with writing.
xorriso : NOTE : -return_with SORRY 32 triggered by problem severity FAILURE
```
更更改为如下命令,可以编过。
```
xorriso -as genisoimage -r -checksum_algorithm_iso md5,sha1 -V `cat ${isopath}/tag| cut -b1-32` -o ${output} -J -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin -partition_offset 16 -J -cache-inodes -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -b boot/grub/efi.img -no-emul-boot $isopath
```
###### 修改x11-driver
xf86-video-fbdev-0.4.2.tar.bz2
将编译的fbdev_drv.so放到usr/lib64/xorg/modules/drivers/下
并修改/etc/X11/xorg.config /将vesa改为fbdev
为保证图形界面正常在重新编译x11-driver使其支持fbdev
更改x11-driver编译文件Pkgfile
```
在drivermoduledir参数里添加xf86-video-fbdev-0.4.2
```
尝试编译时出现报错,部分/usr/lib/下的库不对,将不对的库删除可以编过,或更改符号链接,链接到/usr/lib64下的相应库也可编过。
###### 尝试使用同一个grub.config
在grub-2.02-beta2/grub-core目录下
修改bootx64.efi文件
```
search --file /tag --set=root
set prefix=($root)/boot/grub/x86_64-efi
configfile $prefix/grub.cfg
```
修改grub.cfg
```
../grub-mkimage --config=grub.cfg -O x86_64-efi -d . -o bootx64.efi -p /boot/grub/x86_64-efi part_gpt part_msdos disk fat exfat ext2 ntfs xfs appleldr hfs iso9660 normal search_fs_file configfile linux linux16 chain loopback echo efi_gop efi_uga video_bochs video_cirrus file gfxmenu gfxterm gfxterm_background gfxterm_menu halt reboot help jpeg ls png true
```
修改new_install/operation/finish_install/99exec_install_efi.sh文件
上述尝试失败重做bootx64.efi后依然无法找到/boot/grub/grub.cfg文件调查可能是由于efi启动文件有格式要求现在的方式是在99exec_install_efi.sh文件中插入一条,建立软链接/boot/grub/grub.cfg链接到启动文件。
```
ln -snf /boot/efi/efi/boot/x86_64-efi/grub.cfg $TARGET/boot/grub/grub.cfg
```
###### 去除/ope文件夹
在Rocky目录下创建boot-efi文件,将bootx64.efi和x86_64-efi文件放到/Rocky/boot-efi目录下。
修改99exec_install_efi.sh文件使其从/Rocky/boot-efi安装文件。
```
更改安装目录efi_dir="/Rocky/boot-efi"
```