Much better 'Makefile'. Added new 'release' target which generates the sources and then builds MLL from these sources instead of using the development sources.
This commit is contained in:
parent
8c11c89915
commit
316ea6c9de
150
src/Makefile
150
src/Makefile
@ -7,55 +7,121 @@
|
|||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
|
|
||||||
all: clean
|
all: clean
|
||||||
@echo "Launching the main build script."
|
@{ \
|
||||||
@/usr/bin/time -f 'Elapsed time: %E' ./build_minimal_linux_live.sh 2>&1 | tee minimal_linux_live.log
|
echo "Launching the main build script." ; \
|
||||||
|
/usr/bin/time -f "\n Elapsed time: %E" ./build_minimal_linux_live.sh 2>&1 | tee minimal_linux_live.log ; \
|
||||||
|
echo "" ; \
|
||||||
|
}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo "Removing generated work artifacts."
|
@{ \
|
||||||
@rm -rf work
|
echo "Removing generated work artifacts." ; \
|
||||||
@echo "Removing generated build artifacts."
|
rm -rf work ; \
|
||||||
@rm -f minimal_linux_live.iso
|
echo "Removing generated build artifacts." ; \
|
||||||
@rm -f mll_image.tgz
|
rm -f minimal_linux_live.iso ; \
|
||||||
@echo "Removing predefined configuration files."
|
rm -f mll_image.tgz ; \
|
||||||
@rm -rf minimal_overlay/*.config
|
USE_PREDEFINED_KERNEL_CONFIG=`grep -i ^USE_PREDEFINED_KERNEL_CONFIG= .config | cut -f2- -d'=' | xargs` ; \
|
||||||
@echo "Removing source level overlay software."
|
if [ ! "$$USE_PREDEFINED_KERNEL_CONFIG" = "true" ] ; then \
|
||||||
@mv -f minimal_overlay/rootfs/README /tmp/mll_overlay_readme
|
echo "Removing predefined Linux kernel config file." ; \
|
||||||
@cd minimal_overlay/rootfs && rm -rf * && cd ../..
|
rm -rf minimal_overlay/kernel.config ; \
|
||||||
@mv -f /tmp/mll_overlay_readme minimal_overlay/rootfs/README
|
else \
|
||||||
@echo "Removing build log file."
|
echo "Local Linux kernel config file is preserved." ; \
|
||||||
@rm -f minimal_linux_live.log
|
fi ; \
|
||||||
@$(eval USE_LOCAL_SOURCE := $(shell grep -i ^USE_LOCAL_SOURCE .config | cut -f2 -d'='))
|
USE_PREDEFINED_BUSYBOX_CONFIG=`grep -i ^USE_PREDEFINED_BUSYBOX_CONFIG= .config | cut -f2- -d'=' | xargs` ; \
|
||||||
@if [ ! "$(USE_LOCAL_SOURCE)" = "true" ]; then echo "Removing source files."; rm -rf source; fi
|
if [ ! "$$USE_PREDEFINED_BUSYBOX_CONFIG" = "true" ] ; then \
|
||||||
|
echo "Removing predefined BusyBox config file." ; \
|
||||||
|
rm -rf minimal_overlay/busybox.config ; \
|
||||||
|
else \
|
||||||
|
echo "Local BusyBox config file is preserved." ; \
|
||||||
|
fi ; \
|
||||||
|
echo "Removing source level overlay software." ; \
|
||||||
|
mv -f minimal_overlay/rootfs/README /tmp/mll_overlay_readme ; \
|
||||||
|
cd minimal_overlay/rootfs ; \
|
||||||
|
rm -rf * ; \
|
||||||
|
cd ../.. ; \
|
||||||
|
mv -f /tmp/mll_overlay_readme minimal_overlay/rootfs/README ; \
|
||||||
|
echo "Removing build log file." ; \
|
||||||
|
rm -f minimal_linux_live.log ; \
|
||||||
|
USE_LOCAL_SOURCE=`grep -i ^USE_LOCAL_SOURCE= .config | cut -f2- -d'=' | xargs` ; \
|
||||||
|
if [ ! "$$USE_LOCAL_SOURCE" = "true" ] ; then \
|
||||||
|
echo "Removing local source files." ; \
|
||||||
|
rm -rf source ; \
|
||||||
|
else \
|
||||||
|
echo "Local sources are preserved." ; \
|
||||||
|
fi ; \
|
||||||
|
}
|
||||||
|
|
||||||
qemu-bios:
|
qemu-bios:
|
||||||
@if [ ! -f ./minimal_linux_live.iso ]; then echo "ISO image 'minimal_linux_live.iso' not found."; exit 1; fi
|
@{ \
|
||||||
@echo "Launching QEMU in legacy BIOS mode."
|
if [ ! -f ./minimal_linux_live.iso ] ; then \
|
||||||
@./qemu-bios.sh
|
echo "" ; \
|
||||||
|
echo " ERROR: ISO image 'minimal_linux_live.iso' not found." ; \
|
||||||
|
echo "" ; \
|
||||||
|
exit 1 ; \
|
||||||
|
fi ; \
|
||||||
|
echo "Launching QEMU in BIOS mode." ; \
|
||||||
|
./qemu-bios.sh ; \
|
||||||
|
}
|
||||||
|
|
||||||
qemu-uefi:
|
qemu-uefi:
|
||||||
@if [ ! -f ./minimal_linux_live.iso ]; then echo "ISO image 'minimal_linux_live.iso' not found."; exit 1; fi
|
@{ \
|
||||||
@echo "Launching QEMU in UEFI mode."
|
if [ ! -f ./minimal_linux_live.iso ] ; then \
|
||||||
@./qemu-uefi.sh
|
echo "" ; \
|
||||||
|
echo " ERROR: ISO image 'minimal_linux_live.iso' not found." ; \
|
||||||
|
echo "" ; \
|
||||||
|
exit 1 ; \
|
||||||
|
fi ; \
|
||||||
|
echo "Launching QEMU in UEFI mode." ; \
|
||||||
|
./qemu-uefi.sh ; \
|
||||||
|
}
|
||||||
|
|
||||||
src:
|
src:
|
||||||
@echo "Generating source archive."
|
@{ \
|
||||||
@rm -f minimal_linux_live_*_src.tar.xz
|
echo "Generating source archive." ; \
|
||||||
@cd minimal_overlay && ./overlay_build.sh mll_source 1>/dev/null && cd ..
|
rm -f minimal_linux_live_*_src.tar.xz ; \
|
||||||
@$(eval DATE_PARSED := $(shell LANG=en_US ; date +"%d-%b-%Y"))
|
cd minimal_overlay ; \
|
||||||
@cd work/overlay_rootfs/usr/src && tar -cpf - `ls -A` | xz - > ../../../../minimal_linux_live_$(DATE_PARSED)_src.tar.xz && cd ../../../..
|
./overlay_build.sh mll_source 1>/dev/null ; \
|
||||||
@echo "Source archive is 'minimal_linux_live_$(DATE_PARSED)_src.tar.xz'."
|
cd .. ; \
|
||||||
|
cp work/overlay/mll_source/*.tar.xz . ; \
|
||||||
|
echo "Source archive is '`ls minimal_linux_live_*_src.tar.xz`'." ; \
|
||||||
|
}
|
||||||
|
|
||||||
|
release: src
|
||||||
|
@{ \
|
||||||
|
rm -rf /tmp/mll_release ; \
|
||||||
|
mkdir -p /tmp/mll_release ; \
|
||||||
|
cp minimal_linux_live_*_src.tar.xz /tmp/mll_release ; \
|
||||||
|
cd /tmp/mll_release && tar -xf minimal_linux_live_*_src.tar.xz ; \
|
||||||
|
cd /tmp/mll_release/minimal_linux_live_*/ ; \
|
||||||
|
echo "Launching the main build script." ; \
|
||||||
|
/usr/bin/time -f "\n Elapsed time: %E" ./build_minimal_linux_live.sh 2>&1 | tee minimal_linux_live.log ; \
|
||||||
|
echo "" ; \
|
||||||
|
echo " Check the directory '/tmp/mll_release'." ; \
|
||||||
|
echo "" ; \
|
||||||
|
}
|
||||||
|
|
||||||
|
test:
|
||||||
|
@{ \
|
||||||
|
echo "" ; \
|
||||||
|
echo " This target is reserved for local tests." ; \
|
||||||
|
echo "" ; \
|
||||||
|
}
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo ""
|
@{ \
|
||||||
@echo " make all - clean the workspace and then generate 'minimal_linux_live.iso'."
|
echo "" ; \
|
||||||
@echo ""
|
echo " make all - clean the workspace and then generate 'minimal_linux_live.iso'." ; \
|
||||||
@echo " make clean - remove all generated files."
|
echo "" ; \
|
||||||
@echo ""
|
echo " make clean - remove all generated files." ; \
|
||||||
@echo " make src - generate 'tar.xz' source archive."
|
echo "" ; \
|
||||||
@echo ""
|
echo " make help - this is the default target." ; \
|
||||||
@echo " make qemu-bios - run 'Minimal Linux Live' in QEMU with legacy BIOS compatibility."
|
echo "" ; \
|
||||||
@echo ""
|
echo " make release - generate clean source tree in '/tmp/mll_release' and build MLL there." ; \
|
||||||
@echo " make qemu-uefi - run 'Minimal Linux Live' in QEMU with UEFI compatibility."
|
echo "" ; \
|
||||||
@echo ""
|
echo " make src - generate 'tar.xz' source archive." ; \
|
||||||
@echo " make help - this is the default target."
|
echo "" ; \
|
||||||
@echo ""
|
echo " make qemu-bios - run 'Minimal Linux Live' in QEMU with legacy BIOS compatibility." ; \
|
||||||
|
echo "" ; \
|
||||||
|
echo " make qemu-uefi - run 'Minimal Linux Live' in QEMU with UEFI compatibility." ; \
|
||||||
|
echo "" ; \
|
||||||
|
}
|
||||||
|
@ -42,6 +42,28 @@ cp -r --remove-destination $DEST_DIR/* \
|
|||||||
cp -r --remove-destination $DEST_DIR/* \
|
cp -r --remove-destination $DEST_DIR/* \
|
||||||
$OVERLAY_ROOTFS
|
$OVERLAY_ROOTFS
|
||||||
|
|
||||||
|
# Prepare the 'tar.xz' source archive - BEGIN.
|
||||||
|
|
||||||
|
# Generate helper variables.
|
||||||
|
DATE_PARSED=`LANG=en_US ; date +"%d-%b-%Y"`
|
||||||
|
ARCHIVE_PREFIX=minimal_linux_live_
|
||||||
|
ARCHIVE_DIR=${ARCHIVE_PREFIX}${DATE_PARSED}
|
||||||
|
ARCHIVE_FILE=${ARCHIVE_DIR}_src.tar.xz
|
||||||
|
|
||||||
|
# Remove old source artifacts.
|
||||||
|
rm -rf $WORK_DIR/overlay/$BUNDLE_NAME/${ARCHIVE_PREFIX}*
|
||||||
|
|
||||||
|
# Copy all sources to the new temporary directory.
|
||||||
|
cp -r $DEST_DIR/usr/src \
|
||||||
|
$WORK_DIR/overlay/$BUNDLE_NAME/$ARCHIVE_DIR
|
||||||
|
|
||||||
|
cd $WORK_DIR/overlay/$BUNDLE_NAME
|
||||||
|
|
||||||
|
# Generate the 'tar.xz' source archive.
|
||||||
|
tar -cpf - $ARCHIVE_DIR | xz -9 - \
|
||||||
|
> $WORK_DIR/overlay/$BUNDLE_NAME/$ARCHIVE_FILE
|
||||||
|
|
||||||
|
# Prepare the 'tar.xz' source archive - END.
|
||||||
|
|
||||||
echo "Bundle '$BUNDLE_NAME' has been installed."
|
echo "Bundle '$BUNDLE_NAME' has been installed."
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user