diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..30489f2041b97d869045117f929534443586ef9c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,65 @@ +stages: + - build + - deploy + +emulab-grub2-tftpboot-x86: + stage: build + image: gitlab.flux.utah.edu:4567/emulab/emulab-grub2/u16-grub2-builder:latest + script: + - mkdir -p $CI_PROJECT_DIR/$CI_JOB_NAME-$CI_COMMIT_REF_NAME/tftpboot + - ./autogen.sh + - ./configure && make && make install + - grub-mknetdir --net-directory=/tftpboot --subdir=grub2.0 + - grub-mknetdir --net-directory=/tftpboot --subdir=grub2pxe-bios-vga + - grub-mknetdir --net-directory=/tftpboot --subdir=grub2pxe-bios-sio1 + - grub-mknetdir --net-directory=/tftpboot --subdir=grub2pxe-bios-sio2 + - grub-mknetdir --net-directory=/tftpboot --subdir=grub2pxe-native-vga + - grub-mknetdir --net-directory=/tftpboot --subdir=grub2pxe-native-sio1 + - grub-mknetdir --net-directory=/tftpboot --subdir=grub2pxe-native-sio2 + - make clean + - ./configure --with-platform=efi --target=x86_64 && make && make install + - grub-mknetdir --net-directory=/tftpboot -d /usr/local/lib/grub/x86_64-efi --subdir=grub2.0 + - grub-mknetdir --net-directory=/tftpboot --subdir=grub2pxe-efi-vga + - grub-mknetdir --net-directory=/tftpboot --subdir=grub2pxe-efi-sio1 + - grub-mknetdir --net-directory=/tftpboot --subdir=grub2pxe-efi-sio2 + - for tdir in /tftpboot/grub2pxe-{bios,native}-* ; do cp -p $tdir/i386-pc/core.0 $tdir/grub2pxe ; rm -rf $tdir/{i386-pc,fonts,locale} ; cd $tdir && ln -s ../grub2.0/locale . && ln -s ../grub2.0/i386-pc . && ln -s ../grub2.0/fonts . ; done + - for tdir in /tftpboot/grub2pxe-efi-* ; do cp -p $tdir/x86_64-efi/core.efi $tdir/grub2pxe ; rm -rf $tdir/{i386-pc,x86_64-efi,fonts,locale} ; cd $tdir && ln -s ../grub2.0/locale . && ln -s ../grub2.0/x86_64-efi . && ln -s ../grub2.0/fonts . ; done + - for tdir in /tftpboot/grub2pxe* ; do cp -p $CI_PROJECT_DIR/emulab/grub.cfg $tdir ; chmod 664 $tdir/grub.cfg ; btype=`basename $tdir | cut -d- -f2` ; ctype=`basename $tdir | cut -d- -f3` ; ntype=pxe ; if [ $ctype = "efi" ]; then ntype=efi ; fi ; echo $btype $ctype $ntype ; sed -i -e "s/^set console=.*$/set console=$ctype/" $tdir/grub.cfg ; sed -i -e "s/^set diskdrivers=.*$/set diskdrivers=$btype/" $tdir/grub.cfg ; sed -i -e "s/^set netdrivers=.*$/set netdrivers=$ntype/" $tdir/grub.cfg ; done + - rsync -a /tftpboot/ $CI_PROJECT_DIR/$CI_JOB_NAME-$CI_COMMIT_REF_NAME/tftpboot/ + artifacts: + paths: + - $CI_JOB_NAME-$CI_COMMIT_REF_NAME + only: + - master + +.deploy_template: + stage: deploy + image: gitlab.flux.utah.edu:4567/emulab/emulab-grub2/u16-grub2-builder:latest + variables: + GIT_STRATEGY: none + dependencies: + - emulab-grub2-tftpboot-x86 + before_script: + - eval $(ssh-agent -s) + - echo "$GRUB_UPLOAD_PRIVKEY" | tr -d '\r' | ssh-add - >/dev/null + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + only: + - master + +deploy_testing: + extends: .deploy_template + script: + - echo 'put ./emulab-grub2-tftpboot-x86-master' | sftp -o StrictHostKeyChecking=no -r $GRUB_UPLOAD_USER@$GRUB_UPLOAD_HOST:$GRUB_TESTING_DIR + - 'for file in `find emulab-grub2-tftpboot-x86-master -type l`; do dir=`dirname $file`; fname=`basename $file`; rlink=`readlink $file`; echo cd $GRUB_TESTING_DIR/$dir; echo symlink $rlink $fname ; done | sftp -o StrictHostKeyChecking=no -r $GRUB_UPLOAD_USER@$GRUB_UPLOAD_HOST:$GRUB_TESTING_DIR' + environment: + name: testing + +deploy_production: + extends: .deploy_template + script: + - echo 'put ./emulab-grub2-tftpboot-x86-master' | sftp -o StrictHostKeyChecking=no -r $GRUB_UPLOAD_USER@$GRUB_UPLOAD_HOST:$GRUB_PROD_DIR + - 'for file in `find emulab-grub2-tftpboot-x86-master -type l`; do dir=`dirname $file`; fname=`basename $file`; rlink=`readlink $file`; echo cd $GRUB_TESTING_DIR/$dir; echo symlink $rlink $fname ; done | sftp -o StrictHostKeyChecking=no -r $GRUB_UPLOAD_USER@$GRUB_UPLOAD_HOST:$GRUB_PROD_DIR' + environment: + name: production + when: manual diff --git a/emulab/grub.cfg b/emulab/grub.cfg index 420cedc36c71ee2006c1a20694e17c2623633c90..a99abdfb6b3fc82654566290f1bd776df813c471 100644 --- a/emulab/grub.cfg +++ b/emulab/grub.cfg @@ -15,18 +15,28 @@ set diskdrivers=efi set netdrivers=efi if [ $console = vga ]; then + set linuxconsoleargs="console=tty0" true elif [ $console = sio1 ]; then serial --unit=0 --speed=115200 terminal_input serial terminal_output serial + set linuxconsoleargs="console=tty0 console=ttyS0,115200" elif [ $console = sio2 ]; then serial --unit=1 --speed=115200 terminal_input serial terminal_output serial + set linuxconsoleargs="console=tty0 console=ttyS1,115200" else + set linuxconsoleargs="console=tty0" echo "Unknown console $console, using VGA" fi +# +# Export this so that other grub.cfg files we load over the network +# (e.g. as part of the Emulab bootinfo process, to netboot other +# initramfses) have the right console settings. +# +export linuxconsoleargs insmod ext2 insmod ufs1 diff --git a/grub-core/commands/bootinfo.c b/grub-core/commands/bootinfo.c index 43b23a2f0141bdcc7e6759075cb22d3853c6f677..51da6ec47ced127dc0fefc45239a523460aa83aa 100644 --- a/grub-core/commands/bootinfo.c +++ b/grub-core/commands/bootinfo.c @@ -24,7 +24,9 @@ #include #include #include +#if (!defined(__powerpc__) && !defined(__ppc__)) #include +#endif #include #include #include