532 |
{ |
{ |
533 |
local my_roothdd |
local my_roothdd |
534 |
local grubconf=${INSTALLPATH}/boot/grub/grub.conf |
local grubconf=${INSTALLPATH}/boot/grub/grub.conf |
535 |
local grub2conf=${INSTALLPATH}/boot/grub/grub.cfg |
local grub2conf=/boot/grub/grub.cfg |
536 |
|
|
537 |
# check for grub2 |
# check for grub2 |
538 |
if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]] |
if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]] |
540 |
# needed by grub-mkconfig on the first run |
# needed by grub-mkconfig on the first run |
541 |
if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]] |
if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]] |
542 |
then |
then |
543 |
install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst /boot/grub/video.lst || die |
install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die |
544 |
fi |
fi |
545 |
|
|
546 |
# set kernelopts |
# set kernelopts |
547 |
if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]] |
if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]] |
548 |
then |
then |
549 |
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT\)=.*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die |
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die |
550 |
else |
else |
551 |
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLPATH}/etc/conf.d/grub || die |
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLPATH}/etc/conf.d/grub || die |
552 |
fi |
fi |
553 |
echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.bashrc || die |
echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die |
554 |
echo "LC_ALL=C grub-mkconfig -o ${grub2conf}" >> ${INSTALLPATH}/root/.bashrc || die |
echo "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die |
555 |
echo "grub-install --no-floppy ${HDD}" >> ${INSTALLPATH}/root/.bashrc || die |
echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die |
556 |
|
echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die |
557 |
|
|
558 |
# grub-legacy |
# grub-legacy |
559 |
else |
else |
619 |
fi |
fi |
620 |
|
|
621 |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
622 |
cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF |
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
623 |
/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 |
624 |
root (hd0,0) |
root (hd0,0) |
625 |
setup (hd0) |
setup (hd0) |
633 |
mount -t proc proc ${INSTALLPATH}/proc |
mount -t proc proc ${INSTALLPATH}/proc |
634 |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
635 |
mount -o bind /dev ${INSTALLPATH}/dev |
mount -o bind /dev ${INSTALLPATH}/dev |
636 |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i |
637 |
umount ${INSTALLPATH}/proc |
umount ${INSTALLPATH}/proc |
638 |
umount ${INSTALLPATH}/sys |
umount ${INSTALLPATH}/sys |
639 |
umount ${INSTALLPATH}/dev |
umount ${INSTALLPATH}/dev |
640 |
rm ${INSTALLPATH}/root/.bashrc |
rm ${INSTALLPATH}/root/.installrc |
641 |
} |
} |
642 |
|
|
643 |
is_initrd_supported() |
is_initrd_supported() |
652 |
# only generate initrds if the cmd exists |
# only generate initrds if the cmd exists |
653 |
is_initrd_supported || return 0 |
is_initrd_supported || return 0 |
654 |
|
|
655 |
cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF |
DISKMODS="sd_mod" |
656 |
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" |
657 |
|
PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" |
658 |
|
SATAMODS="sata_via sata_sis sata_nv" |
659 |
|
DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" |
660 |
|
FBMODS="uvesafb" |
661 |
|
|
662 |
|
# install an appropriate uvesafb.conf |
663 |
|
install -d ${INSTALLPATH}/etc/modprobe.d || die |
664 |
|
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die |
665 |
|
|
666 |
|
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
667 |
|
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd |
668 |
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 |
669 |
exit 0 |
exit 0 |
670 |
CHROOTEOF |
CHROOTEOF |
673 |
mount -t proc proc ${INSTALLPATH}/proc |
mount -t proc proc ${INSTALLPATH}/proc |
674 |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
675 |
mount -o bind /dev ${INSTALLPATH}/dev |
mount -o bind /dev ${INSTALLPATH}/dev |
676 |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i |
677 |
umount ${INSTALLPATH}/proc |
umount ${INSTALLPATH}/proc |
678 |
umount ${INSTALLPATH}/sys |
umount ${INSTALLPATH}/sys |
679 |
umount ${INSTALLPATH}/dev |
umount ${INSTALLPATH}/dev |
680 |
rm ${INSTALLPATH}/root/.bashrc |
rm ${INSTALLPATH}/root/.installrc |
681 |
} |
} |
682 |
|
|
683 |
is_uuid_supported() |
is_uuid_supported() |