Add basic support for loongarch64

This commit is contained in:
dandan zhang 2024-09-25 10:46:15 +00:00 committed by Steve McIntyre
parent 364d0e20a9
commit 81bd9bf6ec
8 changed files with 164 additions and 2 deletions

View File

@ -222,6 +222,9 @@ export JIGDO_CHECKSUM="md5"
#export amd64_MKISOFS="xorriso" #export amd64_MKISOFS="xorriso"
#export amd64_MKISOFS_OPTS="-as mkisofs -r -checksum_algorithm_iso sha256,sha512" #export amd64_MKISOFS_OPTS="-as mkisofs -r -checksum_algorithm_iso sha256,sha512"
export loong64_MKISOFS="xorriso"
export loong64_MKISOFS_OPTS="-as mkisofs -r -checksum_algorithm_iso sha256,sha512"
# amd64 builds will also include 32-bit UEFI files by default, to # amd64 builds will also include 32-bit UEFI files by default, to
# allow for booting on weird machines with 64-bit CPUs but 32-bit # allow for booting on weird machines with 64-bit CPUs but 32-bit
# firmware like Baytrail or some models of Apple iMac. To disable # firmware like Baytrail or some models of Apple iMac. To disable

View File

@ -70,7 +70,7 @@ DEBOOTSTRAP_OPTS=--no-check-gpg
endif endif
## Additional packages required for Debian Ports ## Additional packages required for Debian Ports
DEBIAN_PORTS_ARCHES=alpha hppa ia64 hurd-amd64 hurd-i386 m68k powerpc powerpcspe ppc64 sh4 sparc sparc64 x32 DEBIAN_PORTS_ARCHES=alpha hppa ia64 hurd-amd64 hurd-i386 loong64 m68k powerpc powerpcspe ppc64 sh4 sparc sparc64 x32
ifneq (,$(filter $(DEBIAN_PORTS_ARCHES),$(ARCHES))) ifneq (,$(filter $(DEBIAN_PORTS_ARCHES),$(ARCHES)))
export BASE_INCLUDE := $(BASEDIR)/data/debian_ports $(BASE_INCLUDE) export BASE_INCLUDE := $(BASEDIR)/data/debian_ports $(BASE_INCLUDE)
endif endif

View File

@ -0,0 +1,3 @@
choose-mirror
netcfg
ethdetect

View File

@ -0,0 +1,2 @@
netcfg
ethdetect

View File

@ -0,0 +1,3 @@
netcfg
ethdetect
pcmciautils-udeb

140
tools/boot/trixie/boot-loong64 Executable file
View File

@ -0,0 +1,140 @@
#!/bin/bash
# Based on boot-x86
#
# Do install stuff for loong64, including making bootable CDs
# Works with debian-installer
#
# $1 is the CD number
# $2 is the temporary CD build dir
. $BASEDIR/tools/boot/$DI_CODENAME/common.sh
set -e
#set -x
# Workaround for #823881:
export MTOOLS_SKIP_CHECK=1
N=$1
CDDIR=$2
INSTALLDIR="install"
# Common options for all disks
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J -joliet-long"
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-cache-inodes"
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-l"
# Exit if this is not CD#1/DVD#1
if [ $N != "1" ]; then
exit 0
fi
if [ "$DI_WWW_HOME" = "default" ]; then
DI_WWW_HOME="https://d-i.debian.org/daily-images/loong64/daily"
try_di_image_cache
else
DI_WWW_HOME=$(echo $DI_WWW_HOME | sed "s,%ARCH%,$ARCH,")
fi
case "$MKISOFS" in
*xorriso*)
XORRISO_VER=$(xorriso_version)
;;
*)
echo "ERROR: debian-cd depends on xorriso for making $ARCH bootable CDs."
exit 1;
;;
esac
cd $CDDIR/..
BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/debian-cd_info.tar.gz"
# Download boot images.
for image in $BOOT_IMAGES; do
if [ ! -e "$image" ]; then
dir=$(dirname $image)
mkdir -p $dir
if [ -n "$LOCAL" -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
elif [ ! "$DI_WWW_HOME" ];then
if [ ! "$DI_DIR" ];then
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
fi
cp "$DI_DIR/$image" "$image"
else
$WGET "$DI_WWW_HOME/$image" -O "$image"
fi
fi
done
mkdir -p $CDDIR/$INSTALLDIR
cp -lf cdrom/vmlinuz $CDDIR/$INSTALLDIR/
cp -lf cdrom/initrd.gz $CDDIR/$INSTALLDIR/
# Try to add graphical installer build too
extra_image gtk/vmlinuz "../vmlinuz" || true
extra_image gtk/initrd.gz "../initrd.gz" || true
# Boot setup including config and help files comes from d-i.
mkdir -pv $PWD/boot$N
cat cdrom/debian-cd_info.tar.gz | (cd boot$N/; tar zx)
if [ -d boot$N/grub ] ; then
echo " Adding EFI boot code for $ARCH on CD$N"
# Move GRUB files to the right place.
mkdir -p $CDDIR/EFI/boot
mcopy -n -s -i boot$N/grub/efi.img '::efi/*' $CDDIR/EFI
mkdir -p $CDDIR/boot/grub
mv boot$N/grub/* $CDDIR/boot/grub/
rmdir boot$N/grub
change_grub_cfg_uuid $CDDIR
# Stuff the EFI boot files into a FAT filesystem, making it as
# small as possible. We end up re-packing like this in case we're
# making a multi-arch image
# First, work out how many blocks we need
blocks=$(calculate_efi_image_size $CDDIR)
# Now make a new image to contain the files
rm -f $CDDIR/boot/grub/efi.img
mkfs.msdos --invariant -v -i deb00001 -C "$CDDIR/boot/grub/efi.img" $blocks >/dev/null
# And copy them into place
mmd -i "$CDDIR/boot/grub/efi.img" ::efi
mcopy -o -s -i "$CDDIR/boot/grub/efi.img" $CDDIR/EFI/* \
"::efi"
# Ugh - different code here depending on the version of xorriso we've got
if [ $XORRISO_VER -le 10202 ] ; then
echo "ERROR: debian-cd depends on xorriso > 1.2.2 for making $ARCH bootable CDs."
exit 1;
elif [ $XORRISO_VER -gt 10202 ] ; then
echo " Using newer EFI support in xorriso $XORRISO_VER"
# Location of the EFI boot image, and don't emulate a floppy or HD
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-e boot/grub/efi.img -no-emul-boot"
# Add an *extra* partition on the end for the EFI bits
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-append_partition 2 0xef $CDDIR/boot/grub/efi.img"
# And force alignment
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-partition_cyl_align all"
fi
# Finally, belt and braces - fix up the %install% entries in grub
# in case they're still there
sed -i "s|\%install\%|$INSTALLDIR|g" $CDDIR/boot/grub/grub.cfg
# Substitute custom KERNEL_PARAMS into grub.cfg
sed -i "s|/vmlinuz |/vmlinuz $KERNEL_PARAMS |g" $CDDIR/boot/grub/grub.cfg
else
echo " No EFI boot code for $ARCH on CD$N"
fi
# th,th, thats all

View File

@ -379,4 +379,15 @@ grub-pc
s390-tools s390-tools
sysconfig-hardware sysconfig-hardware
#endif #endif
#ifdef ARCH_loong64
initramfs-tools
busybox
zstd
linux-image-loong64
linux-headers-loong64
grub-efi
grub-efi-loong64
grub-efi-loong64-bin
#endif
EOF EOF

View File

@ -89,7 +89,7 @@ CAPCODE=`perl -e "print ucfirst("$CODENAME")"`
export FIRSTVER CAPCODE export FIRSTVER CAPCODE
if [ "$ARCHLIST"x = ""x ] ; then if [ "$ARCHLIST"x = ""x ] ; then
ARCHLIST="arm64 armel armhf amd64 i386 mips mipsel mips64el ppc64el s390x source" # amd64 # -all dealt with specially ARCHLIST="arm64 armel armhf amd64 i386 loong64 mips mipsel mips64el ppc64el s390x source" # amd64 # -all dealt with specially
fi fi
export TDIR NONFREE NONFREE_FIRMWARE VER MIRROR CODENAME OUT BASEDIR export TDIR NONFREE NONFREE_FIRMWARE VER MIRROR CODENAME OUT BASEDIR