34 |
# standard kernel opts |
# standard kernel opts |
35 |
KERNELOPTS="quiet video=1024x768" |
KERNELOPTS="quiet video=1024x768" |
36 |
|
|
37 |
|
# grub options |
38 |
|
GRUBLEGACYOPTS="" |
39 |
|
GRUB2OPTS="" |
40 |
|
|
41 |
|
# fdisk options |
42 |
|
FDISKPARTIONBELOW256MB=0 |
43 |
|
|
44 |
# default specialdevices |
# default specialdevices |
45 |
SPECIALDEVICE="" |
SPECIALDEVICE="" |
46 |
|
FORMFACTOR="desktop" |
47 |
|
|
48 |
# target filesystem |
# target filesystem |
49 |
FORMAT_FILESYSTEM="ext4" |
FORMAT_FILESYSTEM="ext4" |
207 |
# other devices |
# other devices |
208 |
run_hardware_detection |
run_hardware_detection |
209 |
case "${SPECIALDEVICE}" in |
case "${SPECIALDEVICE}" in |
210 |
zotac) echo " \n\n\n \\Z2Zotac Device erkannt!\\Zn \\" >> ${hwtmp} ;; |
zotac*) echo " \n\n\n \\Z2Zotac Device erkannt!\\Zn \\" >> ${hwtmp} ;; |
211 |
|
rangee) echo " \n\n\n \\Z2Rangee Device erkannt!\\Zn \\" >> ${hwtmp} ;; |
212 |
|
maxdata) echo " \n\n\n \\Z2Maxdata Device erkannt!\\Zn \\" >> ${hwtmp} ;; |
213 |
*) echo " \n\n\n \\ZnStandard Device erkannt!\\Zn \\" >> ${hwtmp} ;; |
*) echo " \n\n\n \\ZnStandard Device erkannt!\\Zn \\" >> ${hwtmp} ;; |
214 |
esac |
esac |
215 |
|
if [[ ${FORMFACTOR} = laptop ]] |
216 |
|
then |
217 |
|
echo " \n\n\n \\ZnFormfactor Laptop erkannt, Powersave Modus 'ondemand' wird aktiviert!\\Zn \\" >> ${hwtmp} |
218 |
|
fi |
219 |
|
|
220 |
echo " \" 13 70" >> ${hwtmp} |
echo " \" 13 70" >> ${hwtmp} |
221 |
chmod a+x ${hwtmp} |
chmod a+x ${hwtmp} |
445 |
################################################# |
################################################# |
446 |
run_hardware_detection() |
run_hardware_detection() |
447 |
{ |
{ |
448 |
|
local hwinfo |
449 |
|
|
450 |
|
hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" |
451 |
|
|
452 |
# check for special devices/clients: |
# check for special devices/clients: |
453 |
# if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd |
# if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd |
454 |
local removable=0 |
local removable=0 |
455 |
if [[ ! -z $(hwinfo --bios --storage | grep -i zotac) ]] |
if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] |
456 |
then |
then |
457 |
for i in /sys/block/[hs]d*/removable |
for i in /sys/block/[hs]d*/removable |
458 |
do |
do |
462 |
fi |
fi |
463 |
done |
done |
464 |
|
|
465 |
export KERNELOPTS="${KERNELOPTS} rootdelay=8" |
# only add this for grub legacy, grub2 detect these settings on its own |
466 |
export SPECIALDEVICE="zotac" |
export GRUBLEGACYOPTS="rootdelay=8" |
467 |
|
# there are to zotac types in the wild, nvidia based gfx and intel |
468 |
|
if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] |
469 |
|
then |
470 |
|
export SPECIALDEVICE="zotac_nvidia" |
471 |
|
else |
472 |
|
export SPECIALDEVICE="zotac_intel" |
473 |
|
fi |
474 |
fi |
fi |
475 |
|
|
476 |
|
# check for special devices/clients: |
477 |
|
# if a rangee and disk ist smaller then 256mb move partion one block further ahead |
478 |
|
if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]] |
479 |
|
then |
480 |
|
# for a rangee always define partion startblock +1 |
481 |
|
export FDISKPARTIONBELOW256MB="1" |
482 |
|
export SPECIALDEVICE="rangee" |
483 |
|
export GRUBLEGACYOPTS="" |
484 |
|
fi |
485 |
|
|
486 |
|
# check for special devices/clients: |
487 |
|
# check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer |
488 |
|
if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]] |
489 |
|
then |
490 |
|
export SPECIALDEVICE="maxdata" |
491 |
|
export GRUBLEGACYOPTS="" |
492 |
|
fi |
493 |
|
|
494 |
|
# check for special devices/clients: |
495 |
|
# check for laptops and activate cpufreq scaling |
496 |
|
if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]] |
497 |
|
then |
498 |
|
export FORMFACTOR="laptop" |
499 |
|
export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand" |
500 |
|
fi |
501 |
|
} |
502 |
|
|
503 |
|
hdd_size_below_256mb() |
504 |
|
{ |
505 |
|
local hdd="$1" |
506 |
|
local size |
507 |
|
local retval |
508 |
|
[[ -z ${hdd} ]] && die "Error: get_hdd_size() no \$hdd given!" |
509 |
|
|
510 |
|
size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:') |
511 |
|
if [[ ${size} -le 257000000 ]] |
512 |
|
then |
513 |
|
retval="0" |
514 |
|
else |
515 |
|
retval="1" |
516 |
|
fi |
517 |
|
|
518 |
|
return "${retval}" |
519 |
} |
} |
520 |
|
|
521 |
setup_hdd_partitions_auto() |
setup_hdd_partitions_auto() |
522 |
{ |
{ |
523 |
ROOTHDD="${HDD}1" |
ROOTHDD="${HDD}1" |
524 |
|
|
525 |
|
# run this only if FDISKPARTITIONBELOW256MB is not already 1 |
526 |
|
if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] |
527 |
|
then |
528 |
|
if hdd_size_below_256mb ${HDD} |
529 |
|
then |
530 |
|
FDISKPARTIONBELOW256MB=1 |
531 |
|
else |
532 |
|
FDISKPARTIONBELOW256MB=0 |
533 |
|
fi |
534 |
|
fi |
535 |
|
|
536 |
## delete disk |
## delete disk |
537 |
dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die |
dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die |
538 |
|
|
539 |
## setup one bootable partition |
if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
540 |
#1. n= new disk |
then |
541 |
#2. p= primary disk |
## setup one bootable partition |
542 |
#3. 1= first partition |
#1. n= new disk |
543 |
#4. ''= default sector start |
#2. p= primary disk |
544 |
#5. ''= defaul sector end |
#3. 1= first partition |
545 |
#6. a= bootable flag |
#4. 2= default sector start // small disk needs more space for grub2 mbr sector |
546 |
#7. 1= boot flag for partition 1 |
#5. ''= defaul sector end |
547 |
#8. w= write/quit |
#6. a= bootable flag |
548 |
fdisk ${HDD} &> /dev/null << EOF |
#7. 1= boot flag for partition 1 |
549 |
|
#8. w= write/quit |
550 |
|
fdisk ${HDD} &> /dev/null << EOF |
551 |
|
n |
552 |
|
p |
553 |
|
1 |
554 |
|
2 |
555 |
|
|
556 |
|
a |
557 |
|
1 |
558 |
|
w |
559 |
|
EOF |
560 |
|
else |
561 |
|
## setup one bootable partition |
562 |
|
#1. n= new disk |
563 |
|
#2. p= primary disk |
564 |
|
#3. 1= first partition |
565 |
|
#4. ''= default sector start |
566 |
|
#5. ''= defaul sector end |
567 |
|
#6. a= bootable flag |
568 |
|
#7. 1= boot flag for partition 1 |
569 |
|
#8. w= write/quit |
570 |
|
fdisk ${HDD} &> /dev/null << EOF |
571 |
n |
n |
572 |
p |
p |
573 |
1 |
1 |
577 |
1 |
1 |
578 |
w |
w |
579 |
EOF |
EOF |
580 |
|
fi |
581 |
} |
} |
582 |
|
|
583 |
setup_hdd_partitions_manuell() |
setup_hdd_partitions_manuell() |
694 |
echo "# normal boot" >> ${grubconf} || die |
echo "# normal boot" >> ${grubconf} || die |
695 |
echo "title ${KRNVER}" >> ${grubconf} || die |
echo "title ${KRNVER}" >> ${grubconf} || die |
696 |
echo "root (hd0,0)" >> ${grubconf} || die |
echo "root (hd0,0)" >> ${grubconf} || die |
697 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS}" >> ${grubconf} || die |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die |
698 |
if is_initrd_supported |
if is_initrd_supported |
699 |
then |
then |
700 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
705 |
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die |
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die |
706 |
echo "lock" >> ${grubconf} || die |
echo "lock" >> ${grubconf} || die |
707 |
echo "root (hd0,0)" >> ${grubconf} || die |
echo "root (hd0,0)" >> ${grubconf} || die |
708 |
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 |
709 |
if is_initrd_supported |
if is_initrd_supported |
710 |
then |
then |
711 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
715 |
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die |
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die |
716 |
echo "lock" >> ${grubconf} || die |
echo "lock" >> ${grubconf} || die |
717 |
echo "root (hd0,0)" >> ${grubconf} || die |
echo "root (hd0,0)" >> ${grubconf} || die |
718 |
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 |
719 |
if is_initrd_supported |
if is_initrd_supported |
720 |
then |
then |
721 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
760 |
PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" |
PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" |
761 |
SATAMODS="sata_via sata_sis sata_nv" |
SATAMODS="sata_via sata_sis sata_nv" |
762 |
DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" |
DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" |
763 |
FBMODS="uvesafb" |
OTHERMODS="" |
764 |
|
case ${SPECIALDEVICE} in |
765 |
|
zotac_intel) FBMODS=""; DRMMODS="i915" ;; |
766 |
|
zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;; |
767 |
|
rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards |
768 |
|
# not working with kms enabled drivers -> segfaults |
769 |
|
#maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer |
770 |
|
maxdata) FBMODS="" ;; |
771 |
|
*) FBMODS="uvesafb" ;; |
772 |
|
esac |
773 |
|
|
774 |
|
if [[ ${FORMFACTOR} = laptop ]] |
775 |
|
then |
776 |
|
OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave" |
777 |
|
fi |
778 |
|
|
779 |
# install an appropriate uvesafb.conf |
# install an appropriate uvesafb.conf |
780 |
install -d ${INSTALLPATH}/etc/modprobe.d || die |
install -d ${INSTALLPATH}/etc/modprobe.d || die |
781 |
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die |
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die |
782 |
|
|
783 |
|
# install an appropriate viafb.conf |
784 |
|
echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || die |
785 |
|
|
786 |
|
# install an appropriate i810fb.conf |
787 |
|
echo "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" > ${INSTALLPATH}/etc/modprobe.d/i810fb.conf || die |
788 |
|
|
789 |
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
790 |
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd |
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd |
791 |
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 |
792 |
exit 0 |
exit 0 |
793 |
CHROOTEOF |
CHROOTEOF |
854 |
|
|
855 |
# install network config skeleton |
# install network config skeleton |
856 |
install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die |
install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die |
857 |
|
|
858 |
|
# intel framebufer quirk |
859 |
|
if [[ -e /proc/fb ]] |
860 |
|
then |
861 |
|
if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
862 |
|
then |
863 |
|
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
864 |
|
if [[ ${fbdev} != 0 ]] |
865 |
|
then |
866 |
|
sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die |
867 |
|
fi |
868 |
|
fi |
869 |
|
fi |
870 |
} |
} |
871 |
|
|
872 |
install_system_settings_flash() |
install_system_settings_flash() |