deviceinfo: add heimdall partitions / make flasher variables optional
This commit is contained in:
parent
51bdc24315
commit
efab009a1f
|
@ -1,6 +1,6 @@
|
||||||
pkgname=device-samsung-i9070
|
pkgname=device-samsung-i9070
|
||||||
pkgver=1
|
pkgver=1
|
||||||
pkgrel=5
|
pkgrel=6
|
||||||
pkgdesc="Samsung Galaxy S Advance"
|
pkgdesc="Samsung Galaxy S Advance"
|
||||||
url="https://github.com/postmarketOS"
|
url="https://github.com/postmarketOS"
|
||||||
arch="noarch"
|
arch="noarch"
|
||||||
|
@ -32,7 +32,7 @@ package() {
|
||||||
"$pkgdir"/etc/modules-load.d/00-${pkgname}.conf
|
"$pkgdir"/etc/modules-load.d/00-${pkgname}.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
sha512sums="a76e09953981b0610f42b94acc9b3e2d1dc5a8993b0d4bec32b3704359bba04efbc22576001c7d490234634a8805ac5109d4ab28b5d52a578df1b6dbdaff18c6 deviceinfo
|
sha512sums="aa23264c03aba01e573bb427f0f14d8b3c5f2cbdc7402ec763aa6da85d9c13d55cc4d596b2df3845c04c1f5784a13aa41bbe0449cbc44483c7cfc165b4c05292 deviceinfo
|
||||||
098187f6ab56d2542f98f1b5fbcf493431f665a4300db05e859357366e39b02a3d508bfd94c1d1bd7c669261e7ef0d4e1aef1fdbb15541fe34f3f48a6caa247f initfs-hook.sh
|
098187f6ab56d2542f98f1b5fbcf493431f665a4300db05e859357366e39b02a3d508bfd94c1d1bd7c669261e7ef0d4e1aef1fdbb15541fe34f3f48a6caa247f initfs-hook.sh
|
||||||
ffa8ba47539f0b4a931c560811d7842c7f5270631066c270322859c1ef77e63fba09a8462c2533bd6d095056b2c7936c2d4fc4e225f3cff45169f121bf93d8ed 90-android.rules
|
ffa8ba47539f0b4a931c560811d7842c7f5270631066c270322859c1ef77e63fba09a8462c2533bd6d095056b2c7936c2d4fc4e225f3cff45169f121bf93d8ed 90-android.rules
|
||||||
61e8becbf6fa7c1c6c42e481083f5981ae7af33a48cbc53e817d8ac2c6a8e4f67a54b32ae3b8f5f25f7b412165a849dc93a629110dc47b0d16927bf2a12eb7e1 modules-load.conf"
|
61e8becbf6fa7c1c6c42e481083f5981ae7af33a48cbc53e817d8ac2c6a8e4f67a54b32ae3b8f5f25f7b412165a849dc93a629110dc47b0d16927bf2a12eb7e1 modules-load.conf"
|
||||||
|
|
|
@ -13,3 +13,7 @@ deviceinfo_external_disk="true"
|
||||||
deviceinfo_external_disk_install="true"
|
deviceinfo_external_disk_install="true"
|
||||||
deviceinfo_flash_methods="heimdall"
|
deviceinfo_flash_methods="heimdall"
|
||||||
deviceinfo_arch="armhf"
|
deviceinfo_arch="armhf"
|
||||||
|
|
||||||
|
# Heimdall related
|
||||||
|
deviceinfo_flash_heimdall_partition_kernel="Kernel"
|
||||||
|
deviceinfo_flash_heimdall_partition_initfs="Kernel2"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
pkgname=device-samsung-i9100
|
pkgname=device-samsung-i9100
|
||||||
pkgver=1
|
pkgver=1
|
||||||
pkgrel=4
|
pkgrel=5
|
||||||
pkgdesc="Samsung Galaxy SII"
|
pkgdesc="Samsung Galaxy SII"
|
||||||
url="https://github.com/postmarketOS"
|
url="https://github.com/postmarketOS"
|
||||||
arch="noarch"
|
arch="noarch"
|
||||||
|
@ -23,5 +23,5 @@ package() {
|
||||||
"$pkgdir"/etc/udev/rules.d/90-android.rules
|
"$pkgdir"/etc/udev/rules.d/90-android.rules
|
||||||
}
|
}
|
||||||
|
|
||||||
sha512sums="9ee793403f5a8789470073cb2be21b6ba12dc021530ca61b0fdc45bb903df020dba4099b93d8c922eb7f91f78888e19ac856c5baaffd23ecd81a2033b3c4ddde deviceinfo
|
sha512sums="7d57cbeeb4d35c5e3ea865175b781eebf88508893607b1be883c615f56bb69eb73a979d97e698d1938fcc226e3836d1f7210e9d09bad0ad66671cba5faa37cdc deviceinfo
|
||||||
8aead706ddb118a44de7d049f07d10a27e727d17724058d132e4ec4fa73fed29c9ccfe03f02aca459c922ec0fbba24e171fe3c76e33f7c5462631e3dd5506e36 90-android.rules"
|
8aead706ddb118a44de7d049f07d10a27e727d17724058d132e4ec4fa73fed29c9ccfe03f02aca459c922ec0fbba24e171fe3c76e33f7c5462631e3dd5506e36 90-android.rules"
|
||||||
|
|
|
@ -13,3 +13,7 @@ deviceinfo_external_disk="true"
|
||||||
deviceinfo_external_disk_install="true"
|
deviceinfo_external_disk_install="true"
|
||||||
deviceinfo_flash_methods="heimdall"
|
deviceinfo_flash_methods="heimdall"
|
||||||
deviceinfo_arch="armhf"
|
deviceinfo_arch="armhf"
|
||||||
|
|
||||||
|
# Heimdall related
|
||||||
|
deviceinfo_flash_heimdall_partition_kernel="KERNEL"
|
||||||
|
deviceinfo_flash_heimdall_partition_initfs="RECOVERY"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
pkgname=heimdall
|
pkgname=heimdall
|
||||||
pkgver=1.4.2
|
pkgver=1.4.2
|
||||||
pkgrel=1
|
pkgrel=2
|
||||||
pkgdesc="Flasher for Samsung Galaxy S devices"
|
pkgdesc="Flasher for Samsung Galaxy S devices"
|
||||||
url="https://github.com/Benjamin-Dobell/Heimdall"
|
url="https://github.com/Benjamin-Dobell/Heimdall"
|
||||||
arch="all"
|
arch="all"
|
||||||
|
@ -26,5 +26,5 @@ package() {
|
||||||
}
|
}
|
||||||
|
|
||||||
sha512sums="c554662f9ccb763a8e9867a0c563618879d2533af985d44db3c237d3ee51add44c1681d13b1a83b72b30ba6e5b32d7c2f9c02b31114c67c5fbe01cbb010acfe7 heimdall-1.4.2.tar.gz
|
sha512sums="c554662f9ccb763a8e9867a0c563618879d2533af985d44db3c237d3ee51add44c1681d13b1a83b72b30ba6e5b32d7c2f9c02b31114c67c5fbe01cbb010acfe7 heimdall-1.4.2.tar.gz
|
||||||
a75677d4c5559bf8233a48d1b38bf91e4125717a85e1ea6d283d2d1e052c2a96228818a71f8b90adbda049b6d5b5065f7265ffc2e05cafd2ce9717bfc8ac8716 heimdall_flash_kernel.sh
|
49573b44c0b6526ec3367d9e0c5fb727f01030f116aaaebe49ae05400923c04ffddd4a688bc15af981f8777ebb0e6b0a818b2b19b7c2917c3ac82a351a85ffa8 heimdall_flash_kernel.sh
|
||||||
45e742bb3a8c8d0bc6806a4e9f860b04f255cad72a8602c04759178284c66e0a90d3ea22249b5fa69de1dd1d6ecd6221adaa63d611aa20d2a54aa20868e86a9f heimdall_wait_for_device.sh"
|
45e742bb3a8c8d0bc6806a4e9f860b04f255cad72a8602c04759178284c66e0a90d3ea22249b5fa69de1dd1d6ecd6221adaa63d611aa20d2a54aa20868e86a9f heimdall_wait_for_device.sh"
|
||||||
|
|
|
@ -3,31 +3,38 @@ set -e
|
||||||
|
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
echo "Flash an initramfs file to the recovery partition, and flash a kernel."
|
echo "Flash initramfs and kernel to separate partitions."
|
||||||
echo "The kernel needs to have its own minimal initramfs, that loads the"
|
echo "The kernel needs to have its own minimal initramfs, that loads the"
|
||||||
echo "real initramfs from the recovery partition (\"isorec\")."
|
echo "real initramfs from the other partition (\"isorec\")."
|
||||||
echo ""
|
echo ""
|
||||||
echo "Usage: $(basename "$0") <initramfs> <kernel>"
|
echo "Usage: $(basename "$0") <initfs> <initfs partition> <kernel> <kernel partition>"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sanity checks
|
# Sanity checks
|
||||||
[ "$#" != 2 ] && usage
|
[ "$#" != 4 ] && usage
|
||||||
INITRAMFS="$1"
|
INITFS="$1"
|
||||||
KERNEL="$2"
|
INITFS_PARTITION="$2"
|
||||||
for file in "$INITRAMFS" "$KERNEL"; do
|
KERNEL="$3"
|
||||||
|
KERNEL_PARTITION="$4"
|
||||||
|
for file in "$INITFS" "$KERNEL"; do
|
||||||
[ -e "$file" ] && continue
|
[ -e "$file" ] && continue
|
||||||
echo "ERROR: File $file does not exist!"
|
echo "ERROR: File $file does not exist!"
|
||||||
exit 1
|
exit 1
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "(1/2) flash initramfs to recovery partition (isorec-style)"
|
echo "(1/2) Flash initramfs to the '$INITFS_PARTITION' partition (isorec-style)"
|
||||||
heimdall_wait_for_device.sh
|
heimdall_wait_for_device.sh
|
||||||
gunzip -c "$INITRAMFS" | lzop > /tmp/initramfs.lzo
|
gunzip -c "$INITFS" | lzop > /tmp/initramfs.lzo
|
||||||
heimdall flash --RECOVERY /tmp/initramfs.lzo
|
heimdall flash --"$INITFS_PARTITION" /tmp/initramfs.lzo
|
||||||
rm /tmp/initramfs.lzo
|
rm /tmp/initramfs.lzo
|
||||||
|
|
||||||
|
# Sleeping is necessary here, because when directly connecting again, the
|
||||||
|
# flashing of the kernel has always failed (at least on the i9100).
|
||||||
|
echo "Sleeping for 20 seconds..."
|
||||||
sleep 20
|
sleep 20
|
||||||
echo "(2/2) flash kernel (hit ^C if you only wanted to flash initramfs)"
|
|
||||||
|
echo "(2/2) Flash kernel to the '$KERNEL_PARTITION' partition"
|
||||||
|
echo "NOTE: Press ^C if you only wanted to flash the initramfs."
|
||||||
heimdall_wait_for_device.sh
|
heimdall_wait_for_device.sh
|
||||||
heimdall flash --KERNEL "$KERNEL"
|
heimdall flash --"$KERNEL_PARTITION" "$KERNEL"
|
||||||
|
|
|
@ -125,6 +125,11 @@ build_packages = ["abuild", "build-base", "ccache"]
|
||||||
# the native chroot and a cross-compiler, without using distcc
|
# the native chroot and a cross-compiler, without using distcc
|
||||||
build_cross_native = ["linux-*"]
|
build_cross_native = ["linux-*"]
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# PARSE
|
||||||
|
#
|
||||||
|
|
||||||
# Variables in APKBUILD files, that get parsed
|
# Variables in APKBUILD files, that get parsed
|
||||||
apkbuild_attributes = {
|
apkbuild_attributes = {
|
||||||
"arch": {"array": True},
|
"arch": {"array": True},
|
||||||
|
@ -149,6 +154,39 @@ apkbuild_attributes = {
|
||||||
"_llvmver": {"array": False},
|
"_llvmver": {"array": False},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Variables from deviceinfo. Reference: <https://postmarketos.org/deviceinfo>
|
||||||
|
deviceinfo_attributes = [
|
||||||
|
# device
|
||||||
|
"format_version",
|
||||||
|
"name",
|
||||||
|
"manufacturer",
|
||||||
|
"date",
|
||||||
|
"keyboard",
|
||||||
|
"nonfree",
|
||||||
|
"dtb",
|
||||||
|
"modules_initfs",
|
||||||
|
"external_disk",
|
||||||
|
"external_disk_install",
|
||||||
|
"flash_methods",
|
||||||
|
"arch",
|
||||||
|
|
||||||
|
# flash
|
||||||
|
"generate_bootimg",
|
||||||
|
"generate_legacy_uboot_initfs",
|
||||||
|
"flash_heimdall_partition_initfs",
|
||||||
|
"flash_heimdall_partition_kernel",
|
||||||
|
"flash_offset_base",
|
||||||
|
"flash_offset_kernel",
|
||||||
|
"flash_offset_ramdisk",
|
||||||
|
"flash_offset_second",
|
||||||
|
"flash_offset_tags",
|
||||||
|
"flash_pagesize",
|
||||||
|
"kernel_cmdline",
|
||||||
|
|
||||||
|
# weston
|
||||||
|
"weston_pixman_type",
|
||||||
|
]
|
||||||
|
|
||||||
#
|
#
|
||||||
# INITFS
|
# INITFS
|
||||||
#
|
#
|
||||||
|
@ -201,6 +239,7 @@ $IMAGE: Path to the system partition image
|
||||||
$KERNEL_CMDLINE: Kernel commandline
|
$KERNEL_CMDLINE: Kernel commandline
|
||||||
|
|
||||||
Fastboot specific: $OFFSET_KERNEL, $OFFSET_RAMDISK, $OFFSET_TAGS, $PAGE_SIZE
|
Fastboot specific: $OFFSET_KERNEL, $OFFSET_RAMDISK, $OFFSET_TAGS, $PAGE_SIZE
|
||||||
|
Heimdall specific: $PARTITION_KERNEL, $PARTITION_INITFS
|
||||||
"""
|
"""
|
||||||
flashers = {
|
flashers = {
|
||||||
"fastboot": {
|
"fastboot": {
|
||||||
|
@ -228,8 +267,8 @@ flashers = {
|
||||||
["heimdall_wait_for_device.sh"],
|
["heimdall_wait_for_device.sh"],
|
||||||
["heimdall", "flash", "--SYSTEM", "$IMAGE"]],
|
["heimdall", "flash", "--SYSTEM", "$IMAGE"]],
|
||||||
"flash_kernel": [["heimdall_flash_kernel.sh",
|
"flash_kernel": [["heimdall_flash_kernel.sh",
|
||||||
"$BOOT/initramfs-$FLAVOR",
|
"$BOOT/initramfs-$FLAVOR", "$PARTITION_INITFS",
|
||||||
"$BOOT/vmlinuz-$FLAVOR"]]
|
"$BOOT/vmlinuz-$FLAVOR", "$PARTITION_KERNEL"]]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,23 +30,19 @@ def run(args, action, flavor=None):
|
||||||
raise RuntimeError("action " + action + " is not"
|
raise RuntimeError("action " + action + " is not"
|
||||||
" configured for method " + method + "!")
|
" configured for method " + method + "!")
|
||||||
|
|
||||||
# Kernel commandline is optional
|
|
||||||
# Optional variables
|
|
||||||
cmdline = ""
|
|
||||||
if "kernel_cmdline" in args.deviceinfo:
|
|
||||||
cmdline = args.deviceinfo["kernel_cmdline"]
|
|
||||||
|
|
||||||
# Variable setup
|
# Variable setup
|
||||||
vars = {
|
vars = {
|
||||||
"$BOOT": "/mnt/rootfs_" + args.device + "/boot",
|
"$BOOT": "/mnt/rootfs_" + args.device + "/boot",
|
||||||
"$FLAVOR": flavor if flavor is not None else "",
|
"$FLAVOR": flavor if flavor is not None else "",
|
||||||
"$IMAGE": "/home/user/rootfs/" + args.device + ".img",
|
"$IMAGE": "/home/user/rootfs/" + args.device + ".img",
|
||||||
"$KERNEL_CMDLINE": cmdline,
|
"$KERNEL_CMDLINE": args.deviceinfo["kernel_cmdline"],
|
||||||
"$OFFSET_KERNEL": args.deviceinfo["flash_offset_kernel"],
|
"$OFFSET_KERNEL": args.deviceinfo["flash_offset_kernel"],
|
||||||
"$OFFSET_RAMDISK": args.deviceinfo["flash_offset_ramdisk"],
|
"$OFFSET_RAMDISK": args.deviceinfo["flash_offset_ramdisk"],
|
||||||
"$OFFSET_SECOND": args.deviceinfo["flash_offset_second"],
|
"$OFFSET_SECOND": args.deviceinfo["flash_offset_second"],
|
||||||
"$OFFSET_TAGS": args.deviceinfo["flash_offset_tags"],
|
"$OFFSET_TAGS": args.deviceinfo["flash_offset_tags"],
|
||||||
"$PAGE_SIZE": args.deviceinfo["flash_pagesize"],
|
"$PAGE_SIZE": args.deviceinfo["flash_pagesize"],
|
||||||
|
"$PARTITION_INITFS": args.deviceinfo["flash_heimdall_partition_initfs"],
|
||||||
|
"$PARTITION_KERNEL": args.deviceinfo["flash_heimdall_partition_kernel"],
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run the commands of each action
|
# Run the commands of each action
|
||||||
|
|
|
@ -18,6 +18,7 @@ along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import pmb.config
|
||||||
|
|
||||||
|
|
||||||
def deviceinfo(args, device=None):
|
def deviceinfo(args, device=None):
|
||||||
|
@ -48,4 +49,10 @@ def deviceinfo(args, device=None):
|
||||||
key = split[0][len("deviceinfo_"):]
|
key = split[0][len("deviceinfo_"):]
|
||||||
value = split[1].replace("\"", "").replace("\n", "")
|
value = split[1].replace("\"", "").replace("\n", "")
|
||||||
ret[key] = value
|
ret[key] = value
|
||||||
|
|
||||||
|
# Assign empty string as default
|
||||||
|
for key in pmb.config.deviceinfo_attributes:
|
||||||
|
if key not in ret:
|
||||||
|
ret[key] = ""
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
Loading…
Reference in New Issue