# HG changeset patch # User Paul Boddie # Date 1558565370 -7200 # Node ID 93f929488a1feadf71a4db5dae021ee7cc736b63 Modified makesd macros as definitions plus a definition search/expansion script. diff -r 000000000000 -r 93f929488a1f makesd-defs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/makesd-defs Thu May 23 00:49:30 2019 +0200 @@ -0,0 +1,87 @@ +# single partition file system(s) - should boot if boot loader is in flash/eMMC +debian -f ext4 -r debian -kboot latest -dboot latest -m latest -c latest +lxde $debian -r lxde +xfce $debian -r xfce +quantumstep $debian -r quantumstep +qtmoko $debian -c none -r qtmoko +replicant $debian -k none -d none -m none -c none -r replicant +pyraos $debian -c none -r pyraos +phosh $debian -r phosh +all $lxde $qtmoko $replicant $quantumstep +all2 $xfce $qtmoko $phosh $quantumstep + +# production images (dual partition) for specific devices +gta04 -f fat -s 5 -b GTA04/latest -k latest -d latest $lxde -k none -d none -s 95 +l2804 $gta04 +gta04one -f fat -s 5 -b GTA04-OneNAND/latest -k latest -d latest $lxde -k none -d none -s 95 +gta04a5 $gta04one +l2804a5 $gta04one +gta04b2 -f fat -s 5 -b Letux-3704/latest -k latest -d latest $lxde -k none -d none -s 95 +l3704 $gta04b2 +gta04b3 -f fat -s 5 -b Letux-7004/latest -k latest -d latest $lxde -k none -d none -s 95 +l7004 $gta04b3 +gta04b7 -f fat -s 5 -b Neo900/latest -k latest -d latest $lxde -k none -d none -s 95 +neo900 $gta04b7 +bb -f fat -s 5 -b Letux-BeagleBoard/latest -k latest -d latest $lxde -k none -d none -s 95 +beagleboard $bb +bbb -f fat -s 5 -b Letux-BeagleBone-Black/latest -k latest -d latest $lxde -k none -d none -s 95 +lc8 -f fat -s 5 -b Letux-Cortex-8/latest -k latest -d latest $lxde -k none -d none -s 95 +pocketbeagle $lc8 +bb+b1 -f fat -s 5 -b OpenMoko-Beagle-Hybrid/latest -k latest -d latest $lxde -k none -d none -s 95 +bb+b2 -f fat -s 5 -b Openmoko-Beagle-Hybrid-b2/latest -k latest -d latest $lxde -k none -d none -s 95 +bb+b4 -f fat -s 5 -b Openmoko-Beagle-Hybrid-b4/latest -k latest -d latest $lxde -k none -d none -s 95 +bb+b7 -f fat -s 5 -b BeagleBoard-Neo900/latest -k latest -d latest $lxde -k none -d none -s 95 +panda-es -f fat -s 5 -b PandaBoard-ES/latest -k latest -d latest $lxde -k none -d none -s 95 +omap5432evm -f fat -s 5 -b OMAP5-uEVM/latest -k latest -d latest $lxde -k none -d none -s 95 +omap5432evm+pyra -f fat -s 5 -b OMAP5-uEVM+Pyra4.9/latest -k latest -d latest $lxde -k none -d none -s 95 +pyra+lc15 -f fat -s 5 -b Pyra+LC15/latest -k latest -d latest $lxde -k none -d none -s 95 +pyra+lc15-4.9 -f fat -s 5 -b Pyra+LC15-4.9/latest -k latest -d latest $lxde -k none -d none -s 95 +pyra+lc15-4gb -f fat -s 5 -b Pyra+LC15-4GB/latest -k latest-lpae -d latest-lpae $lxde -m latest-lpae -k none -d none -s 95 +pyra $pyra+lc15 -r $pyraos +pyra-$lxde $pyra+lc15 -r $lxde +pyra-4gb $pyra+lc15-4gb -r $pyraos +lc15 -f fat -s 5 -b Letux-Cortex-15/latest -k latest -d latest $lxde -k none -d none -s 95 +lc15-4.9 -f fat -s 5 -b Letux-Cortex-15-4.9/latest -k latest -d latest $lxde -k none -d none -s 95 +lc15-4gb -f fat -s 5 -b Letux-Cortex-15-4GB/latest -k latest-lpae -d latest-lpae $lxde -k none -d none -m latest-lpae -s 95 +lc15evm -f fat -s 5 -b Letux-Cortex-15-EVM/latest -k latest -d latest $lxde -k none -d none -s 95 +lc15evm-4gb -f fat -s 5 -b Letux-Cortex-15-EVM-4GB/latest -k latest -d latest $lxde -k none -d none -s 95 +gta15 -f fat -s 5 -b GTA15/latest -k latest -d latest $lxde -k none -d none -s 95 +gta15-4gb -f fat -s 5 -b GTA15-4GB/latest -k latest -d latest $lxde -k none -d none -s 95 +pyraphone $gta15 + +# for Pandora, a single partition image can boot +openpandora $lxde -b OpenPandora/latest +pandora $openpandora + +# Udoo Neo needs a pseudo-single -partition but SPL and u-boot must be copied by dd +udoo-neo $lxde -p 2 -dd Udoo-Neo/latest/SPL -p 138 -dd Udoo-Neo/latest/u-boot.img \ + -p 2048 -bboot Udoo-Neo/latest -kboot latest -dboot latest -m latest + +# Raspi 3B+ needs special setup with bootloader and boot plus rootfs partitions +raspi3b+ -f fat -s 5 -I -x https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin \ + -x https://github.com/raspberrypi/firmware/raw/master/boot/fixup.dat \ + -x https://github.com/raspberrypi/firmware/raw/master/boot/start.elf \ + -x http://download.goldelico.com/letux-u-boot/RasPi-3B+/latest/config.txt \ + -x http://download.goldelico.com/letux-u-boot/RasPi-3B+/latest/cmdline.txt \ + -k http://download.goldelico.com/letux-kernel/latest/zImage -d latest $lxde -k none -d none -m latest -s 95 + +# we must make sure that we load the mipsel variants and not armel/armhf +lenny400 -A mipsel -f fat -s 2 -k http://download.goldelico.com/letux-400/20110208-lenny400/uImage \ + -f ext -r http://download.goldelico.com/letux-400/20110208-lenny400/bootstrapped-rootfs.tbz \ + -c http://download.goldelico.com/letux-400/20110208-lenny400/config.tgz \ + -m http://download.goldelico.com/letux-400/20110208-lenny400/modules.tgz +mipsbook-400 -A mipsel -f fat -s 2 -k latest-l400 -d latest-l400 -f ext \ + -r http://download.goldelico.com/letux-400/20110208-lenny400/bootstrapped-rootfs.tbz \ + -c http://download.goldelico.com/letux-400/20110208-lenny400/config.tgz \ + -m latest-l400 +mipsbook $mipsbook-400 +letux-400 $mipsbook-400 + +# CI20 needs a pseudo-single -partition but SPL and u-boot must be copied by dd +# see https://elinux.org/CI20_Dev_Zone#Making_a_bootable_SD_card_from_sources +ci20 -A mipsel $lxde -p 1 -dd CI20/latest/u-boot-spl.bin -p 28 -dd CI20/latest/u-boot.img \ + -p 4096 -bboot CI20/latest -kboot latest-l400 -dboot latest-l400 -m latest-l400 + +# Kobo / Tolino 3 needs a pseudo-single -partition but SPL and u-boot must be copied by dd +kobo-clara $lxde -p 2 -dd Kobo/latest/SPL -p 138 -dd Kobo/latest/u-boot.img -p 2048 -bboot Kobo/latest -kboot latest -dboot latest -m latest +tolino-shine3 $kobo-clara diff -r 000000000000 -r 93f929488a1f makesd-expand-def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/makesd-expand-def Thu May 23 00:49:30 2019 +0200 @@ -0,0 +1,157 @@ +#!/bin/sh + +# Search for a definition in the definitions file, expanding it to the recorded +# value, recursively expanding any definition references. + +PROGNAME=`basename "$0"` +THISDIR=`dirname "$0"` + +DEFSFILE="makesd-defs" +DEFSPATH="$THISDIR/$DEFSFILE" + + + +# Test for options. + +if [ "$1" = '--original' ] ; then + FLAT=$1 + shift 1 +else + FLAT= +fi + +# Obtain the requested definition name. + +DEF=$1 + +if [ ! "$DEF" ] || [ "$DEF" = '--help' ] ; then + cat 1>&2 < + +Search for a definition of the given name in the definitions file: + +$DEFSPATH + +If the definition can be found, the value of the definition is emitted and an +exit value of 0 returned. Otherwise, no output is produced and an exit value of +1 is returned. +EOF + exit 1 +fi + + + +# lookup +# +# Search for a definition of the given name in the definitions file. Emit the +# full definition, incorporating multiple lines if continuation characters are +# present. + +lookup() +{ + local LINENUM + + # Obtain the line number of the matching definition. + + LINENUM=`grep -h -n "^$1\s" "$DEFSPATH" | cut -d: -f1` + + if [ "$LINENUM" ] ; then + + # Read from the definition line. Line continuations are observed. + + tail -n "+$LINENUM" "$DEFSPATH" | if read LINE ; then + echo "$LINE" + break + fi + fi +} + +# match +# +# Attempt to match pattern in string, emitting the string if successful. + +match() +{ + if `echo "$1" | grep -q "$2"` ; then + echo "$1" + return 0 + else + return 1 + fi +} + +# defname +# +# Return the actual definition name from the given prefixed name. + +defname() +{ + echo "$1" | sed 's/^\$//' +} + +# expand +# +# Expand the given definition name to its value, recursively expanding any +# definition names found in the value text. + +expand() +{ + local FOUND VALUE + + FOUND= + VALUE= + + for WORD in `lookup "$1"`; do + if [ ! "$FOUND" ] ; then + FOUND=$WORD + continue + fi + + # Prevent recursive expansion if flat mode is selected. + + if [ ! "$FLAT" ] ; then + + # Identify definition names by looking for a $ prefix. + + DEFNAME=`match "$WORD" '^\\$'` + + # Attempt to expand definition names. + + if [ "$DEFNAME" ] ; then + DEFNAME=`defname "$DEFNAME"` + EXPANDED=`expand "$DEFNAME"` + + if [ "$EXPANDED" ] ; then + WORD=$EXPANDED + fi + fi + fi + + # Incorporate expansions into the final value. + + if [ ! "$VALUE" ] ; then + VALUE=$WORD + else + VALUE="$VALUE $WORD" + fi + done + + # Show the expanded definition value. + + echo "$VALUE" + + # Return a result value of 0 if successful, 1 otherwise. + + if [ "$VALUE" ] ; then + return 0 + else + return 1 + fi +} + + + +# Expand the definition and return the result code. + +expand "$DEF" +exit $?