Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
Index: radix-setup/scripts/setup
===================================================================
--- radix-setup/scripts/setup	(revision 216)
+++ radix-setup/scripts/setup	(revision 217)
@@ -278,7 +278,8 @@
 swap_part_number=3
 
 uefi_bytes=
-if [ "${hardware}" = "baikal-m1" -o \
+if [ "${hardware}" = "baikal-m1"   -o \
+     "${hardware}" = "visionfive2" -o \
      "${hardware}" = "intel-pc64" ] ; then
   partition_table_type=g
   uefi_bytes=268435456
@@ -2216,7 +2217,8 @@
 
 EOF
 
-  if [ "${hardware}" = "baikal-m1" ] ; then
+  if [ "${hardware}" = "baikal-m1" -o \
+       "${hardware}" = "visionfive2" ] ; then
     cat >> ${grub_cfg} << EOF
 font '/boot/grub/fonts/dejavusansmono.pf2'
 EOF
@@ -2260,6 +2262,13 @@
 EOF
   fi
 
+  if [ "${hardware}" = "visionfive2" ] ; then
+    cat >> ${grub_cfg} << EOF
+  devicetree (\$root)/boot/starfive/jh7110-visionfive-v2.dtb
+  linux (\$root)/boot/Image root=PARTUUID=\$part_uuid ro rootwait console=ttyS0,115200n8 earlycon=sbi console=tty1
+EOF
+  fi
+
   cat >> ${grub_cfg} << EOF
 }
 EOF
@@ -2324,6 +2333,7 @@
   cat ${fstab} > ${ROOT_MPOINT}/etc/fstab
 
   if [ "${hardware}" = "baikal-m1"    -o \
+       "${hardware}" = "visionfive2"  -o \
        "${hardware}" = "ebox-3350dx2" -o \
        "${hardware}" = "intel-pc32"   -o \
        "${hardware}" = "intel-pc64" ] ; then
@@ -2447,6 +2457,62 @@
                         ${grub_modules}  2>/dev/null 1>/dev/null
 }
 
+install_starfive_vf2_grub()
+{
+  UEFI=`get_uefi_devname`
+  UEFI_MPOINT=$MNT/UEFI
+
+  if [ "x${UEFI}" = "x" ] ; then
+    fatal_error_dialog "Cannot mount EFI partition. Exit ${program}."
+    push_log "ERROR: Cannot mount EFI partition"
+    push_log "Aborted due to an error"
+    push_err "ERROR: Cannot mount EFI partition"
+    EXITSTATUS=22
+    exit
+  fi
+
+  if `mount | grep -q ${UEFI}` ; then
+    umount ${UEFI}
+  fi
+  mkdir -p ${UEFI_MPOINT}
+  if [ "x`mount | grep ${UEFI_MPOINT}`" != "x" ] ; then
+    umount ${UEFI_MPOINT}
+  fi
+  mount ${UEFI} ${UEFI_MPOINT}
+
+  local grub_modules="all_video archelp bfs bitmap bitmap_scale blocklist boot btrfs"
+  grub_modules="${grub_modules} cat chain configfile cpio date datehook datetime disk diskfilter"
+  grub_modules="${grub_modules} echo efi_gop efifwsetup efinet elf eval exfat ext2 extcmd f2fs fat"
+  grub_modules="${grub_modules} fdt file font fshelp gettext gfxmenu gfxterm gfxterm_background"
+  grub_modules="${grub_modules} gfxterm_menu gptsync gzio halt hashsum help hexdump iso9660 jpeg"
+  grub_modules="${grub_modules} json keystatus linux loadenv loopback ls lsefi lzopio mdraid1x"
+  grub_modules="${grub_modules} memdisk minicmd msdospart net newc normal part_gpt part_msdos"
+  grub_modules="${grub_modules} png probe procfs read reboot regexp reiserfs search search_fs_file"
+  grub_modules="${grub_modules} search_fs_uuid search_label serial squash4 tar terminal terminfo"
+  grub_modules="${grub_modules} test tftp time tr trig true udf ufs1 ufs2 video video_colors"
+  grub_modules="${grub_modules} video_fb videoinfo xzio zstd"
+
+  /usr/sbin/grub-install --skip-fs-probe \
+                         --fonts=dejavusansmono \
+                         --boot-directory=${ROOT_MPOINT}/boot \
+                         --directory=/usr/lib/grub/riscv64-efi \
+                         --target=riscv64-efi --no-efi \
+                         --no-bootsector --no-nvram  2>/dev/null 1>/dev/null
+
+  mkdir -p ${ROOT_MPOINT}/boot/efi
+  mkdir -p ${ROOT_MPOINT}/boot/grub/riscv64-efi
+  cat ${grub_load_cfg} > ${ROOT_MPOINT}/boot/grub/riscv64-efi/load.cfg
+
+  mkdir -p ${UEFI_MPOINT}/efi/boot
+  /usr/bin/grub-mkimage --format=riscv64-efi \
+                        --directory=/usr/lib/grub/riscv64-efi \
+                        --compression=xz \
+                        --prefix=/efi/boot \
+                        --config="${grub_load_cfg}" \
+                        --output=${UEFI_MPOINT}/efi/boot/bootriscv64.efi \
+                        ${grub_modules}  2>/dev/null 1>/dev/null
+}
+
 install_intel_pc64_grub()
 {
   UEFI=`get_uefi_devname`
@@ -2671,7 +2737,8 @@
 # /etc/fstab:
 # ----------
 #
-if [ "${hardware}" = "baikal-m1" -o \
+if [ "${hardware}" = "baikal-m1"   -o \
+     "${hardware}" = "visionfive2" -o \
      "${hardware}" = "intel-pc64" ] ; then
   prepare_partuuid_etc_fstab
 else
@@ -2684,6 +2751,7 @@
 # -------------------
 #
 if [ "${hardware}" = "baikal-m1"    -o \
+     "${hardware}" = "visionfive2"  -o \
      "${hardware}" = "ebox-3350dx2" -o \
      "${hardware}" = "intel-pc32"   -o \
      "${hardware}" = "intel-pc64" ] ; then
@@ -2704,6 +2772,9 @@
 if [ "${hardware}" = "baikal-m1" ] ; then
   install_baikal_m1_grub
 fi
+if [ "${hardware}" = "visionfive2" ] ; then
+  install_starfive_vf2_grub
+fi
 if [ "${hardware}" = "intel-pc64" ] ; then
   install_intel_pc64_grub
 fi