Skip to content

Commit 5c3043c

Browse files
committed
Update PBA/rescue build scripts
1 parent 768478e commit 5c3043c

File tree

8 files changed

+127
-148
lines changed

8 files changed

+127
-148
lines changed

images/BUILDING

+7-30
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,13 @@
11
Building the PBA images for sedutil
2-
These instructions are based on a Xubuntu 14.x system, YMMV.
2+
These instructions are based on a Xubuntu 16.x system, YMMV.
33

44
Prereqs:
55
You need a multiarch system so that you can build both 32 & 64 bit systems.
66
build essential
7-
ncurses
87

98
Get/Build the pieces:
109

11-
Building the PBA program.
12-
cd ../LinuxPBA
13-
rm -rf dist
14-
make CONF=Release
15-
make CONF=Release_x86_64
16-
make CONF=Debug
17-
make CONF=Debug_x86_64
18-
cd ../images
19-
20-
Building sedutil-cli
21-
cd ../linux/CLI
22-
rm -rf dist
23-
make CONF=Release_i686
24-
make CONF=Release_x86_64
25-
make CONF=Debug_i686
26-
make CONF=Debug_x86_64
27-
cd ../../images
28-
29-
Getting TinyCore and syslinux.
10+
Getting the syslinux bootloader.
3011

3112
./getresources
3213

@@ -35,24 +16,20 @@ Build the PBA kernels and root filesystems
3516

3617
Build the image files.
3718
Rescue -> ./buildrescue
38-
biosLinux -> ./buildbiosLinux Release
39-
uefi64 -> ./buildUEFI64 Release
40-
41-
Build the Debug images
42-
biosLinux -> ./buildbiosLinux Debug
43-
uefi64 -> ./buildUEFI64 Debug
19+
biosLinux -> ./buildbios
20+
uefi64 -> ./buildUEFI64
4421

4522
Building the syslinux based system:
4623
The scripts assume that the syslinux repo is at the same level in the filesystem as sedutil
4724

4825
cd ../../syslinux
4926
make
5027
cd ../sedutil/images
51-
./buildbiospba Release
52-
./buildbiospba Debug
28+
./legacypba Release
29+
./legacypba Debug
5330

5431

5532

5633

5734

58-
35+

images/buildUEFI64

+13-20
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,25 @@ set -x
44
## define releases for tools
55
. conf
66
VERSIONINFO=`git describe --dirty` || VERSIONINFO=downloaded
7-
BUILDTYPE=Release
8-
BUILDIMG=UEFI64_${BUILDTYPE}-${VERSIONINFO}.img
9-
if [ "$BUILDTYPE" == "Debug" ] || [ "$BUILDTYPE" == "Release" ] ; then
10-
echo "Building " $BUILDTYPE "image"
11-
else
12-
echo "You must select Debug|Release"
13-
exit
14-
fi
15-
7+
BUILDTYPE=UEFI64
8+
BUILDIMG=${BUILDTYPE}-${VERSIONINFO}.img
169

1710
## check that everything is available
18-
[ -f scratch/${SYSLINUX}/efi64/efi/syslinux.efi -a \
19-
-f scratch/${SYSLINUX}/efi64/com32/elflink/ldlinux/ldlinux.e64 -a \
20-
-f scratch/buildroot/64bit/images/bzImage -a \
21-
-f scratch/buildroot/64bit/images/rootfs.cpio.xz -a \
22-
-f scratch/buildroot/64bit/target/sbin/linuxpba -a \
23-
-f scratch/buildroot/64bit/target/sbin/sedutil-cli -a \
24-
-f buildroot/syslinux.cfg \
25-
] || { echo " prereqs are not available "; exit 1; }
11+
[ -f scratch/${SYSLINUX}/efi64/efi/syslinux.efi ] || { echo " prereqs are not available "; exit 1; }
12+
[ -f scratch/${SYSLINUX}/efi64/com32/elflink/ldlinux/ldlinux.e64 ] || { echo " prereqs are not available "; exit 1; }
13+
[ -f scratch/buildroot/64bit/images/bzImage ] || { echo " prereqs are not available "; exit 1; }
14+
[ -f scratch/buildroot/64bit/images/rootfs.cpio.xz ] || { echo " prereqs are not available "; exit 1; }
15+
[ -f scratch/buildroot/64bit/target/sbin/linuxpba ] || { echo " prereqs are not available "; exit 1; }
16+
[ -f scratch/buildroot/64bit/target/sbin/sedutil-cli ] || { echo " prereqs are not available "; exit 1; }
17+
[ -f buildroot/syslinux.cfg ] || { echo " prereqs are not available "; exit 1; }
18+
2619
# Start fresh
27-
sudo rm -rf UEFI64_${BUILDTYPE} ; mkdir UEFI64_${BUILDTYPE} ; cd UEFI64_${BUILDTYPE}
20+
sudo rm -rf ${BUILDTYPE} ; mkdir ${BUILDTYPE} ; cd ${BUILDTYPE}
2821
# make an image file
2922
dd if=/dev/zero of=${BUILDIMG} bs=1M count=32
3023
(echo "n";echo "";echo "";echo "";echo "ef00";echo w;echo Y) | gdisk ${BUILDIMG}
3124
LOOPDEV=`sudo losetup --show -f -o 1048576 ${BUILDIMG}`
32-
sudo mkfs.vfat $LOOPDEV -n UEFI64_${BUILDTYPE}
25+
sudo mkfs.vfat $LOOPDEV -n ${BUILDTYPE}
3326
sudo mkdir image
3427
sudo mount $LOOPDEV image
3528
sudo chmod 777 image
@@ -41,4 +34,4 @@ sudo cp ../scratch/buildroot/64bit/images/rootfs.cpio.xz image/EFI/boot/
4134
sudo cp ../buildroot/syslinux.cfg image/EFI/boot/
4235
sudo umount image
4336
sudo losetup -d $LOOPDEV
44-
gzip ${BUILDIMG}
37+
gzip ${BUILDIMG}

images/buildbios

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
set -x
3+
# Build a custom bootable image for BIOS machines
4+
## define releases for tools
5+
. conf
6+
VERSIONINFO=`git describe --dirty`
7+
BUILDTYPE=BIOS32
8+
BUILDIMG=${BUILDTYPE}-${VERSIONINFO}.img
9+
10+
## check that everything is available
11+
[ -f scratch/${SYSLINUX}/bios/mbr/mbr.bin ] || { echo " prereqs are not available "; exit 1; }
12+
[ -x scratch/${SYSLINUX}/bios/extlinux/extlinux ] || { echo " prereqs are not available "; exit 1; }
13+
[ -f scratch/buildroot/32bit/images/bzImage ] || { echo " prereqs are not available "; exit 1; }
14+
[ -f scratch/buildroot/32bit/images/rootfs.cpio.xz ] || { echo " prereqs are not available "; exit 1; }
15+
[ -x scratch/buildroot/32bit/target/sbin/linuxpba ] || { echo " prereqs are not available "; exit 1; }
16+
[ -x scratch/buildroot/32bit/target/sbin/sedutil-cli ] || { echo " prereqs are not available "; exit 1; }
17+
[ -f buildroot/syslinux.cfg ] || { echo " prereqs are not available "; exit 1; }
18+
#
19+
sudo rm -rf ${BUILDTYPE} ; mkdir ${BUILDTYPE} ; cd ${BUILDTYPE}
20+
dd if=/dev/zero of=${BUILDIMG} bs=1M count=32
21+
(echo o;echo n;echo p;echo 1;echo "";echo "";echo "";echo a;echo 1;echo w) | fdisk ${BUILDIMG}
22+
dd if=../scratch/${SYSLINUX}/bios/mbr/mbr.bin of=${BUILDIMG} count=1 conv=notrunc bs=512
23+
LOOPDEV=`sudo losetup --show -f -o 1048576 ${BUILDIMG}`
24+
sudo mkfs.ext4 $LOOPDEV -L ${BUILDTYPE}
25+
mkdir image
26+
sudo mount $LOOPDEV image
27+
sudo chmod 777 image
28+
sudo mkdir -p image/boot/extlinux
29+
sudo ../scratch/${SYSLINUX}/bios/extlinux/extlinux --install image/boot/extlinux
30+
sudo cp ../scratch/buildroot/32bit/images/bzImage image/boot/extlinux/
31+
sudo cp ../scratch/buildroot/32bit/images/rootfs.cpio.xz image/boot/extlinux/
32+
sudo cp ../buildroot/syslinux.cfg image/boot/extlinux/extlinux.conf
33+
sudo umount image
34+
sudo losetup -d $LOOPDEV
35+
gzip ${BUILDIMG}

images/buildbiosLinux

-43
This file was deleted.

images/buildrescue

+72-40
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,86 @@
11
#!/bin/bash
22
set -x
3-
# Build a custom tinycore bootable image
43
## define releases for tools
54
. conf
6-
PROGRAM=../../linux/CLI/dist/Release_i686/GNU-Linux/sedutil-cli
7-
VERSIONINFO=`git describe --dirty`
8-
BUILDTYPE=Rescue
5+
VERSIONINFO=`git describe --dirty` || VERSIONINFO=tarball
6+
BUILDTYPE=RESCUE32
7+
ROOTDIR=32bit
8+
9+
if [ x${1} == "xRescue32" ] ; then
10+
BUILDTYPE="RESCUE32"
11+
ROOTDIR="32bit"
12+
elif [ x${1} == "xRescue64" ] ; then
13+
BUILDTYPE="RESCUE64"
14+
ROOTDIR="64bit"
15+
else
16+
echo "NO BUILDTYPE specified defalted to Rescue32"
17+
fi
918
BUILDIMG=${BUILDTYPE}-${VERSIONINFO}.img
1019
echo "Building " $BUILDTYPE "image"
11-
# Start fresh
12-
sudo rm -rf ${BUILDTYPE} ; mkdir ${BUILDTYPE} ; cd ${BUILDTYPE}
13-
[ -f ../scratch/${SYSLINUX}/bios/mbr/mbr.bin -a \
14-
-x ../scratch/${SYSLINUX}/bios/extlinux/extlinux -a \
15-
-f ../scratch/core.gz -a \
16-
-f ../scratch/vmlinuz -a \
17-
-f ../scratch/hdparm.tcz -a \
18-
-f ${PROGRAM} \
19-
] || { echo " prereqs are not available "; exit 1; }
20+
[ -f scratch/${SYSLINUX}/bios/mbr/mbr.bin ] || { echo " prereqs are not available "; exit 1; }
21+
[ -x scratch/${SYSLINUX}/bios/extlinux/extlinux ] || { echo " prereqs are not available "; exit 1; }
22+
[ -f scratch/${SYSLINUX}/efi64/efi/syslinux.efi ] || { echo " prereqs are not available "; exit 1; }
23+
[ -f scratch/${SYSLINUX}/efi64/com32/elflink/ldlinux/ldlinux.e64 ] || { echo " prereqs are not available "; exit 1; }
24+
[ -f scratch/buildroot/${ROOTDIR}/images/bzImage ] || { echo " prereqs are not available "; exit 1; }
25+
[ -f scratch/buildroot/${ROOTDIR}/images/rootfs.cpio.xz ] || { echo " prereqs are not available "; exit 1; }
26+
[ -x scratch/buildroot/${ROOTDIR}/target/sbin/linuxpba ] || { echo " prereqs are not available "; exit 1; }
27+
[ -x scratch/buildroot/${ROOTDIR}/target/sbin/sedutil-cli ] || { echo " prereqs are not available "; exit 1; }
28+
[ -f buildroot/syslinux.cfg ] || { echo " prereqs are not available "; exit 1; }
29+
[ -f UEFI64/UEFI64-*.img.gz ] || { echo " prereqs are not available "; exit 1; }
30+
[ -f BIOS32/BIOS32-*.img.gz ] || { echo " prereqs are not available "; exit 1; }
31+
#
32+
# Remaster the root file system
33+
sudo rm -rf scratch/rescuefs
34+
sudo rm -f scratch/buildroot/${ROOTDIR}/images/rescuefs.cpio.xz
35+
mkdir scratch/rescuefs
36+
cd scratch/rescuefs
37+
xz --decompress --stdout ../buildroot/${ROOTDIR}/images/rootfs.cpio.xz | sudo cpio -i -H newc -d
38+
#weird permission denied on etc/issue
39+
echo "* ***********************************" > /tmp/issue
40+
echo "* DTA sedutil rescue image ${BUILDIMG}" >> /tmp/issue
41+
echo "*" >> /tmp/issue
42+
echo "* Login as root, there is no password" >> /tmp/issue
43+
echo "*" >> /tmp/issue
44+
echo "* ***********************************" >> /tmp/issue
45+
sudo mv /tmp/issue etc/issue
46+
sudo rm etc/init.d/S99*
47+
sudo mkdir -p usr/sedutil
48+
sudo cp ../../UEFI64/UEFI64-*.img.gz usr/sedutil/
49+
sudo cp ../../BIOS32/BIOS32-*.img.gz usr/sedutil/
50+
sudo find . | sudo cpio -o -H newc | xz -9 -C crc32 -c > ../buildroot/${ROOTDIR}/images/rescuefs.cpio.xz
51+
cd ../..
2052
#
21-
dd if=/dev/zero of=${BUILDIMG} bs=1M count=15
22-
(echo o;echo n;echo p;echo 1;echo "";echo "";echo a;echo 1;echo w) | fdisk -C 100 ${BUILDIMG}
23-
dd if=../scratch/${SYSLINUX}/bios/mbr/mbr.bin of=${BUILDIMG} count=1 conv=notrunc bs=512
53+
sudo rm -rf ${BUILDTYPE} ; mkdir ${BUILDTYPE} ; cd ${BUILDTYPE}
54+
dd if=/dev/zero of=${BUILDIMG} bs=1M count=128
55+
if [ ${BUILDTYPE} == "RESCUE32" ] ; then
56+
(echo o;echo n;echo p;echo 1;echo "";echo "";echo a;echo 1;echo w) | fdisk -C 100 ${BUILDIMG}
57+
dd if=../scratch/${SYSLINUX}/bios/mbr/mbr.bin of=${BUILDIMG} count=1 conv=notrunc bs=512
58+
else
59+
(echo "n";echo "";echo "";echo "";echo "ef00";echo w;echo Y) | gdisk ${BUILDIMG}
60+
fi
2461
LOOPDEV=`sudo losetup --show -f -o 1048576 ${BUILDIMG}`
25-
sudo mkfs.ext4 $LOOPDEV -L ${BUILDTYPE}-${VERSIONINFO}
62+
if [ ${BUILDTYPE} == "RESCUE32" ] ; then
63+
sudo mkfs.ext4 $LOOPDEV -L ${BUILDTYPE}
64+
else
65+
sudo mkfs.vfat $LOOPDEV -n ${BUILDTYPE}
66+
fi
2667
mkdir image
2768
sudo mount $LOOPDEV image
2869
sudo chmod 777 image
29-
mkdir -p image/boot/extlinux
30-
sudo ../scratch/${SYSLINUX}/bios/extlinux/extlinux --install image/boot/extlinux
31-
cp ../scratch/vmlinuz image/boot/
32-
echo "default DTA" >>image/boot/extlinux/extlinux.conf
33-
echo "prompt 0" >>image/boot/extlinux/extlinux.conf
34-
echo "noescape 1" >>image/boot/extlinux/extlinux.conf
35-
echo "label DTA" >>image/boot/extlinux/extlinux.conf
36-
echo " kernel /boot/vmlinuz" >>image/boot/extlinux/extlinux.conf
37-
echo " initrd /boot/core.gz" >>image/boot/extlinux/extlinux.conf
38-
echo " append loglevel=0 libata.allow_tpm=1 tinycore base norestore noswap superuser" >>image/boot/extlinux/extlinux.conf
39-
## Remaster the initrd
40-
mkdir core
41-
cd core
42-
zcat ../../scratch/core.gz | sudo cpio -i -H newc -d
43-
cd ..
44-
sudo mkdir -p core/usr/local/sbin/
45-
sudo unsquashfs -f -li -d core ../scratch/hdparm.tcz
46-
sudo cp ${PROGRAM} core/usr/local/sbin/
47-
## now repackage it
48-
cd core
49-
sudo find | sudo cpio -o -H newc | gzip -9 > ../image/boot/core.gz
50-
cd ..
51-
sudo rm -rf core
70+
if [ ${BUILDTYPE} == "RESCUE32" ] ; then
71+
sudo mkdir -p image/boot/extlinux
72+
sudo ../scratch/${SYSLINUX}/bios/extlinux/extlinux --install image/boot/extlinux
73+
sudo cp ../scratch/buildroot/32bit/images/bzImage image/boot/extlinux/
74+
sudo cp ../scratch/buildroot/32bit/images/rescuefs.cpio.xz image/boot/extlinux/rootfs.cpio.xz
75+
sudo cp ../buildroot/syslinux.cfg image/boot/extlinux/extlinux.conf
76+
else
77+
sudo mkdir -p image/EFI/boot
78+
sudo cp ../scratch/${SYSLINUX}/efi64/efi/syslinux.efi image/EFI/boot/bootx64.efi
79+
sudo cp ../scratch/${SYSLINUX}/efi64/com32/elflink/ldlinux/ldlinux.e64 image/EFI/boot/
80+
sudo cp ../scratch/buildroot/64bit/images/bzImage image/EFI/boot/
81+
sudo cp ../scratch/buildroot/64bit/images/rescuefs.cpio.xz image/EFI/boot/rootfs.cpio.xz
82+
sudo cp ../buildroot/syslinux.cfg image/EFI/boot/
83+
fi
5284
sudo umount image
5385
sudo losetup -d $LOOPDEV
5486
gzip ${BUILDIMG}

images/conf

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/bin/bash
22
# Setup versions for image components
33
# This script should be sourced by the other scripts
4-
TINYCORE=Core-6.4.1.iso
54
SYSLINUX=syslinux-6.03
6-
TCDISTRO=http://distro.ibiblio.org/tinycorelinux/6.x/x86/
75
BUILDROOT=git://git.buildroot.net/buildroot
86
BUILDROOT_TAG=2017.05.1

images/getresources

-13
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,5 @@ set -x
66
rm -rf scratch
77
mkdir scratch
88
cd scratch
9-
## Get tinycore for rescue image
10-
wget ${TCDISTRO}/release/${TINYCORE}
11-
##wget ${TCDISTRO}/tcz/ncurses-common.tcz
12-
wget ${TCDISTRO}/tcz/ncurses.tcz
13-
wget ${TCDISTRO}/tcz/hdparm.tcz
149
wget https://www.kernel.org/pub/linux/utils/boot/syslinux/${SYSLINUX}.tar.xz
15-
## Unpack Syslinux
1610
tar xf ${SYSLINUX}.tar.xz
17-
## Get the initrd and kernel from the ISO
18-
mkdir cd
19-
sudo mount ${TINYCORE} cd
20-
cp cd/boot/vmlinuz ./
21-
cp cd/boot/core.gz ./
22-
sudo umount cd
23-
rmdir cd
File renamed without changes.

0 commit comments

Comments
 (0)