Dash:
[t2-trunk.git] / architecture / x86 / boot / boot.in
blob44a164f6cb6bfcf258c2c92af9df91b9a4cea4c1
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: architecture/x86/boot/boot.in
3 # Copyright (C) 2007 - 2021 The T2 SDE Project
4
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
7
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License version 2.
10 # --- T2-COPYRIGHT-NOTE-END ---
12 . $base/architecture/share/boot/grub.in
14 if [ "$SDECFG_X86_CD_LOADER" = "isolinux" ]; then
16 arch_boot_cd_pre()
18         mkdir -p $isofsdir/boot/isolinux
19         cp -af $build_root/usr/share/syslinux/isolinux.bin $isofsdir/boot/isolinux/
20         # TODO: theme: cp -af $build_root/boot/t2.xpm.gz $isofsdir/boot/
22         # header
23         sed -n '/CUT/q;p' $base/architecture/x86/boot/isolinux.cfg \
24                 > $1/boot/isolinux/isolinux.cfg
25         isolinux_label=0
28 arch_boot_cd_add()
30         [ $(( isolinux_label++ )) = 0 ] &&
31         cat >> $1/boot/isolinux/isolinux.cfg <<-EOT
33 DEFAULT $2
34 EOT
36         cat >> $1/boot/isolinux/isolinux.cfg <<-EOT
38 LABEL $2
39 KERNEL $4
40 APPEND initrd=$5
41 EOT
44 arch_boot_cd_post()
46         # footer
47         sed '1,/CUT/d' $base/architecture/x86/boot/isolinux.cfg \
48                 >> $1/boot/isolinux/isolinux.cfg
49         echo_status "Creating isofs_arch.txt file .."
51         cat > $build_toolchain/isofs_arch.txt <<- EOT
52 BOOT    -b boot/isolinux/isolinux.bin -c boot/isolinux/isolinux.cat -no-emul-boot
53 BOOTx   -boot-load-size 4 -boot-info-table -allow-multidot -relaxed-filenames
54 DISK1   $isofsdir/ /
55 EOT
56         unset isolinux_label
59 elif [ "$SDECFG_X86_CD_LOADER" = "grub" ]; then
61 arch_boot_cd_pre()
63         mkdir -p $isofsdir/boot/grub
64         cp -af $build_root/boot/grub/stage{1,2,2_eltorito} $isofsdir/boot/grub/
65         cp -af $build_root/boot/t2.xpm.gz $isofsdir/boot/
67         # header
68         sed -n '/CUT/q;p' $base/architecture/x86/boot/menu.lst \
69                 > $1/boot/grub/menu.lst
72 arch_boot_cd_add()
74         cat >> $1/boot/grub/menu.lst <<-EOT
76 title  $3 (Kernel: $2)
77 kernel (cd)$4
78 initrd (cd)$5
79 EOT
82 arch_boot_cd_post()
84         # footer
85         sed '1,/CUT/d' $base/architecture/x86/boot/menu.lst \
86                 >> $1/boot/grub/menu.lst
87         echo_status "Creating isofs_arch.txt file .."
89         cat > $build_toolchain/isofs_arch.txt <<- EOT
90 BOOT    -b boot/grub/stage2_eltorito -no-emul-boot
91 BOOTx   -boot-load-size 4 -boot-info-table
92 DISK1   $isofsdir/ /
93 EOT
96 else    # grub2
98 arch_boot_cd_pre()
100         local platform=i386-pc
101         mkdir -p $isofsdir/boot/grub
102         cp -af $build_root/usr/lib*/grub/* $isofsdir/boot/grub/
103         rm -f $isofsdir/boot/grub/*/*.{module,img} # not needed in the image
104         #cp -af $build_root/boot/t2.xpm.gz $isofsdir/boot/
106         if true; then
107                 grub-mkimage -O i386-pc-eltorito -p /boot/grub \
108                      -d $build_root/usr/lib*/grub/$platform \
109                      -o $isofsdir/boot/grub/$platform/eltorito.img \
110                      --compression auto biosdisk iso9660 part_msdos part_gpt
111         fi
113         platform=x86_64-efi
114         local exe=bootx64.efi
115         [ $arch = x86 ] && platform=i386-efi && exe=${exe/x64/ia32}
117         mkdir -p $isofsdir/efi/boot/
118         grub-mkimage -O $platform -p "/boot/grub" \
119                      -d $build_root/usr/lib*/grub/$platform \
120                      -o $isofsdir/efi/boot/$exe \
121                      --compression auto iso9660 fat part_msdos part_gpt
123         grub_create_efi_img $isofsdir/efi/boot/$exe
125         # header
126         sed -n '/CUT/q;p' $base/architecture/x86/boot/grub.cfg \
127                 > $1/boot/grub/grub.cfg
130 arch_boot_cd_add()
132         cat >> $1/boot/grub/grub.cfg <<-EOT
134 menuentry "$3 ($2)" {
135         linux $4
136         initrd $5
141 arch_boot_cd_post()
143         # footer
144         sed '1,/CUT/d' $base/architecture/x86/boot/grub.cfg \
145                 >> $1/boot/grub/grub.cfg
146         echo_status "Creating isofs_arch.txt file .."
148         echo "DISK1     $isofsdir/ /" > $build_toolchain/isofs_arch.txt
150         if true; then
151                 cat >> $build_toolchain/isofs_arch.txt <<- EOT
152 BOOT    -b boot/grub/i386-pc/eltorito.img -no-emul-boot
153 BOOTx   -boot-load-size 4 -boot-info-table --grub2-boot-info --protective-msdos-label
154 BOOTx   --grub2-mbr $build_root/usr/lib*/grub/i386-pc/boot_hybrid.img
156         fi
157         cat >> $build_toolchain/isofs_arch.txt <<- EOT
158 BOOTx   -eltorito-alt-boot -no-emul-boot
160         grub_create_boot_entry >> $build_toolchain/isofs_arch.txt