Add x86/x86_64 support

This commit is contained in:
Johan Gunnarsson 2021-08-02 21:30:12 +02:00
parent e23edc73ca
commit 6752f8de1e
15 changed files with 109 additions and 11 deletions

View File

@ -0,0 +1,17 @@
#!/bin/sh
# Generate initrd.uimg and update U-Boot boot.scr
# Kernel ABI string
ABI="${1}"
# Create U-Boot boot script
cat << EOF > /boot/boot.cmd
load \${devtype} \${devnum}:\${distro_bootpart} \${kernel_addr_r} /boot/vmlinuz-${ABI}
load \${devtype} \${devnum}:\${distro_bootpart} \${ramdisk_addr_r} /boot/initrd.img-${ABI}
part uuid \${devtype} \${devnum}:\${distro_bootpart} partuuid
setenv bootargs root=PARTUUID=\${partuuid} rw rootwait
zboot \${kernel_addr_r} - \${ramdisk_addr_r} 0x2000000
EOF
# Create U-Boot boot script
mkimage -A x86_64 -T script -C none -d /boot/boot.cmd /boot/boot.scr

View File

@ -0,0 +1,17 @@
#!/bin/sh
# Generate initrd.uimg and update U-Boot boot.scr
# Kernel ABI string
ABI="${1}"
# Create U-Boot boot script
cat << EOF > /boot/boot.cmd
load \${devtype} \${devnum}:\${distro_bootpart} \${kernel_addr_r} /boot/vmlinuz-${ABI}
load \${devtype} \${devnum}:\${distro_bootpart} \${ramdisk_addr_r} /boot/initrd.img-${ABI}
part uuid \${devtype} \${devnum}:\${distro_bootpart} partuuid
setenv bootargs root=PARTUUID=\${partuuid} rw rootwait
zboot \${kernel_addr_r} - \${ramdisk_addr_r} 0x2000000
EOF
# Create U-Boot boot script
mkimage -A x86 -T script -C none -d /boot/boot.cmd /boot/boot.scr

View File

@ -31,11 +31,14 @@ RUN apt-get update && \
awscli && \
([ "$(uname -m)" = "aarch64" ] && \
apt-get --assume-yes \
install gcc-arm-linux-gnueabihf || :) && \
install gcc-arm-linux-gnueabihf \
gcc-i686-linux-gnu \
gcc-x86-64-linux-gnu || :) && \
([ "$(uname -m)" = "x86_64" ] && \
apt-get --assume-yes \
install gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabihf || :) && \
install gcc-arm-linux-gnueabihf \
gcc-aarch64-linux-gnu \
gcc-i686-linux-gnu || :) && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -f /var/log/*.log

View File

@ -154,3 +154,5 @@ merrii_a80_optimus,Merrii A80 Optimus,Merrii,allwinner-a80,Merrii_A80_Optimus_de
qemu_arm_virt,QEMU arm virt,QEMU,qemu-arm,qemu_arm_defconfig,arm-linux-gnueabihf,N/A
qemu_aarch64_virt,QEMU aarch64 virt,QEMU,qemu-aarch64,qemu_arm64_defconfig,aarch64-linux-gnu,N/A
qemu_x86_virt,QEMU x86 virt,QEMU,qemu-x86,qemu-x86_defconfig,i686-linux-gnu,N/A
qemu_x86_64_virt,QEMU x86_64 virt,QEMU,qemu-x86_64,qemu-x86_64_defconfig,x86_64-linux-gnu,N/A

1 Board ID Board name Board maker Chip ID U-Boot defconfig Build tuple Device tree
154
155
156
157
158

View File

@ -33,3 +33,5 @@ rk3399,RK3399,Rockchip,ARM Cortex A72/A53,armv8
qemu-arm,arm,QEMU,ARM Cortex A15,armv7
qemu-aarch64,aarch64,QEMU,ARM Cortex A53,armv8
qemu-x86_64,x86_64,QEMU,x86 qemu64,x86-64
qemu-x86,x86,QEMU,x86 qemu64,x86

1 Chip ID Chip name Chip maker CPU CPU architecture
33 qemu-x86 x86 QEMU x86 qemu64 x86
34
35
36
37

10
debians-x86.csv Normal file
View File

@ -0,0 +1,10 @@
OS,Dist,Arch
debian,buster,i386
debian,buster,amd64
debian,bullseye,i386
debian,bullseye,amd64
debian,sid,i386
debian,sid,amd64
1 OS Dist Arch
2 debian buster i386
3 debian buster amd64
4 debian bullseye i386
5 debian bullseye amd64
6 debian sid i386
7 debian sid amd64

View File

@ -10,5 +10,17 @@ set -ex
build-u_boot "${DEFCONFIG}" "${TUPLE}"
case "${CHIP_ID}" in
qemu-x86|qemu-x86_64)
FILE=u-boot.rom
;;
qemu-arm|qemu-aarch64)
FILE=u-boot.bin
;;
*)
echo "Unknown CHIP_ID \"${CHIP_ID}\""
exit 1
esac
# Copy U-Boot to 16 sectors from start
dd if=u-boot/u-boot.bin of=tmp.img seek=16
dd if=u-boot/"${FILE}" of=tmp.img seek=16 conv=notrunc

14
scripts/build-boot-qemu-x86 Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
# Build SD card image
BOARD_ID="${1}" # For example "bananapi"
CHIP_ID="${2}" # For example "allwinner-a10"
DEFCONFIG="${3}" # For example "Bananapi_defconfig"
TUPLE="${4}" # For example "arm-linux-gnueabihf"
set -ex
build-u_boot "${DEFCONFIG}" "${TUPLE}"
# Copy U-Boot to 16 sectors from start
dd if=u-boot/u-boot.rom of=tmp.img seek=16 conv=notrunc

View File

@ -20,4 +20,4 @@ esac
build-u_boot "${DEFCONFIG}" "${TUPLE}"
# Copy U-Boot to 64 sectors from start
dd if=u-boot/u-boot-rockchip.bin of=tmp.img seek=64
dd if=u-boot/u-boot-rockchip.bin of=tmp.img seek=64 conv=notrunc

View File

@ -44,11 +44,11 @@ sed -i -e "s/BOOT_UART=0/BOOT_UART=1/" bootcode.bin
# Create empty FAT partition
rm -f vfat.img
fallocate -l 31MiB vfat.img
fallocate -l 28MiB vfat.img
mkfs.vfat vfat.img
# Copy boot files to FAT partition
mcopy -v -i vfat.img u-boot/u-boot.bin config.txt fixup*.dat start*.elf bootcode.bin ::
# Copy FAT partition to image
dd if=vfat.img of=tmp.img bs=1K seek=1K
dd if=vfat.img of=tmp.img bs=1K seek=1K conv=notrunc

View File

@ -24,4 +24,4 @@ esac
build-u_boot "${DEFCONFIG}" "${TUPLE}"
# Copy U-Boot to 8192 bytes from start
dd if=u-boot/u-boot-sunxi-with-spl.bin of=tmp.img bs=1K seek=8
dd if=u-boot/u-boot-sunxi-with-spl.bin of=tmp.img bs=1K seek=8 conv=notrunc

View File

@ -18,7 +18,17 @@ debian-arm64)
URL=http://deb.debian.org/debian
SCRIPT=/usr/share/debootstrap/scripts/sid
;;
ubuntu-armhf|ubuntu-arm64)
debian-i386)
KERNEL=linux-image-686
URL=http://deb.debian.org/debian
SCRIPT=/usr/share/debootstrap/scripts/sid
;;
debian-amd64)
KERNEL=linux-image-amd64
URL=http://deb.debian.org/debian
SCRIPT=/usr/share/debootstrap/scripts/sid
;;
ubuntu-armhf|ubuntu-arm64|ubuntu-amd64)
KERNEL=linux-image-generic
URL=http://ports.ubuntu.com/ubuntu-ports
SCRIPT=/usr/share/debootstrap/scripts/gutsy

View File

@ -6,9 +6,17 @@ IMAGE="${1}"
set -ex
rm -f "${IMAGE}"
fallocate -l 2GB "${IMAGE}" # 2,000,000,000 bytes
fallocate -v -l 2GB "${IMAGE}" # 2,000,000,000 bytes
parted -s "${IMAGE}" mklabel msdos
parted -s "${IMAGE}" mkpart primary fat32 -- 1MiB 32MiB # 31 MiB (32,505,856 bytes)
parted -s "${IMAGE}" mkpart primary fat32 -- 4MiB 32MiB # 28 MiB (50,331,648 bytes)
parted -s "${IMAGE}" mkpart primary ext2 -- 32MiB -1
parted -s "${IMAGE}" set 2 boot on
# Create empty FAT partition
rm -f vfat.img
fallocate -l 28MiB vfat.img
mkfs.vfat vfat.img
# Copy FAT partition to image
dd if=vfat.img of="${IMAGE}" bs=1K seek=4K conv=notrunc

View File

@ -36,6 +36,9 @@ arm-*)
aarch64-*)
export ARCH="aarch64"
;;
x86_64-*|i?86-*)
export ARCH="x86"
;;
*)
echo "Can't decide \$ARCH for tuple \"${TUPLE}\""
exit 1