32 |
#TOTALLINES=11072 # -> now in images.conf |
#TOTALLINES=11072 # -> now in images.conf |
33 |
|
|
34 |
# standard kernel opts |
# standard kernel opts |
35 |
KERNELOPTS="quiet splash=silent,theme=default" |
KERNELOPTS="quiet video=1024x768" |
36 |
|
|
37 |
|
# grub options |
38 |
|
GRUBLEGACYOPTS="" |
39 |
|
GRUB2OPTS="" |
40 |
|
|
41 |
# default specialdevices |
# default specialdevices |
42 |
SPECIALDEVICE="" |
SPECIALDEVICE="" |
448 |
fi |
fi |
449 |
done |
done |
450 |
|
|
451 |
export KERNELOPTS="${KERNELOPTS} rootdelay=8" |
# only add this for grub legacy, grub2 detect these settings on its own |
452 |
|
export GRUBLEGACYOPTS="rootdelay=8" |
453 |
export SPECIALDEVICE="zotac" |
export SPECIALDEVICE="zotac" |
454 |
fi |
fi |
455 |
} |
} |
537 |
{ |
{ |
538 |
local my_roothdd |
local my_roothdd |
539 |
local grubconf=${INSTALLPATH}/boot/grub/grub.conf |
local grubconf=${INSTALLPATH}/boot/grub/grub.conf |
540 |
local grub2conf=${INSTALLPATH}/boot/grub/grub.cfg |
local grub2conf=/boot/grub/grub.cfg |
541 |
|
|
542 |
# check for grub2 |
# check for grub2 |
543 |
if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]] |
if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]] |
545 |
# needed by grub-mkconfig on the first run |
# needed by grub-mkconfig on the first run |
546 |
if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]] |
if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]] |
547 |
then |
then |
548 |
install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst /boot/grub/video.lst |
install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die |
549 |
|
fi |
550 |
|
|
551 |
|
# set kernelopts |
552 |
|
if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]] |
553 |
|
then |
554 |
|
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die |
555 |
|
else |
556 |
|
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLPATH}/etc/conf.d/grub || die |
557 |
fi |
fi |
558 |
echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.bashrc |
echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die |
559 |
echo "LC_ALL=C grub-mkconfig -o ${grub2conf}" >> ${INSTALLPATH}/root/.bashrc |
echo "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die |
560 |
echo "grub-install --no-floppy ${HDD}" >> ${INSTALLPATH}/root/.bashrc |
echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die |
561 |
|
echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die |
562 |
|
|
563 |
# grub-legacy |
# grub-legacy |
564 |
else |
else |
596 |
echo "# normal boot" >> ${grubconf} || die |
echo "# normal boot" >> ${grubconf} || die |
597 |
echo "title ${KRNVER}" >> ${grubconf} || die |
echo "title ${KRNVER}" >> ${grubconf} || die |
598 |
echo "root (hd0,0)" >> ${grubconf} || die |
echo "root (hd0,0)" >> ${grubconf} || die |
599 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS}" >> ${grubconf} || die |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die |
600 |
if is_initrd_supported |
if is_initrd_supported |
601 |
then |
then |
602 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
607 |
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die |
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die |
608 |
echo "lock" >> ${grubconf} || die |
echo "lock" >> ${grubconf} || die |
609 |
echo "root (hd0,0)" >> ${grubconf} || die |
echo "root (hd0,0)" >> ${grubconf} || die |
610 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} hardware-auto-detection" >> ${grubconf} || die |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die |
611 |
if is_initrd_supported |
if is_initrd_supported |
612 |
then |
then |
613 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
617 |
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die |
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die |
618 |
echo "lock" >> ${grubconf} || die |
echo "lock" >> ${grubconf} || die |
619 |
echo "root (hd0,0)" >> ${grubconf} || die |
echo "root (hd0,0)" >> ${grubconf} || die |
620 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} alx-reset-settings" >> ${grubconf} || die |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die |
621 |
if is_initrd_supported |
if is_initrd_supported |
622 |
then |
then |
623 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
624 |
fi |
fi |
625 |
|
|
626 |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
627 |
cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF |
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
628 |
/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null |
/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null |
629 |
root (hd0,0) |
root (hd0,0) |
630 |
setup (hd0) |
setup (hd0) |
638 |
mount -t proc proc ${INSTALLPATH}/proc |
mount -t proc proc ${INSTALLPATH}/proc |
639 |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
640 |
mount -o bind /dev ${INSTALLPATH}/dev |
mount -o bind /dev ${INSTALLPATH}/dev |
641 |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i |
642 |
umount ${INSTALLPATH}/proc |
umount ${INSTALLPATH}/proc |
643 |
umount ${INSTALLPATH}/sys |
umount ${INSTALLPATH}/sys |
644 |
umount ${INSTALLPATH}/dev |
umount ${INSTALLPATH}/dev |
645 |
rm ${INSTALLPATH}/root/.bashrc |
rm ${INSTALLPATH}/root/.installrc |
646 |
} |
} |
647 |
|
|
648 |
is_initrd_supported() |
is_initrd_supported() |
657 |
# only generate initrds if the cmd exists |
# only generate initrds if the cmd exists |
658 |
is_initrd_supported || return 0 |
is_initrd_supported || return 0 |
659 |
|
|
660 |
cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF |
DISKMODS="sd_mod" |
661 |
echo "MODULES=\"${FORMAT_FILESYSTEM} amd74xx piix sis5513 via82cxxx sd_mod ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via sata_via sata_sis sata_nv\"" > /etc/conf.d/mkinitrd |
OLDPATAMODS="amd74xx piix sis5513 via82cxxx" |
662 |
|
PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" |
663 |
|
SATAMODS="sata_via sata_sis sata_nv" |
664 |
|
DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" |
665 |
|
FBMODS="uvesafb" |
666 |
|
|
667 |
|
# install an appropriate uvesafb.conf |
668 |
|
install -d ${INSTALLPATH}/etc/modprobe.d || die |
669 |
|
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die |
670 |
|
|
671 |
|
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
672 |
|
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd |
673 |
mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null |
mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null |
674 |
exit 0 |
exit 0 |
675 |
CHROOTEOF |
CHROOTEOF |
678 |
mount -t proc proc ${INSTALLPATH}/proc |
mount -t proc proc ${INSTALLPATH}/proc |
679 |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
680 |
mount -o bind /dev ${INSTALLPATH}/dev |
mount -o bind /dev ${INSTALLPATH}/dev |
681 |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i |
682 |
umount ${INSTALLPATH}/proc |
umount ${INSTALLPATH}/proc |
683 |
umount ${INSTALLPATH}/sys |
umount ${INSTALLPATH}/sys |
684 |
umount ${INSTALLPATH}/dev |
umount ${INSTALLPATH}/dev |
685 |
rm ${INSTALLPATH}/root/.bashrc |
rm ${INSTALLPATH}/root/.installrc |
686 |
} |
} |
687 |
|
|
688 |
is_uuid_supported() |
is_uuid_supported() |