build packages and build them into the fs image

This commit is contained in:
Hal Emmerich 2020-06-18 19:36:55 -05:00
parent 413fd45f91
commit 350f80361a
4 changed files with 49 additions and 68 deletions

View File

@ -132,7 +132,7 @@ packages:
cd packages && $(MAKE)
.PHONY: packages_install
install_packages:
packages_install:
ifndef INSTALL_TARGET
$(error INSTALL_TARGET is not set)
endif

View File

@ -70,14 +70,13 @@ PACKAGE_DIR=$PWD
# only defined if there are build deps we need to satisfy
PACKAGE_LOCAL_BUILD_DEPS=$7
if [ -z "$PACKAGE_LOCAL_BUILD_DEPS" ]
then
if [[ $PACKAGE_LOCAL_BUILD_DEPS == "" ]]; then
echo Building $PACKAGE_NAME
cd src
pdebuild --configfile $PBUILDER_RC \
--buildresult $PACKAGE_DIR \
-- \
--hookdir $PBUILDER_HOOKS \
--basetgz $PBUILDER_CHROOT
else
@ -85,6 +84,7 @@ else
for dep in $PACKAGE_LOCAL_BUILD_DEPS ; do \
make build_package BUILD_PACKAGE=$dep -C .. ; \
done
rm $PRAWNOS_LOCAL_APT_REPO/Packages
cd $PRAWNOS_LOCAL_APT_REPO && dpkg-scanpackages . /dev/null > Packages
echo $PACKAGE_NAME build deps satisfied
cd $PACKAGE_DIR

View File

@ -111,45 +111,6 @@ create_image() {
mount -o noatime ${2}p2 $5
}
build_install_crossystem() {
# install crossystem
apt install -y vboot-utils
#install clang and pre-reqs
apt install -y clang uuid-dev meson pkg-config cmake libcmocka-dev cargo
flashmap_src=/root/flashmap
mosys_src=/root/mosys
mkdir $flashmap_src
mkdir $mosys_src
#clone flashmap, need to build libfmap
git clone https://github.com/dhendrix/flashmap.git /root/flashmap
cd $flashmap_src && make all
cd $flashmap_src && make install
ldconfig
#clone mosys. Later releases start depending on the minijail library which we would have to build, and that we don't care about anyway on linux
git clone https://chromium.googlesource.com/chromiumos/platform/mosys /root/mosys
cd $mosys_src && git checkout release-R69-10895.B
mkdir $mosys_src/build
# compile the c parts
cd $mosys_src && CFLAGS="-Wno-error" CC=clang meson -Darch=arm $mosys_src/build
cd $mosys_src && ninja -C $mosys_src/build
# install mosys so crossystem can access it. It EXPECTS it to be right here and fails otherwise...
mkdir -p /usr/sbin/
cp --verbose $mosys_src/build/mosys /usr/sbin/
# cleanup the source
rm -rf $flashmap_src
rm -rf $mosys_src
# cleanup the unnecessary build packages, need the noninteractive flag as -y is not enough to avoid prompting users on remove for some reason
DEBIAN_FRONTEND=noninteractive apt-get purge -y --auto-remove clang meson libcmocka-dev cargo cmake pkg-config
}
# create a 2GB image with the Chrome OS partition layout
create_image $BASE $outdev 50M 40 $outmnt
@ -162,9 +123,14 @@ fi
# install Debian on it
export DEBIAN_FRONTEND=noninteractive
# need ca-certs, gnupg, openssl to handle https apt links and key adding for deb.prawnos.com
qemu-debootstrap --arch armhf $DEBIAN_SUITE --include openssl,ca-certificates,gnupg,locales,init --keyring=$build_resources/debian-archive-keyring.gpg $outmnt $PRAWNOS_DEBOOTSTRAP_MIRROR --cache-dir=$PRAWNOS_ROOT/build/apt-cache/
chroot $outmnt passwd -d root
qemu-debootstrap --arch armhf $DEBIAN_SUITE \
--include ${base_debs_download[@]} \
--keyring=$build_resources/debian-archive-keyring.gpg \
$outmnt \
$PRAWNOS_DEBOOTSTRAP_MIRROR \
--cache-dir=$PRAWNOS_ROOT/build/apt-cache/
chroot $outmnt passwd -d root
#Place the config files and installer script and give them the proper permissions
echo -n PrawnOS > $outmnt/etc/hostname
@ -220,11 +186,6 @@ chroot $outmnt locale-gen
chroot $outmnt apt update
chroot $outmnt apt install -y ${base_debs_install[@]}
#build and install crossystem/mosys, funky way to call the bash function inside the chroot
# TODO!! UNCOMMENT!
# export -f build_install_crossystem
# chroot $outmnt /bin/bash -ec "build_install_crossystem"
#add the live-boot fstab
cp -f $build_resources/external_fstab $outmnt/etc/fstab
chmod 644 $outmnt/etc/fstab
@ -233,22 +194,6 @@ chmod 644 $outmnt/etc/fstab
chroot $outmnt apt-get autoremove --purge
chroot $outmnt apt-get clean
#Download support for libinput-gestures
#Package is copied into /InstallResources/packages
chroot $outmnt apt install -y libinput-tools xdotool build-essential
# we want to include all of our built packages in the apt cache for installation later, but we want to let apt download dependencies
# if required
# this gets tricky when we build some of the dependencies. To avoid issues
# first, manually cache the deb
# apt install ./local-package.deb alone doesn't work because apt will resort to downloading it from deb.prawnos.com, which we dont want
# copy into /var/cache/apt/archives to place it in the cache
#next call apt install -d on the ./filename or on the package name and apt will recognize it already has the package cached, so will only cache the dependencies
#Copy the built prawnos debs over to the image, and update apts cache
cd $PRAWNOS_ROOT && make packages_install INSTALL_TARGET=$outmnt/var/cache/apt/archives/
chroot $outmnt apt install -y -d ${prawnos_debs_prebuilt_download[@]}
#Download the shared packages to be installed by Install.sh:
chroot $outmnt apt-get install -y -d ${base_debs_download[@]}
@ -262,6 +207,21 @@ chroot $outmnt apt-get install -y -d ${lxqt_debs_download[@]}
#Download the gnome packages to be installed by Install.sh:
chroot $outmnt apt-get install -y -d ${gnome_debs_download[@]}
# we want to include all of our built packages in the apt cache for installation later, but we want to let apt download dependencies
# if required
# this gets tricky when we build some of the dependencies. To avoid issues
# first, manually cache the deb
# apt install ./local-package.deb alone doesn't work because apt will resort to downloading it from deb.prawnos.com, which we dont want
# copy into /var/cache/apt/archives to place it in the cache
#next call apt install -d on the ./filename or on the package name and apt will recognize it already has the package cached, so will only cache the dependencies
#Copy the built prawnos debs over to the image, and update apts cache
cd $PRAWNOS_ROOT && make packages_install INSTALL_TARGET=$outmnt/var/cache/apt/archives/
chroot $outmnt apt install -y ${prawnos_base_debs_prebuilt_install[@]}
chroot $outmnt apt install -y -d ${prawnos_base_debs_prebuilt_download[@]}
chroot $outmnt apt install -y -d ${prawnos_xfce_debs_prebuilt_download[@]}
## GPU support
#download mesa packages
chroot $outmnt apt-get install -y -d ${mesa_debs_download[@]}

View File

@ -18,6 +18,16 @@
# ======================================== Package Lists =========================================
# ================================ KEEP THESE LISTS ALPHABETIZED! ================================
debootstrap_debs_install=(
build-essential
ca-certificates
gnupg
init
locales
openssl
)
base_debs_install=(
alsa-utils
apt-utils
@ -41,6 +51,7 @@ base_debs_install=(
less
libatm1
libgpg-error-l10n
libinput-tools
libnss-systemd
libpam-cap nftables
nano
@ -53,7 +64,9 @@ base_debs_install=(
udev
uuid-runtime
vim
vboot-utils
wpasupplicant
xdotool
xz-utils
)
@ -163,13 +176,21 @@ gnome_debs_download=(
seahorse
)
prawnos_debs_prebuilt_download=(
# packages built by prawnos, to be installed when running InstallPrawnOS
# and choosing xfce
prawnos_xfce_debs_prebuilt_download=(
font-source-code-pro
xsecurelock
)
prawnos_debs_prebuilt_install=(
# packages built by prawnos, to be installed when running InstallPrawnOS
prawnos_base_debs_prebuilt_download=(
)
# packages built by prawnos, to be installed at build time
prawnos_base_debs_prebuilt_install=(
flashmap
mosys
)
# ====================================== END Package Lists =======================================