添加 grub 支持,添加此芯 (Radxa Orion O6) 构建支持

This commit is contained in:
chainsx 2026-01-05 02:20:46 +00:00
parent f33e5d24a0
commit d2ef6c87f8
30 changed files with 9695 additions and 60 deletions

View File

@ -269,6 +269,13 @@
<td class="cellrowborder" valign="top" width="10%"><p>openEuler 24.03 LTS</p></td>
<td class="cellrowborder" valign="top" width="10%"><a href="./rockchip/构建完整镜像命令列举.md#khadas-vim3">构建完整镜像命令</a></td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="10%"><ul><li>Radxa Orion O6</li></ul></td>
<td class="cellrowborder" valign="top" width="10%"><a href="https://docs.radxa.com/orion/o6">Radxa Wiki</a></td>
<td class="cellrowborder" valign="top" width="10%"><p>CIX P1 CD8180</p></td>
<td class="cellrowborder" valign="top" width="10%"><p>openEuler 24.03 LTS</p></td>
<td class="cellrowborder" valign="top" width="10%"><a href="./rockchip/构建完整镜像命令列举.md#radxa-orion-o6">构建完整镜像命令</a></td>
</tr>
</tbody></table>
### Docker 容器内构建
@ -398,4 +405,18 @@
-c amlogic-kernel-OLK-6.6.config \
-r https://raw.atomgit.com/src-openeuler/openEuler-repos/raw/openEuler-24.03-LTS/generic.repo \
-s headless
```
- CIX: Radxa Orion O6
```
sudo bash build-image-docker.sh \
--board radxa-orion-o6 \
-d https://repo.openeuler.org/openEuler-24.03-LTS/docker_img/aarch64/openEuler-docker.aarch64.tar.xz \
-n openEuler-24.03-LTS-Radxa-Orion-O6-aarch64-alpha1 \
-k https://github.com/armbian/linux-cix.git \
-b cix-6.6-2025q3 \
-c cix-kernel-cix-6.6-2025q3.config \
-r https://raw.atomgit.com/src-openeuler/openEuler-repos/raw/openEuler-24.03-LTS/generic.repo \
-s headless
```

View File

@ -150,5 +150,12 @@ English | [简体中文](./compatibility-list.md)
<td class="cellrowborder" valign="top" width="10%"><p style="color:yellow">Community Support</p></td>
<td class="cellrowborder" valign="top" width="10%"><a href="./rockchip/构建完整镜像命令列举.md#khadas-vim3">Build a unified system image</a></td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="10%"><a href="https://docs.radxa.com/orion/o6">Radxa Orion O6</a></td>
<td class="cellrowborder" valign="top" width="10%"><p>CIX P1 CD8180</p></td>
<td class="cellrowborder" valign="top" width="10%"><p>openEuler 24.03 LTS(<a href="https://github.com/armbian/linux-cix/tree/cix-6.6-2025q3/">kernel version 6.6</a>)</p></td>
<td class="cellrowborder" valign="top" width="10%"><p style="color:yellow">Community Support</p></td>
<td class="cellrowborder" valign="top" width="10%"><a href="./rockchip/构建完整镜像命令列举.md#radxa-orion-o6">Build a unified system image</a></td>
</tr>
</tbody>
</table>

View File

@ -150,5 +150,12 @@
<td class="cellrowborder" valign="top" width="10%"><p style="color:yellow">社区支持</p></td>
<td class="cellrowborder" valign="top" width="10%"><a href="./rockchip/构建完整镜像命令列举.md#khadas-vim3">构建完整镜像</a></td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="10%"><a href="https://docs.radxa.com/orion/o6">Radxa Orion O6</a></td>
<td class="cellrowborder" valign="top" width="10%"><p>CIX P1 CD8180</p></td>
<td class="cellrowborder" valign="top" width="10%"><p>openEuler 24.03 LTS<a href="https://github.com/armbian/linux-cix/tree/cix-6.6-2025q3/">内核版本 6.6</a></p></td>
<td class="cellrowborder" valign="top" width="10%"><p style="color:yellow">社区支持</p></td>
<td class="cellrowborder" valign="top" width="10%"><a href="./rockchip/构建完整镜像命令列举.md#radxa-orion-o6">构建完整镜像</a></td>
</tr>
</tbody>
</table>

View File

@ -127,7 +127,15 @@ POST_BOARD_OVERLAY() {
- rootfs_dir
该参数为框架构建的 openEuler 根目录所在的路径,默认为 `${workdir}/rootfs`
8. boot_mode
开发板所使用的启动方式,目前支持的有:
- extlinux: 使用 u-boot 解析 /boot/extlinux/extlinux.conf 启动配置文件进行启动
- grub: 使用 efi 启动
## 运行测试
通过运行脚本 [构建完整镜像](../Rockchip.md#构建完整镜像),将 `--board` 参数设置为新增开发板的版型文件来运行测试。

View File

@ -7,12 +7,14 @@
- [适用的 RK3588 开发板](#适用的-rk3588-开发板)
- [适用的 Phytium 开发板](#适用的-phytium-开发板)
- [适用的 Allwinner 开发板](#适用的-allwinner-开发板)
- [适用的 Amlogic 开发板](#适用的-amlogic-开发板)
- [适用的 CIX 开发板](#适用的-cix-开发板)
## 描述
本文档介绍了支持的开发板以及构建对应开发板完整镜像的命令。
### 适用的 RK3399 开发板:
### 适用的 RK3399 开发板
已经测试的开发板如下,其他类型 Rockchip 开发板适用情况待测试。
@ -48,7 +50,7 @@
`sudo bash build.sh --board radxa-rockpi-4a -n openEuler-22.03-LTS-RockPi-4A-aarch64-alpha1 -k https://atomgit.com/openeuler/kernel.git -b openEuler-22.03-LTS -c openeuler_rockchip_defconfig -r https://raw.atomgit.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS/generic.repo -s headless`
### 适用的 RK356X 开发板:
### 适用的 RK356X 开发板
已经测试的开发板如下,其他类型 RK356X 开发板适用情况待测试。
@ -92,7 +94,7 @@
`sudo bash build.sh --board firefly-roc-rk3568-pc -n openEuler-22.03-LTS-SP3-ROC-RK3568-PC-aarch64-alpha1 -k https://atomgit.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP3 -c openeuler_rockchip_defconfig -r https://raw.atomgit.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP3/generic.repo -s headless`
### 适用的 RK3576 开发板:
### 适用的 RK3576 开发板
已经测试的开发板如下,其他类型 RK3576 开发板适用情况待测试。
@ -112,7 +114,7 @@
`sudo bash build.sh --board dshanpi-a1 -n openEuler-22.03-LTS-SP3-DShanPi-A1-aarch64-alpha1 -k https://github.com/dshanpi/dshanpi-a1-linux-kernel -b rk-6.1 -c rockchip_linux_defconfig -r https://raw.atomgit.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP3/generic.repo -s headless`
### 适用的 RK3588 开发板:
### 适用的 RK3588 开发板
已经测试的开发板如下,其他类型 RK3588 开发板适用情况待测试。
@ -148,7 +150,7 @@
`sudo bash build.sh --board radxa-rock-5b -n openEuler-22.03-LTS-SP3-Rock5B-aarch64-alpha1 -k https://atomgit.com/openeuler/rockchip-kernel.git -b openEuler-22.03-LTS-SP3 -c openeuler_rockchip_defconfig -r https://raw.atomgit.com/src-openeuler/openEuler-repos/raw/openEuler-22.03-LTS-SP3/generic.repo -s headless`
### 适用的 Phytium 开发板:
### 适用的 Phytium 开发板
已经测试的开发板如下,其他类型 Phytium 开发板适用情况待测试。
@ -164,7 +166,7 @@
`sudo bash build.sh --board phytium-4gb -n openEuler-24.03-LTS-PhytiumPi-4GB-aarch64-alpha1 -k https://atomgit.com/openeuler/phytium-kernel.git -b openEuler-24.03-LTS-Phytium -c phytium_defconfig -r https://raw.atomgit.com/src-openeuler/openEuler-repos/raw/openEuler-24.03-LTS/generic.repo -s headless`
### 适用的 Allwinner 开发板:
### 适用的 Allwinner 开发板
已经测试的开发板如下,其他类型 Allwinner 开发板适用情况待测试。
@ -188,7 +190,7 @@
`sudo bash build.sh --board longanpi-3h -n openEuler-24.03-LTS-LonganPi-3H-aarch64-alpha1 -k https://atomgit.com/openeuler/allwinner-kernel.git -b openEuler-24.03-LTS -c openeuler_allwinner_defconfig -r https://raw.atomgit.com/src-openeuler/openEuler-repos/raw/openEuler-24.03-LTS/generic.repo -s headless`
### 适用的 Amlogic 开发板:
### 适用的 Amlogic 开发板
已经测试的开发板如下,其他类型 Amlogic 开发板适用情况待测试。
@ -198,4 +200,16 @@
- openEuler-24.03-LTS构建命令如下:
`bash build.sh --board khadas-vim3 -n openEuler-24.03-LTS-Khadas-VIM3-aarch64-alpha1 -k https://atomgit.com/openeuler/kernel.git -b OLK-6.6 -c amlogic-kernel-OLK-6.6.config -r https://raw.atomgit.com/src-openeuler/openEuler-repos/raw/openEuler-24.03-LTS/generic.repo -s headless`
`bash build.sh --board khadas-vim3 -n openEuler-24.03-LTS-Khadas-VIM3-aarch64-alpha1 -k https://atomgit.com/openeuler/kernel.git -b OLK-6.6 -c amlogic-kernel-OLK-6.6.config -r https://raw.atomgit.com/src-openeuler/openEuler-repos/raw/openEuler-24.03-LTS/generic.repo -s headless`
### 适用的 CIX 开发板
已经测试的开发板如下,其他类型 CIX 开发板适用情况待测试。
#### Radxa Orion O6
已测试的版本如下:
- openEuler-24.03-LTS构建命令如下:
`bash build.sh --board radxa-orion-o6 -n openEuler-24.03-LTS-Radxa-Orion-O6-aarch64-alpha1 -k https://github.com/armbian/linux-cix.git -b cix-6.6-2025q3 -c cix-kernel-cix-6.6-2025q3.config -r https://raw.atomgit.com/src-openeuler/openEuler-repos/raw/openEuler-24.03-LTS/generic.repo -s headless`

View File

@ -1,4 +1,5 @@
ubootconfig=
bootmode=extlinux
local_uboot_dir=${nonfree_bin_dir}/u-boot/armsom-sige5
dtb_name=rk3576-armsom-sige5
platform=rockchip

View File

@ -1,4 +1,5 @@
ubootconfig=
bootmode=extlinux
local_uboot_dir=${nonfree_bin_dir}/u-boot/dshanpi-a1
dtb_name=rk3576-100ask-dshanpi-a1
platform=rockchip

View File

@ -1,4 +1,5 @@
ubootconfig=
bootmode=extlinux
local_uboot_dir=${nonfree_bin_dir}/u-boot/firefly-rk3588
dtb_name=rk3588-firefly-itx-3588j
platform=rockchip

View File

@ -1,4 +1,5 @@
ubootconfig=firefly-rk3399_defconfig
bootmode=extlinux
dtb_name=rk3399-firefly
platform=rockchip
soc_name=rk3399

View File

@ -1,4 +1,5 @@
ubootconfig=
bootmode=extlinux
local_uboot_dir=${nonfree_bin_dir}/u-boot/firefly-rk3566
dtb_name=rk3566-roc-pc
platform=rockchip

View File

@ -1,4 +1,5 @@
ubootconfig=
bootmode=extlinux
local_uboot_dir=${nonfree_bin_dir}/u-boot/firefly-rk3568
dtb_name=rk3568-roc-pc-se
platform=rockchip

View File

@ -1,4 +1,5 @@
ubootconfig=
bootmode=extlinux
local_uboot_dir=${nonfree_bin_dir}/u-boot/firefly-rk3568
dtb_name=rk3568-roc-pc
platform=rockchip

View File

@ -1,4 +1,5 @@
ubootconfig=
bootmode=extlinux
local_uboot_dir=${nonfree_bin_dir}/u-boot/firefly-rk3588
dtb_name=rk3588s-roc-pc
platform=rockchip

View File

@ -1,4 +1,5 @@
ubootconfig=
bootmode=extlinux
local_uboot_dir=${nonfree_bin_dir}/u-boot/khadas-vim3
dtb_name=meson-g12b-a311d-khadas-vim3
platform=amlogic

View File

@ -1,4 +1,5 @@
ubootconfig=
bootmode=extlinux
local_uboot_dir=${nonfree_bin_dir}/u-boot/longanpi-3h
dtb_name=sun50i-h618-longanpi-3h
platform=allwinner

View File

@ -1,4 +1,5 @@
ubootconfig=
bootmode=extlinux
local_uboot_dir=${nonfree_bin_dir}/u-boot/orangepi-zero2
dtb_name=sun50i-h616-orangepi-zero2
platform=allwinner

View File

@ -1,4 +1,5 @@
ubootconfig=
bootmode=extlinux
local_uboot_dir=${nonfree_bin_dir}/u-boot/phytiumpi
dtb_name=phytiumpi_firefly
platform=phytium

View File

@ -0,0 +1,14 @@
ubootconfig=
bootmode=grub
local_uboot_dir=
dtb_name=sky1-orion-o6-40pin
platform=cix
soc_name=p1
arch=arm64
part_table=gpt
boot_size=256
POST_BOARD_OVERLAY() {
echo "Put ${board} firmware into rootfs..."
echo "Nothing to do..."
}

View File

@ -1,4 +1,5 @@
ubootconfig=
bootmode=extlinux
local_uboot_dir=${nonfree_bin_dir}/u-boot/radxa-rock5b
dtb_name=rk3588-rock-5b
platform=rockchip

View File

@ -1,4 +1,5 @@
ubootconfig=rock-pi-4-rk3399_defconfig
bootmode=extlinux
dtb_name=rk3399-rock-pi-4a
platform=rockchip
soc_name=rk3399

View File

@ -1,4 +1,5 @@
ubootconfig=
bootmode=
dtb_name=bcm2711-rpi-4-b
platform=broadcom
soc_name=

View File

@ -1,4 +1,5 @@
ubootconfig=firefly-rk3399_defconfig #Required! The name of defconfig file when compiling u-boot, which defaults to firefly-rk3399_defconfig.
bootmode=extlinux
dtb_name=rk3399-firefly #Required! The device tree name of target board, which defaults to rk3399-firefly.
platform=rockchip #Required! The platform of target board, which defaults to rockchip.
soc_name=rk3399

View File

@ -259,7 +259,6 @@ install_kernel() {
mk_boot() {
LOG "start make bootimg..."
if [ "x${board}" != "xraspberrypi" ]; then
mkdir -p ${boot_dir}/extlinux
LOG "start gen initrd..."
dracut --no-kernel ${boot_dir}/initrd.img
@ -274,18 +273,28 @@ mk_boot() {
bootargs=${allwinner_bootargs}
elif [ "${platform}" == "amlogic" ];then
bootargs=${amlogic_bootargs}
elif [ "${platform}" == "cix" ];then
bootargs=${cix_bootargs}
else
echo "Unsupported platform"
exit 2
fi
echo "label openEuler
kernel /Image
initrd /initrd.img
fdt /${dtb_name}.dtb
append ${bootargs}" \
> ${boot_dir}/extlinux/extlinux.conf
LOG "gen extlinux config done."
if [ "x${bootmode}" == "xextlinux" ]; then
mkdir -p ${boot_dir}/extlinux
cp ${config_dir}/extlinux.conf ${boot_dir}/extlinux
sed -i "s|BOOTARGS|${bootargs}|g" ${boot_dir}/extlinux/extlinux.conf
sed -i "s|DEVICETREE|${dtb_name}.dtb|g" ${boot_dir}/extlinux/extlinux.conf
LOG "gen extlinux config done."
elif [ "x${bootmode}" == "xgrub" ]; then
echo ${bootargs} \
>> ${boot_dir}/grub-cmdline.txt
LOG "save grub cmdline done."
else
echo "Unsupported bootmode"
exit 2
fi
fi
dd if=/dev/zero of=${workdir}/boot.img bs=1M count=${boot_size} status=progress
mkfs.vfat -n boot ${workdir}/boot.img
@ -320,6 +329,7 @@ rockchip_bootargs="earlyprintk console=ttyS2,1500000 rw root=UUID=614e0000-0000-
phytium_bootargs="console=ttyAMA1,115200 earlycon=pl011,0x2800d000 rw root=UUID=614e0000-0000-4b53-8000-1d28000054a9 rootfstype=ext4 rootwait cma=256m"
allwinner_bootargs="console=tty0 console=ttyS0,115200 rw root=UUID=614e0000-0000-4b53-8000-1d28000054a9 rootfstype=ext4 rootwait earlycon clk_gnore_unused"
amlogic_bootargs="console=ttyAML0,115200 console=tty1 consoleblank=0 root=UUID=614e0000-0000-4b53-8000-1d28000054a9 rootwait rootfstype=ext4 splash=verbose coherent_pool=2M loglevel=8"
cix_bootargs="root=UUID=614e0000-0000-4b53-8000-1d28000054a9 loglevel=0 acpi=off kasan=off rootwait rw pcie_aspm=off console=tty0 console=ttyAMA2 splash=verbose"
if [ -n "${default_defconfig}" ]; then
if [ ! -f $default_defconfig ] ; then

View File

@ -142,7 +142,7 @@ INSTALL_PACKAGES(){
do
chroot ${rootfs_dir}/ dnf ${tmp_repo_info} --disablerepo="*" install -y $item --nogpgcheck
if [ $? == 0 ]; then
LOG install $item.
LOG $item installed.
else
ERROR can not install $item.
fi
@ -155,6 +155,9 @@ INSTALL_PACKAGES(){
ERROR can not install raspberrypi-kernel.
fi
fi
if [ "x${bootmode}" == "xgrub" ]; then
chroot ${rootfs_dir}/ dnf ${tmp_repo_info} --disablerepo="*" install -y grub2-efi-aa64 grub2-efi-aa64-modules efibootmgr --nogpgcheck
fi
}
build_rootfs() {

View File

@ -171,8 +171,8 @@ fi
sed -i 's/u-boot//g' ${workdir}/.done
LOG "build u-boot..."
if [ "x${board}" == "xraspberrypi" ]; then
LOG "Skip build u-boot for Raspberry Pi."
if [[ "x${ubootconfig}" == "x" && "x${local_uboot_dir}" == "x" ]]; then # RaspberryPi & Radxa-Orion-O6
LOG "Skip build u-boot."
else
if [ "x$ubootconfig" == "x" ]; then
use_prebuild_u-boot

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
label openEuler
kernel /Image
initrd /initrd.img
fdt /DEVICETREE
append BOOTARGS

View File

@ -0,0 +1,128 @@
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
serial
terminal_input serial console
terminal_output serial console
if [ "${recordfail}" = 1 ] ; then
set timeout=30
else
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=3
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=3
fi
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/09_linux_with_dtb.sh ###
function gfxmode {
set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'openEuler' --class gnu-linux --class gnu --class os $menuentry_id_option 'openEuler' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root BOOT_UUID
echo 'Loading openEuler ...'
linux /Image BOOTARGS
echo 'Loading initial ramdisk ...'
initrd /initrd.img
echo 'Loading device tree blob...'
devicetree /DEVICETREE
}
### END /etc/grub.d/09_linux_with_dtb.sh ###
### BEGIN /etc/grub.d/25_bli ###
if [ "$grub_platform" = "efi" ]; then
insmod bli
fi
### END /etc/grub.d/25_bli ###
### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/30_uefi-firmware ###
if [ "$grub_platform" = "efi" ]; then
fwsetup --is-supported
if [ "$?" = 0 ]; then
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
fwsetup
}
fi
fi
### END /etc/grub.d/30_uefi-firmware ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg
fi
### END /etc/grub.d/41_custom ###

View File

@ -0,0 +1,3 @@
# GRUB Environment Block
# WARNING: Do not edit this file by tools other than grub-editenv!!!
##################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################

View File

@ -31,9 +31,8 @@ default_param() {
rootfs_dir=${workdir}/rootfs
boot_dir=${workdir}/boot
uboot_dir=${workdir}/u-boot
boot_mnt=${workdir}/boot_tmp
emmc_boot_mnt=${workdir}/emmc_boot_tmp
root_mnt=${workdir}/root_tmp
boot_mnt=${workdir}/root_tmp/boot
log_dir=${workdir}/log
}
@ -69,24 +68,23 @@ parseargs()
LOSETUP_D_IMG(){
set +e
if [ -d ${root_mnt} ]; then
if grep -q "${root_mnt} " /proc/mounts ; then
umount ${root_mnt}
fi
if grep -q "${root_mnt}/dev " /proc/mounts ; then
umount -l ${root_mnt}/dev
fi
if grep -q "${root_mnt}/proc " /proc/mounts ; then
umount -l ${root_mnt}/proc
fi
if grep -q "${root_mnt}/sys " /proc/mounts ; then
umount -l ${root_mnt}/sys
fi
if [ -d ${boot_mnt} ]; then
if grep -q "${boot_mnt} " /proc/mounts ; then
umount ${boot_mnt}
fi
fi
if [ -d ${emmc_boot_mnt} ]; then
if grep -q "${emmc_boot_mnt} " /proc/mounts ; then
umount ${emmc_boot_mnt}
fi
fi
if [ -d ${rootfs_dir} ]; then
if grep -q "${rootfs_dir} " /proc/mounts ; then
umount ${rootfs_dir}
if [ -d ${root_mnt} ]; then
if grep -q "${root_mnt} " /proc/mounts ; then
umount ${root_mnt}
fi
fi
if [ -d ${boot_dir} ]; then
@ -94,6 +92,11 @@ LOSETUP_D_IMG(){
umount ${boot_dir}
fi
fi
if [ -d ${rootfs_dir} ]; then
if grep -q "${rootfs_dir} " /proc/mounts ; then
umount ${rootfs_dir}
fi
fi
if [ "x$device" != "x" ]; then
kpartx -d ${device}
losetup -d ${device}
@ -102,18 +105,12 @@ LOSETUP_D_IMG(){
if [ -d ${root_mnt} ]; then
rm -rf ${root_mnt}
fi
if [ -d ${boot_mnt} ]; then
rm -rf ${boot_mnt}
fi
if [ -d ${emmc_boot_mnt} ]; then
rm -rf ${emmc_boot_mnt}
if [ -d ${boot_dir} ]; then
rm -rf ${boot_dir}
fi
if [ -d ${rootfs_dir} ]; then
rm -rf ${rootfs_dir}
fi
if [ -d ${boot_dir} ]; then
rm -rf ${boot_dir}
fi
set -e
}
@ -178,9 +175,6 @@ make_img(){
mkfs.vfat -n boot ${bootp}
mkfs.ext4 -L rootfs ${rootp}
LOG "make filesystems done."
mkdir -p ${root_mnt} ${boot_mnt}
mount -t vfat -o uid=root,gid=root,umask=0000 ${bootp} ${boot_mnt}
mount -t ext4 ${rootp} ${root_mnt}
if [ -d ${rootfs_dir} ];then rm -rf ${rootfs_dir}; fi
mkdir ${rootfs_dir}
@ -189,6 +183,21 @@ make_img(){
mkdir ${boot_dir}
mount ${workdir}/boot.img ${boot_dir}
mkdir -p ${root_mnt}
mount -t ext4 ${rootp} ${root_mnt}
rsync -avHAXq ${rootfs_dir}/* ${root_mnt}
sync
sleep 10
LOG "copy openEuler-root done."
if [ -d ${workdir}/kernel/kernel-modules/lib/modules ]; then
if [ -d ${root_mnt}/lib/modules ];then rm -rf ${root_mnt}/lib/modules; fi
cp -rfp ${workdir}/kernel/kernel-modules/lib/modules ${root_mnt}/lib
LOG "install kernel modules done."
fi
if [ ! -d ${boot_mnt} ];then mkdir ${boot_mnt}; fi
mount -t vfat -o uid=root,gid=root,umask=0000 ${bootp} ${boot_mnt}
cp -rfp ${boot_dir}/* ${boot_mnt} || LOG "${boot_dir} is empty."
line=$(blkid | grep $rootp)
@ -205,24 +214,42 @@ make_img(){
else
uuid=${line#*UUID=\"}
uuid=${uuid%%\"*}
sed -i "s|UUID=614e0000-0000-4b53-8000-1d28000054a9|UUID=${uuid}|g" ${boot_mnt}/extlinux/extlinux.conf
if [ "x${bootmode}" == "xextlinux" ]; then
sed -i "s|UUID=614e0000-0000-4b53-8000-1d28000054a9|UUID=${uuid}|g" ${boot_mnt}/extlinux/extlinux.conf
elif [ "x${bootmode}" == "xgrub" ]; then
efi_line=$(blkid | grep $bootp)
efi_uuid=${efi_line#*UUID=\"}
efi_uuid=${efi_uuid%%\"*}
cp -rfp ${rootfs_dir}/boot/* ${boot_mnt} || true
cp ${config_dir}/grub.cfg ${boot_mnt}/efi/EFI/openEuler
bootargs=$(cat ${boot_mnt}/grub-cmdline.txt)
sed -i "s|614e0000-0000-4b53-8000-1d28000054a9|${uuid}|g" ${boot_mnt}/efi/EFI/openEuler/grub.cfg
sed -i "s|BOOT_UUID|${efi_uuid}|g" ${boot_mnt}/efi/EFI/openEuler/grub.cfg
sed -i "s|BOOTARGS|${bootargs}|g" ${boot_mnt}/efi/EFI/openEuler/grub.cfg
sed -i "s|DEVICETREE|${dtb_name}.dtb|g" ${boot_mnt}/efi/EFI/openEuler/grub.cfg
mkdir -p ${boot_mnt}/efi/BOOT
cp ${boot_mnt}/efi/EFI/openEuler/grub.cfg ${boot_mnt}/grub2
cp ${config_dir}/grubenv ${boot_mnt}/grub2
rm ${boot_mnt}/grub-cmdline.txt
mount --bind /dev ${root_mnt}/dev
mount -t proc /proc ${root_mnt}/proc
mount -t sysfs /sys ${root_mnt}/sys
chroot ${root_mnt} grub2-install --target=arm64-efi --efi-directory=/boot/efi --bootloader-id=openEuler --no-nvram
cp ${root_mnt}/boot/efi/EFI/openEuler/grubaa64.efi ${root_mnt}/boot/efi/BOOT/BOOTAA64.EFI
umount ${root_mnt}/dev
umount ${root_mnt}/proc
umount ${root_mnt}/sys
fi
fi
rsync -avHAXq ${rootfs_dir}/* ${root_mnt}
sync
sleep 10
LOG "copy openEuler-root done."
if [ -d ${workdir}/kernel/kernel-modules/lib/modules ]; then
if [ -d ${root_mnt}/lib/modules ];then rm -rf ${root_mnt}/lib/modules; fi
cp -rfp ${workdir}/kernel/kernel-modules/lib/modules ${root_mnt}/lib
LOG "install kernel modules done."
fi
umount $rootp
umount $bootp
umount ${rootfs_dir}
umount $rootp
umount ${boot_dir}
umount ${rootfs_dir}
if [ "${platform}" == "rockchip" ];then
echo "Installing Rockchip U-Boot..."
@ -268,7 +295,7 @@ make_img(){
ERROR "amlogic u-boot file can not be found!"
exit 2
fi
elif [ "${platform}" != "broadcom" ];then
elif [[ "${platform}" != "broadcom" && "${platform}" != "cix" ]];then
echo "Unsupported platform"
fi