REPOS=(
deb.devuan.org/merged_excalibur_main
- deb.devuan.org/merged_ceres_main
+ #deb.devuan.org/merged_ceres_main
)
ARCH="amd64"
MBR=dos # gpt
done
# Append any additional saved deb files
-for DEB in save/*.deb ; do
+for DEB in $(ls save/*.deb 2>/dev/null); do
P="${DEB%%_*}"
P="${P#save/}"
echo "$P save/$DEB" >> $MAPFILE
MODULES=(
# disk
scsi_common scsi_mod libata ata_piix ata_generic cdrom sr_mod
- crc32-pclmul crct10dif_common crc-t10dif crc64 crc64-rocksoft
- t10-pi sd_mod sg
- nls_cp437 nls_ascii fat vfat
- crc32c_generic jbd2 mbcache crc16 ext4
+ crc32-pclmul crc32c_generic crc16
+ #crct10dif_common crc-t10dif crc64 crc64-rocksoft t10-pi
+ sd_mod sg nls_cp437 nls_ascii fat vfat jbd2 mbcache ext4
usb-storage usbcore usb-common xhci-pci xhci-hcd
- isofs exfat loop
- efivarfs
+ isofs exfat loop efivarfs
# input
psmouse evdev
# network
rm -f bootimage.raw
dd if=/dev/zero of=bootimage.raw bs=32M count=1
+EFILDR="kernel/usr/lib/SYSLINUX.EFI/efi64/syslinux.efi"
+EFIMODS="kernel/usr/lib/syslinux/modules/efi64/*"
+LCYMODS="kernel/usr/lib/syslinux/modules/bios/*"
+VMLINUZ="kernel/boot/vm*"
+
+SIZE=$(du -c $EFILDR $EFIMODS $LCYMODS $VMLINUZ \
+ initrd.gz splash.png syslinux-legacy.cfg \
+ muffin.lua syslinux-uefi.cfg | sed '$!d;s|\s.*||' )
+echo "du = $SIZE kb"
+SIZE=$(( ( ( 2 * SIZE + 4096 ) / 2048 ) * 2048 ))
+echo "SIZE = $SIZE sectors"
+
# Prepare a gpt/dos partition table with a first partition marked as EFI
sfdisk bootimage.raw <<EOF
label: $MBR
-2048 32767 U *
+2048 $SIZE U *
- - L
EOF
-# Add a fat filesystem at 2048 61440
-mkfs.fat -n TINIEST --offset 2048 -F 16 bootimage.raw
+# Add a fat filesystem at 2048
+mkfs.fat -n TINIEST --offset 2048 bootimage.raw
IMG="-i bootimage.raw@@$((2048*512))"
-# Add an ext2 filesystem at offset 34816*512
+# Add an ext2 filesystem at offset
# Copy initrd.gz and kernel into the fat filesystem root
-EXT=offset=$((34816*512))
-mke2fs -t ext4 -E $EXT -F bootimage.raw 15M
-
-mcopy $IMG initrd.gz ::
-mcopy $IMG kernel/boot/vm* ::/vmlinuz
-mcopy $IMG splash.png ::/
+PART2=( $(fdisk -lo START,SECTORS bootimage.raw | sed '$!d') )
+EXT=offset=$(( ${PART2[0]} * 512 ))
+echo mke2fs -t ext4 -E $EXT -F bootimage.raw $(( ${PART2[1]} / 2 ))
+mke2fs -t ext4 -E $EXT -F bootimage.raw $(( ${PART2[1]} / 2 ))
+# Note that this is unsafe copying that might spill outside the partition
+mmd $IMG ::/EFI
+mmd $IMG ::/EFI/BOOT
mmd $IMG ::/boot
mmd $IMG ::/boot/syslinux
mmd $IMG ::/boot/syslinux/bios
-mcopy $IMG \
- kernel/usr/lib/syslinux/modules/bios/* ::/boot/syslinux/bios
+
+mcopy $IMG initrd.gz ::/
+mcopy $IMG $VMLINUZ ::/vmlinuz
+mcopy $IMG splash.png ::/
mcopy $IMG syslinux-legacy.cfg ::/syslinux.cfg
-syslinux --install --offset=${IMG#*@@} bootimage.raw
-mmd $IMG ::/EFI
-mmd $IMG ::/EFI/BOOT
-mcopy $IMG kernel/usr/lib/SYSLINUX.EFI/efi64/syslinux.efi \
- ::/EFI/BOOT/bootx64.efi
-mcopy $IMG \
- kernel/usr/lib/syslinux/modules/efi64/* ::/EFI/BOOT
+mcopy $IMG muffin.lua ::/EFI/BOOT/muffin.lua
+mcopy $IMG $EFILDR ::/EFI/BOOT/bootx64.efi
mcopy $IMG syslinux-uefi.cfg ::/EFI/BOOT/syslinux.cfg
-## Add lua boot script
-mcopy $IMG muffin.lua ::/EFI/BOOT/muffin.lua
+mcopy $IMG $EFIMODS ::/EFI/BOOT/
+
+mcopy $IMG $LCYMODS ::/boot/syslinux/bios/
+syslinux --install --offset=${IMG#*@@} bootimage.raw
case "$MBR" in
dos) MBRBIN=mbr.bin ;;