# Maintainer: wain pkgname=kernel26fr-emission-WAIN pkgver=2.6.18 pkgrel=2 pkgdesc="The Linux Kernel with patch-2.6.18-emission${emissionver}.patch" arch=(i686 x86_64) url="http://www.evolution-mission.org/viewforum.php?f=8" #lastknownpatch for building kernel offline emissionver=1 lastknownpatch="linux-2.6.18-emission${emissionver}" depends=('module-init-tools') provides=('kernel26') source=(http://archiwain.free.fr/kernelemission/logo_linux_clut224.ppm \ http://archiwain.free.fr/kernelemission/logo_linux_vga16.ppm \ http://archiwain.free.fr/kernelemission/logo_linux_mono.ppm \ http://archiwain.free.fr/kernelemission/config \ ) install=kernel26fr.install md5sums=('5a62bcc7e96601052c7405459b483826' 'a995ec849ea43d3c89d607bbdd1e7d09'\ 'ed6b42fea2f5d27f7eb920746ccc1ebb' '7ebd95f730ecd7e78cfa9ef243ddcc67') ### prompt() { if [ "$USE_COLOR" = "Y" -o "$USE_COLOR" = "y" ]; then echo -e "\n\033[1;33m==> \033[1;0m \033[1;1m$1\033[1;0m" >&2 echo -e "\033[1;33m==> \033[1;0m \033[1;1m"----------------------------------------------"\033[1;0m" >&2 echo -ne "\033[1;33m==> \033[1;0m" >&2 else echo -ne "\n==> $1" >&2 echo "==> ----------------------------------------------" echo -n "==> " fi } build() { # Patch version to use ? #-------------------------------- patch_emission=$lastknownpatch urlpatchemission="http://distfiles.evolution-mission.org/sources/${pkgver}/emission${emissionver}/${patch_emission}.bz2" echo $urlpatchemission echo msg "Patchs utilisés:" plain $lastknownpatch echo sleep 1 # Extract the kernel ? #------------------------------ cd $startdir/src/ # Are the kernelsources and patch sources here ? if [ -d linux-$pkgver ] then extractkernel="n" else extractkernel="o" fi # Extract the sources if not necessary ? if [ "$extractkernel" = "n" ] then prompt "Le kernel a déjà été extrait, voulez-vous le ré-extraire ?: o/n [n]" read -n 1 choiceextractkernel if [ "$choiceextractkernel" = "o" ] then extractkernel="o" rm -Rf linux-$pkgver # on supprime le répertoire linux fi fi #Extract the sources #------------------------------ if [ "$extractkernel" = "o" ] then # Get files #------------------------------ cd $startdir rm -Rf $startdir/src/linux-$pkgver # on supprime le répertoire linux msg "Téléchargement, et extraction des sources" sleep 2 wget -c "ftp://ftp.fr.kernel.org/pub/linux/kernel/v2.6/linux-${pkgver}.tar.bz2" || return 1 wget -c "${urlpatchemission}" || return 1 # Extract the sources #------------------------------ plain "extracting ..." bzcat linux-$pkgver.tar.bz2 | tar xvf - mv linux-$pkgver $startdir/src/ # Patch the kernel #------------------------------ cd $startdir/src/linux-$pkgver # big patchset bzcat $startdir/$patch_emission.bz2 | patch -p1 || return 1 # Remove the extraversion from Makefile sed -i "s|^EXTRAVERSION.*$|EXTRAVERSION = -emission|g" ./Makefile fi # Select the config file #------------------------------ cd $startdir echo warning "Si vous voulez utiliser votre config perso renommez le fichier en 'conf*'" plain "----------------------------------------------------------------------" plain " Tapez le numéro du fichier de configuration à utiliser" plain "----------------------------------------------------------------------" n=0 config=`ls -t *conf* | head -n 1` for i in `ls -t *conf*` do plain "$n: $i" n=$(( $n + 1 )) done prompt "(Tapez 0 pour utiliser le fichier le plus récent: ($config)" read result config=`ls -t *conf* | head -n $(( $result + 1 )) | tail -n 1` cp $config $startdir/src/config msg "utilisation du fichier ${config} ! " # LOCAL_VERSION ?? #------------------------------------------------------------- old_local_version=$(grep -v "^#" $startdir/src/config | grep "CONFIG_LOCALVERSION=" | sed s/"CONFIG_LOCALVERSION="/""/ | tr -d \") [ -z "$old_local_version" ] && old_local_version="-PERSO" prompt "Entrez un nom précédé d'un tiret pour personnaliser votre kernel.\nIl aura la forme \"${pkgver}-emission${old_local_version}\": [${old_local_version}]" read new_local_version [ -z "$new_local_version" ] && new_local_version=$old_local_version sed -i "s|CONFIG_LOCALVERSION=.*$|CONFIG_LOCALVERSION=\"$new_local_version\"|" $startdir/src/config msg "Le kernel s'appelera: ${pkgver}-emission${new_local_version}" # initramfs ? #------------------------------------------------------------- prompt "Voulez-vous générer une image initramfs ? o/n [n]" read -n 1 initramfs # arch logo ?? #------------------------------------------------------------- cd $startdir/src/linux-$pkgver #-correct config file for framebuffer and maybe splash support [ ! "`grep "CONFIG_FB_VESA_TNG" ../config`" ] && echo "#CONFIG_FB_VESA_TNG is not set" >> ../config [ ! "`grep "CONFIG_FB_VESA_STD" ../config`" ] && echo "#CONFIG_FB_VESA_STD is not set" >> ../config [ ! "`grep "CONFIG_FB_SPLASH" ../config`" ] && echo "#CONFIG_FB_SPLASH is not set" >> ../config [ ! "`grep "CONFIG_FB_VESA_DEFAULT_MODE" ../config`" ] && echo "#CONFIG_FB_VESA_DEFAULT_MODE is not set" >> ../config [ ! "`grep "CONFIG_LOGO" ../config`" ] && echo "#CONFIG_LOGO is not set" >> ../config [ ! "`grep "CONFIG_LOGO_LINUX_CLUT224" ../config`" ] && echo "#CONFIG_LOGO_LINUX_CLUT224 is not set" >> ../config rm -f drivers/video/logo/logo_linux_mono.ppm rm -f drivers/video/logo/logo_linux_vga16.ppm rm -f drivers/video/logo/logo_linux_clut224.ppm prompt "Voulez-vous afficher le logo Archlinux au démarrage ?\n(ne pas utiliser le logo si vous utilisez gensplash) : o/n [n]" read -n 1 logo if [ "$logo" = "o" ] then cp ../logo_linux_mono.ppm drivers/video/logo/ cp ../logo_linux_vga16.ppm drivers/video/logo/ cp ../logo_linux_clut224.ppm drivers/video/logo/ sed -i "s|^.*CONFIG_LOGO is not set|CONFIG_LOGO=y|" ../config sed -i "s|^.*CONFIG_LOGO_LINUX_CLUT224 is not set|CONFIG_LOGO_LINUX_CLUT224=y|" ../config sed -i "s|^.*CONFIG_FB_SPLASH.*$|#CONFIG_FB_SPLASH desactivated by user|" ../config else sed -i "s|^.*CONFIG_LOGO.*$|#CONFIG_LOGO desactivated by user|" ../config fi # use gensplash ?? #------------------------------------------------------------- if [ "$logo" != "o" ] then echo warning "Si vous n'avez pas besoin de modifier votre initrd, répondez non." prompt "Voulez-vous modifier/ajouter gensplash pour ce kernel ?\n(Nécessite les paquetages initscripts-gensplash et mkinitramfs) : o/n [n]" read -n 1 choicesplash fi if [ "$choicesplash" = "o" ] then #-theme prompt "Entrez le nom du thème gensplash présent \ndans /etc/splash/ sur la machine de destination: [darch]" read splashtheme [ -z "$splashtheme" ] && splashtheme="darch" sed -i "s|^.*CONFIG_BLK_DEV_RAM .*$|CONFIG_BLK_DEV_RAM=y|" ../config sed -i "s|^.*CONFIG_BLK_INITRD.*$|CONFIG_BLK_DEV_INITRD=y|" ../config sed -i "s|^.*CONFIG_FB_VIRTUAL.*$|#CONFIG_FB_VIRTUAL desactivated by user|" ../config sed -i "s|^.*CONFIG_FB_SPLASH.*$|CONFIG_FB_SPLASH=y|" ../config #-resolution defautvalue=$(grep "CONFIG_FB_VESA_DEFAULT_MODE=" ../config | cut -d "\"" -f 2) [ -z "$defautvalue" ] && defautvalue="800x600@70" defautvalue=${defautvalue%@*} prompt "Entrez la résolution du thème à utiliser: [${defautvalue}]" read splashresolution [ -z "$splashresolution" ] && splashresolution=$defautvalue fi # Correct config file for framebuffer #------------------------------------------------------------- if [ "$logo" = "o" ] || [ "$choicesplash" = "o" ] then sed -i "s|^.*CONFIG_FB .*$|CONFIG_FB=y|" ../config sed -i "s|^.*CONFIG_FB_CFB_FILLRECT.*$|CONFIG_FB_CFB_FILLRECT=y|" ../config sed -i "s|^.*CONFIG_FB_CFB_COPYAREA.*$|CONFIG_FB_CFB_COPYAREA=y|" ../config sed -i "s|^.*CONFIG_FB_CFB_IMAGEBLIT.*$|CONFIG_FB_CFB_IMAGEBLIT=y|" ../config sed -i "s|^.*CONFIG_FB_VESA .*$|CONFIG_FB_VESA=y|" ../config sed -i "s|^.*CONFIG_VIDEO_SELECT.*$|CONFIG_VIDEO_SELECT=y|" ../config sed -i "s|^.*CONFIG_VGA_CONSOLE.*$|CONFIG_VGA_CONSOLE=y|" ../config sed -i "s|^.*CONFIG_DUMMY_CONSOLE.*$|CONFIG_DUMMY_CONSOLE=y|" ../config sed -i "s|^.*CONFIG_FRAMEBUFFER_CONSOLE .*$|CONFIG_FRAMEBUFFER_CONSOLE=y|" ../config sed -i "s|^.*CONFIG_FONTS.*$|CONFIG_FONTS=y|" ../config sed -i "s|^.*CONFIG_FONT_8x16.*$|CONFIG_FONT_8x16=y|" ../config #vesa driver echo prompt "Par défaut, le kernel utilisera le driver VESA STANDARD (plus stable)\nVESA TNG permet en revanche de changer la fréquence et la profondeur\nd'affichage de la console et permet une résolution plus élevée.\nPréférez-vous utiliser VESA TNG ? o/n[n]" read -n 1 videomodechoice if [ "$videomodechoice" = "o" ] then videomode="TNG" #-profondeur prompt "Choisissez le mode vga (bits@Hz): [32@70]" read vgamode [ -z "$vgamode" ] && vgamode="32@70" sed -i "s|^.*CONFIG_FB_VESA_STD.*$|#CONFIG_FB_VESA_STD desactivated|" ../config sed -i "s|^.*CONFIG_FB_VESA_TNG.*$|CONFIG_FB_VESA_TNG=y|" ../config sed -i "s|^.*CONFIG_FB_VESA_DEFAULT_MODE.*$|CONFIG_FB_VESA_DEFAULT_MODE=\"${splashresolution}@${vgamode#*@}\"|" ../config else videomode="STD" echo sed -i "s|^.*CONFIG_FB_VESA_TNG.*$|#CONFIG_FB_VESA_TNG desactivated|" ../config sed -i "s|^.*CONFIG_FB_VESA_STD.*$|CONFIG_FB_VESA_STD=y|" ../config plain " +---------------------------------------------------+" plain " | 640x480 800x600 1024x768 1280x1024 1600x1200" plain " -----+----------------------------------------------" plain " 256 | 769 771 773 775 796" plain " 32K | 784 787 790 793 797" plain " 64K | 785 788 791 794 798" plain " 16M | 786 789 792 795 799" plain " +---------------------------------------------------+" prompt "Facultatif: Choisissez un des modes vga ci-dessus: [788]" read vgamode [ -z "$vgamode" ] && vgamode="788" fi else videomode="off" fi #-------------------------------------------------------------- # get rid of the 'i' in i686 cat ../config | sed "s|#CARCH#|$carch|g" >./.config #-------------------------------------------------------------- # Editor choice ?? #------------------------------------------------------------- # for gvim, add --nofork cd $startdir/src/linux-$pkgver echo plain "--------------------------------------------------------------------" plain " Choix de l'éditeur de configuration" plain "--------------------------------------------------------------------" plain "0: ne pas modifier (compiler directement ${config})" plain "1: xconfig 2: gconfig 3: menuconfig 4: gvim 5: $EDITOR" prompt "Avec quel éditeur voulez-vous modifier la configuration du kernel ?" read -n 1 result echo case $result in 1) make xconfig ;; 2) make gconfig ;; 3) make menuconfig ;; 4) (gvim --nofork ./.config) ;; 5) ($EDITOR .config) ;; *) yes "" | make config ;; esac wait #--------------------------------------------------------- ##### NO USER CHANGES BELOW HERE ##### # save the current pkgname old_pkgname=$pkgname # set pkgname for build purposes - DO NOT alter! pkgname=kernel26 # save the updated config to build with today's date cp ./.config $startdir/config-${patch_emission}${new_localversion}-$(date +%y-%m-%d\-%Hh) # Read the full kernel version info from new config to use in pathnames and pkgname . ./.config # Kernel release - will be the same as Makefile _kernrel="${pkgver}-emission${CONFIG_LOCALVERSION}" # Set a new pkgname from kernel release and pkgver suffix pkgname="${pkgname}fr-emission${CONFIG_LOCALVERSION}" # build! echo if ! [ "$extractkernel" = "o" ] then prompt "Voulez-vous réutiliser les modules compilés précédemment (plus rapide) ? o/n [o]: " read -n 1 choice fi echo plain "Appuyez sur une touche pour commencer ou CTRL+C pour abandonner" plain " ---------------------------------------------" read anykey if [ "$choice" = "n" ] ; then make -j3 clean bzImage modules || return 1 else make -j3 bzImage modules || return 1 fi if [ "$CARCH" = "x86_64" ]; then build_arch="x86_64" else build_arch="i386" fi mkdir -p $startdir/pkg/{lib/modules,boot} make INSTALL_MOD_PATH=$startdir/pkg modules_install || return 1 cp System.map $startdir/pkg/boot/System.map26emission${CONFIG_LOCALVERSION} cp arch/${build_arch}/boot/bzImage $startdir/pkg/boot/vmlinuz26emission${CONFIG_LOCALVERSION} install -D -m644 Makefile $startdir/pkg/usr/src/linux-${_kernrel}/Makefile install -D -m644 Makefile $startdir/pkg/usr/src/linux-${_kernrel}/kernel/Makefile install -D -m644 .config $startdir/pkg/usr/src/linux-${_kernrel}/.config install -D -m644 .kernelrelease $startdir/pkg/usr/src/linux-${_kernrel}/.kernelrelease install -D -m644 .config $startdir/pkg/boot/kconfig-${_kernrel} mkdir -p $startdir/pkg/usr/src/linux-${_kernrel}/include mkdir -p $startdir/pkg/usr/src/linux-${_kernrel}/arch/${build_arch}/kernel for i in acpi asm-generic asm-${build_arch} config linux math-emu media net pcmcia scsi sound video; do cp -a include/$i $startdir/pkg/usr/src/linux-${_kernrel}/include/ done # copy files necessary for later builds, like nvidia and vmware cp -a scripts $startdir/pkg/usr/src/linux-${_kernrel} cp Module.symvers $startdir/pkg/usr/src/linux-${_kernrel} mkdir -p $startdir/pkg/usr/src/linux-${_kernrel}/.tmp_versions cp arch/${build_arch}/Makefile $startdir/pkg/usr/src/linux-${_kernrel}/arch/${build_arch}/ cp arch/${build_arch}/Makefile.cpu $startdir/pkg/usr/src/linux-${_kernrel}/arch/${build_arch}/ cp arch/${build_arch}/kernel/asm-offsets.s $startdir/pkg/usr/src/linux-${_kernrel}/arch/${build_arch}/kernel/ # add headers for lirc package mkdir -p $startdir/pkg/usr/src/linux-${_kernrel}/drivers/media/video cp drivers/media/video/*.h $startdir/pkg/usr/src/linux-${_kernrel}/drivers/media/video/ for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 usbvideo zc0301; do mkdir -p $startdir/pkg/usr/src/linux-${_kernrel}/drivers/media/video/$i cp -a drivers/media/video/$i/*.h $startdir/pkg/usr/src/linux-${_kernrel}/drivers/media/video/$i done cd $startdir/pkg/usr/src/linux-${_kernrel}/drivers/media/video ln -s bt8xx/bttv.h bttv.h ln -s bt8xx/bttvp.h bttvp.h ln -s bt8xx/bt848.h bt848.h cd - # add inotify.h mkdir -p $startdir/pkg/usr/src/linux-${_kernrel}/include/linux cp include/linux/inotify.h $startdir/pkg/usr/src/linux-${_kernrel}/include/linux/ # add CLUSTERIP file for iptables mkdir -p $startdir/pkg/usr/src/linux-${_kernrel}/net/ipv4/netfilter/ cp net/ipv4/netfilter/ipt_CLUSTERIP.c $startdir/pkg/usr/src/linux-${_kernrel}/net/ipv4/netfilter/ # add dm headers mkdir -p $startdir/pkg/usr/src/linux-${_kernrel}/drivers/md cp drivers/md/*.h $startdir/pkg/usr/src/linux-${_kernrel}/drivers/md # copy in Kconfig files for i in `find . -name "Kconfig*"`; do mkdir -p $startdir/pkg/usr/src/linux-${_kernrel}/`echo $i | sed 's|/Kconfig.*||'` cp $i $startdir/pkg/usr/src/linux-${_kernrel}/$i done cd $startdir/pkg/usr/src/linux-${_kernrel}/include && ln -s asm-${build_arch} asm chown -R root.root $startdir/pkg/usr/src/linux-${_kernrel} cd $startdir/pkg/lib/modules/${_kernrel} rm -f source build ln -sf /usr/src/linux-${_kernrel} build # Fix nvidia build issue. cp $startdir/src/linux-$pkgver/arch/${build_arch}/Makefile.cpu $startdir/pkg/usr/src/linux-${_kernrel}/arch/${build_arch}/ # Correct the kernel26fr.install cd $startdir sed -i "s|initramfs=.*$|initramfs=\"$initramfs\"|" ./kernel26fr.install sed -i "s|kern_version=.*$|kern_version=\"${_kernrel}\"|" ./kernel26fr.install sed -i "s|vmlinuz_version=.*$|vmlinuz_version=\"vmlinuz26emission${CONFIG_LOCALVERSION}\"|" ./kernel26fr.install sed -i "s|gensplash=.*$|gensplash=\"${choicesplash}\"|" ./kernel26fr.install sed -i "s|splashtheme=.*$|splashtheme=\"${splashtheme}\"|" ./kernel26fr.install sed -i "s|splashresolution=.*$|splashresolution=\"${splashresolution}\"|" ./kernel26fr.install sed -i "s|videomode=.*$|videomode=\"${videomode}\"|" ./kernel26fr.install sed -i "s|vgamode=.*$|vgamode=\"${vgamode}\"|" ./kernel26fr.install # Correct the pkgname in our PKGBUILD - this allows correct gensync operation # NOTE: pkgname variable must be declared with first 10 lines of PKGBUILD! sed -i "1,11 s|pkgname=$old_pkgname|pkgname=$pkgname|" ./PKGBUILD #sed -i "1,11 s|pkgdesc=.*$|pkgdesc=\"The Linux Kernel with $patch_emission\"|" ./PKGBUILD #sed -i "1,11 s|lastknownpatch=.*$|lastknownpatch=\"$patch_emission\"|" ./PKGBUILD }