build grub 2.12 #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build grub 2.12 | |
on: | |
#release: | |
# types: [published] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Bring last uploaded mydata.tgz files from tinycore-redpill & lastest img | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential bison flex libgmp3-dev xorriso qemu-utils | |
#sudo apt-get install grub2 qemu-utils grub-efi-amd64-bin | |
curl -kLO# https://github.com/PeterSuh-Q3/tinycore-redpill/releases/download/v1.0.2.4/tinycore-redpill.v1.0.2.4.m-shell.img.gz | |
gunzip tinycore-redpill.v1.0.2.4.m-shell.img.gz | |
pwd | |
ls -ltr | |
- name: Download GRUB 2.12 source | |
run: | | |
wget https://ftp.gnu.org/gnu/grub/grub-2.12.tar.gz | |
tar xzf grub-2.12.tar.gz | |
cd grub-2.12 | |
- name: Configure GRUB | |
working-directory: grub-2.12 | |
run: | | |
./configure --prefix=/usr --sysconfdir=/etc --disable-werror | |
- name: Create extra_deps.lst | |
working-directory: grub-2.12 | |
run: | | |
echo "depends bli part_gpt" > grub-core/extra_deps.lst | |
- name: Build GRUB | |
working-directory: grub-2.12 | |
run: make | |
#- name: Run tests | |
# working-directory: grub-2.12 | |
# run: make check | |
- name: Install GRUB | |
working-directory: grub-2.12 | |
run: sudo make install | |
- name: Return to workflow home directory | |
run: cd $GITHUB_WORKSPACE | |
- name: Mount source img and make target img | |
id: get-version | |
run: | | |
VERSION=v`cat functions.sh | grep rploaderver= | cut -d\" -f2` | |
echo "Version: ${VERSION}" | |
echo "::set-output name=VERSION::${VERSION}" | |
mkdir /opt/output | |
path=`pwd` | |
LOOPX=$(sudo losetup -f) | |
sudo losetup -P ${LOOPX} tinycore-redpill.v1.0.2.4.m-shell.img | |
dd if=/dev/zero of=tinycore-redpill.${VERSION}.m-shell.img bs=1M seek=2048 count=0 | |
echo -e "n\np\n1\n\n+72M\nn\np\n2\n\n+75M\nn\np\n3\n\n+1899M\nw\nq\n" | sudo fdisk tinycore-redpill.${VERSION}.m-shell.img | |
echo -e "a\n1\nw" | sudo fdisk tinycore-redpill.${VERSION}.m-shell.img | |
LOOPZ=$(sudo losetup -f) | |
sudo losetup -P ${LOOPZ} tinycore-redpill.${VERSION}.m-shell.img | |
echo "LOOPZ = ${LOOPZ}" | |
sudo fdisk -l ${LOOPZ} | |
## Format 3rd partition with vfat ## | |
#sudo mkfs.vfat -F16 ${LOOPZ}p1 | |
#sudo mkfs.vfat -F16 ${LOOPZ}p2 | |
sudo mkfs.vfat -i 6234C863 -F16 ${LOOPZ}p3 | |
## Copy 1st,2nd,3rd partition from source to target (with grub 2.12 install) ## | |
sudo dd if="${LOOPX}p1" of="${LOOPZ}p1" | |
sudo mkdir -p /mnt/tarp1 | |
sudo mount ${LOOPZ}p1 /mnt/tarp1 | |
echo "Create and install GRUB for Legacy BIOS" | |
export GRUB_VERSION=2.12 | |
sudo grub-install --version | |
sudo grub-install --target=x86_64-efi --boot-directory="/mnt/tarp1/boot" --efi-directory="/mnt/tarp1" --removable | |
sudo grub-install --target=i386-pc --boot-directory="/mnt/tarp1/boot" "${LOOPZ}" | |
echo "Generate and install GRUB images" | |
cd grub-2.12 | |
GRUB_MODULES="normal linux echo all_video search test multiboot" | |
echo "Create UEFI GRUB image" | |
sudo ./grub-mkimage -O x86_64-efi -o grubx64.efi -p /boot/grub ${GRUB_MODULES} | |
echo "Install GRUB for UEFI" | |
sudo mkdir -p /mnt/tarp1/EFI/BOOT | |
sudo cp -vf ./grubx64.efi /mnt/tarp1/EFI/BOOT/BOOTX64.EFI | |
echo "Create and install GRUB for Legacy BIOS" | |
sudo ./grub-mkimage -O i386-pc -o core.img -p /boot/grub ${GRUB_MODULES} | |
#echo "Write the first sector of core.img to the MBR" | |
#sudo dd if=./core.img of="${LOOPZ}" bs=512 count=1 | |
#echo "Write the rest of core.img after the MBR" | |
#sudo dd if=./core.img of="${LOOPZ}" bs=512 seek=1 skip=1 | |
echo "Copy GRUB modules" | |
sudo mkdir -p /mnt/tarp1/boot | |
sudo mkdir -p /mnt/tarp1/boot/grub/{x86_64-efi,i386-pc} | |
sudo cp grub-core/*.mod /mnt/tarp1/boot/grub/x86_64-efi/ | |
sudo cp grub-core/*.mod /mnt/tarp1/boot/grub/i386-pc/ | |
ls -ltr /mnt/tarp1/boot/grub/i386-pc/ | |
# Copy grub.cfg | |
#sudo mkdir -p /mnt/p1 | |
#sudo mount ${LOOPX}p1 /mnt/p1 | |
#sudo cp /mnt/p1/boot/grub/grub.cfg /mnt/tarp1/boot/grub/grub.cfg | |
## Copy 2nd partition from source to target ## | |
sudo dd if="${LOOPX}p2" of="${LOOPZ}p2" | |
## Copy 3rd partition from source to target ## | |
sudo mkdir -p /mnt/p3 | |
sudo mount ${LOOPX}p3 /mnt/p3 | |
sudo mkdir -p /mnt/tarp3 | |
sudo mount ${LOOPZ}p3 /mnt/tarp3 | |
cd /mnt/p3 && sudo find . | sudo cpio -pdm "/mnt/tarp3" | |
cd $GITHUB_WORKSPACE | |
sudo cp -vf ${path}/mydata.tgz /mnt/tarp3 | |
ls -ltr /mnt/tarp3 | |
# from version 1.0.3.0 add gettext.tcz | |
sudo cp -vf ${path}/tce/optional/gettext.* /mnt/tarp3/cde/optional | |
sudo cp -vf ${path}/tce/optional/ncursesw.* /mnt/tarp3/cde/optional | |
ls -ltr /mnt/tarp3/cde/optional | |
sudo cp -vf ${path}/tce/onboot.lst /mnt/tarp3/cde/onboot.lst | |
## Finalize ## | |
#sudo umount /mnt/p1 | |
sudo umount /mnt/p3 | |
sudo umount /mnt/tarp1 | |
sudo umount /mnt/tarp3 | |
sudo losetup -d ${LOOPZ} | |
sudo losetup -d ${LOOPX} | |
gzip -c tinycore-redpill.${VERSION}.m-shell.img > /opt/output/tinycore-redpill.${VERSION}.m-shell.img.gz | |
qemu-img convert -f raw -O vmdk tinycore-redpill.${VERSION}.m-shell.img tinycore-redpill.${VERSION}.m-shell.vmdk | |
gzip -c tinycore-redpill.${VERSION}.m-shell.vmdk > /opt/output/tinycore-redpill.${VERSION}.m-shell.vmdk.gz | |
ls -ltr /opt/output | |
- name: Upload MshellImage-${{ steps.get-version.outputs.VERSION }} | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: MshellImage-${{ steps.get-version.outputs.VERSION }} | |
path: /opt/output | |
# Publish a release if is a tag | |
#- name: Release | |
# uses: softprops/action-gh-release@v1 | |
# with: | |
# tag_name: ${{ inputs.version }} | |
# files: | | |
# /opt/output/*.gz | |
# body: | | |
# ${{ inputs.version }} |