mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
appletv: add 'make image' support to buildsystem
This allows ‘PROJECT=ATV ARCH=i386 make image’ to output the .img files needed to run OE from a USB (live mode) or install to the internal HDD. Note: this is not complete and must be fixed Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
d4fc0986a0
commit
99e7690338
BIN
packages/tools/atv-bootloader/files/3rdparty/atvboot/BootLogo.png
vendored
Normal file
BIN
packages/tools/atv-bootloader/files/3rdparty/atvboot/BootLogo.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
BIN
packages/tools/atv-bootloader/files/3rdparty/atvboot/BootLogoSwiss.png
vendored
Normal file
BIN
packages/tools/atv-bootloader/files/3rdparty/atvboot/BootLogoSwiss.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
16
packages/tools/atv-bootloader/files/3rdparty/atvboot/com.apple.Boot.hdd
vendored
Normal file
16
packages/tools/atv-bootloader/files/3rdparty/atvboot/com.apple.Boot.hdd
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Background Color</key>
|
||||
<integer>0</integer>
|
||||
<key>Boot Fail Logo</key>
|
||||
<string></string>
|
||||
<key>Boot Logo</key>
|
||||
<string>BootLogo.png</string>
|
||||
<key>Kernel</key>
|
||||
<string>MACH_KERNEL</string>
|
||||
<key>Kernel Flags</key>
|
||||
<string>boot=/dev/sda1 disk=/dev/sda2 quiet BOOT_IMAGE=MACH_KERNEL SYSTEM_IMAGE=SYSTEM</string>
|
||||
</dict>
|
||||
</plist>
|
@ -7,10 +7,10 @@
|
||||
<key>Boot Fail Logo</key>
|
||||
<string></string>
|
||||
<key>Boot Logo</key>
|
||||
<string>BootLogo.png</string>
|
||||
<string>BootLogoSwiss.png</string>
|
||||
<key>Kernel</key>
|
||||
<string>mach_kernel</string>
|
||||
<key>Kernel Flags</key>
|
||||
<string>atv-boot=none video=vesafb</string>
|
||||
<string>atv-boot=patchstick logo.nologo quiet video=vesafb</string>
|
||||
</dict>
|
||||
</plist>
|
16
packages/tools/atv-bootloader/files/3rdparty/atvboot/com.apple.Boot.usb
vendored
Normal file
16
packages/tools/atv-bootloader/files/3rdparty/atvboot/com.apple.Boot.usb
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Background Color</key>
|
||||
<integer>0</integer>
|
||||
<key>Boot Fail Logo</key>
|
||||
<string></string>
|
||||
<key>Boot Logo</key>
|
||||
<string>BootLogo.png</string>
|
||||
<key>Kernel</key>
|
||||
<string>MACH_KERNEL</string>
|
||||
<key>Kernel Flags</key>
|
||||
<string>boot=/dev/sdb1 disk=/dev/sdb2 quiet BOOT_IMAGE=MACH_KERNEL SYSTEM_IMAGE=SYSTEM</string>
|
||||
</dict>
|
||||
</plist>
|
478
packages/tools/atv-bootloader/files/3rdparty/atvboot/patchstick.sh
vendored
Executable file
478
packages/tools/atv-bootloader/files/3rdparty/atvboot/patchstick.sh
vendored
Executable file
@ -0,0 +1,478 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2011-2013 Christian Hewitt (chewitt@openelec.tv)
|
||||
#
|
||||
# This Program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This Program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
blink(){
|
||||
atvclient &>/dev/null &
|
||||
}
|
||||
|
||||
check_verbose(){
|
||||
exec 1>/dev/console
|
||||
exec 2>/dev/console
|
||||
if [ -f /mnt/openelec/enable_verbose ]; then
|
||||
exec 3>&1
|
||||
exec 4>&2
|
||||
else
|
||||
exec 3> /dev/null
|
||||
exec 4> /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
check_debug(){
|
||||
if [ -f /mnt/rootfs/enable_debug ]; then
|
||||
echo " INFO: Script debugging enabled"
|
||||
set -x
|
||||
fi
|
||||
}
|
||||
|
||||
check_function(){
|
||||
FUNCTION=$(cat /mnt/rootfs/function)
|
||||
}
|
||||
|
||||
check_bootdevice(){
|
||||
SDA=$(ls /dev/sda)
|
||||
SDB=$(ls /dev/sdb)
|
||||
BOOTDEVICE=$(cat /proc/mounts | grep /mnt/rootfs | awk '{print $1}' | sed 's/[0-9]//g')
|
||||
if [ -n "${SDA}" -a -n "${SDB}" ]; then
|
||||
# AppleTV has USB and HDD devices
|
||||
if [ "${BOOTDEVICE}" = "/dev/sda" ]; then
|
||||
# AppleTV has a SATA adapter the kernel recognises slowly
|
||||
USB="/dev/sda"
|
||||
HDD="/dev/sdb"
|
||||
SLOWBOOT="TRUE"
|
||||
else
|
||||
# AppleTV has a normal setup
|
||||
USB="/dev/sdb"
|
||||
HDD="/dev/sda"
|
||||
fi
|
||||
else
|
||||
# AppleTV has no HDD
|
||||
USB="/dev/sda"
|
||||
HDD="/dev/sda"
|
||||
NOHDD="TRUE"
|
||||
fi
|
||||
}
|
||||
|
||||
banner(){
|
||||
clear
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo " ********************************************************************************"
|
||||
echo " * *"
|
||||
case $FUNCTION in
|
||||
factoryrestore) echo " * OpenELEC AppleTV Factory Restore *" ;;
|
||||
update) echo " * OpenELEC AppleTV Updater *" ;;
|
||||
emergency) echo " * OpenELEC AppleTV Emergency Boot *" ;;
|
||||
*) echo " * OpenELEC AppleTV Installer *" ;;
|
||||
esac
|
||||
echo " * *"
|
||||
echo " ********************************************************************************"
|
||||
echo ""
|
||||
}
|
||||
|
||||
get_partition_end(){
|
||||
local PARTITION=$1
|
||||
PARTITION_END=$(parted -s "${TARGET}" print -m | egrep "^${PARTITION}" | cut -d ":" -f 3)
|
||||
strip_alpha_characters "${PARTITION_END}"
|
||||
PARTITION_END="${STRIPPED}"
|
||||
}
|
||||
|
||||
strip_alpha_characters(){
|
||||
local TEXT=$1
|
||||
STRIPPED=$(echo "${TEXT}" | sed 's/[^.0-9]//g')
|
||||
}
|
||||
|
||||
disk_sync(){
|
||||
partprobe "${TARGET}" 1>&3 2>&4
|
||||
sync 1>&3 2>&4
|
||||
}
|
||||
|
||||
network(){
|
||||
ifconfig eth0 0.0.0.0
|
||||
/sbin/udhcpc --now 1>&3 2>&4
|
||||
sleep 4
|
||||
IPADDRESS=$(ifconfig | head -n 2 | grep inet | awk '{print $2}' | sed 's/addr://g')
|
||||
if [ "${IPADDRESS}" = "" ]; then
|
||||
ERROR="noipaddress"
|
||||
error
|
||||
else
|
||||
echo " INFO: Leased ipv4 address ${IPADDRESS} from DHCP server"
|
||||
fi
|
||||
}
|
||||
|
||||
prepare(){
|
||||
case $FUNCTION in
|
||||
factoryrestore)
|
||||
if [ ! -d /mnt/rootfs/restore ]; then
|
||||
echo ""
|
||||
echo " FAIL: No restore files!"
|
||||
echo ""
|
||||
error
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [ ! -f /mnt/rootfs/MACH_KERNEL -a ! -f /mnt/rootfs/SYSTEM ]; then
|
||||
network
|
||||
DOWNLOAD=$(wget -qO- "http://update.openelec.tv/updates.php?i=INSTALLER&d=OpenELEC&pa=ATV.i386&v=3.1.0" | \
|
||||
sed 's/{"data":{"update":"//g' | sed 's/","folder":"releases"}}//g' | grep OpenELEC-ATV)
|
||||
echo ""
|
||||
echo " INFO: Downloading ${DOWNLOAD}"
|
||||
echo ""
|
||||
wget -O /mnt/rootfs/${DOWNLOAD} http://releases.openelec.tv/${DOWNLOAD}
|
||||
tar -xvf /mnt/rootfs/${DOWNLOAD} -C /mnt/rootfs 1>&3 2>&4
|
||||
FOLDER=$(echo ${DOWNLOAD} | sed 's/.tar//g')
|
||||
mv /mnt/rootfs/${FOLDER}/target/MACH_KERNEL /mnt/rootfs/ 1>&3 2>&4
|
||||
mv /mnt/rootfs/${FOLDER}/target/MACH_KERNEL.md5 /mnt/rootfs/ 1>&3 2>&4
|
||||
mv /mnt/rootfs/${FOLDER}/target/SYSTEM /mnt/rootfs/ 1>&3 2>&4
|
||||
mv /mnt/rootfs/${FOLDER}/target/SYSTEM.md5 /mnt/rootfs/ 1>&3 2>&4
|
||||
rm -rf /mnt/rootfs/${FOLDER} 1>&3 2>&4
|
||||
fi
|
||||
SUM1=$(md5sum /mnt/rootfs/MACH_KERNEL | awk '{print $1}')
|
||||
SUM2=$(cat /mnt/rootfs/MACH_KERNEL.md5 | awk '{print $1}')
|
||||
SUM3=$(md5sum /mnt/rootfs/SYSTEM | awk '{print $1}')
|
||||
SUM4=$(cat /mnt/rootfs/SYSTEM.md5 | awk '{print $1}')
|
||||
if [ "${SUM1}" != "${SUM2}" -o "${SUM3}" != "${SUM4}" -o -z "${SUM2}" -o -z "${SUM4}" ]; then
|
||||
ERROR="badchecksum"
|
||||
error
|
||||
fi
|
||||
rm /mnt/rootfs/MACH_KERNEL.md5 1>&3 2>&4
|
||||
rm /mnt/rootfs/SYSTEM.md5 1>&3 2>&4
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
create_target(){
|
||||
echo ""
|
||||
dd if=/dev/zero of=${TARGET} bs=512 count=40 1>&3 2>&4
|
||||
disk_sync
|
||||
echo " INFO: Creating GPT Scheme"
|
||||
parted -s ${TARGET} mklabel gpt 1>&3 2>&4
|
||||
}
|
||||
|
||||
create_boot(){
|
||||
echo " INFO: Creating BOOT Partition"
|
||||
PARTITION="1"
|
||||
parted -s ${TARGET} mkpart primary HFS 40s 409600s 1>&3 2>&4
|
||||
parted -s ${TARGET} set ${PARTITION} atvrecv on 1>&3 2>&4
|
||||
parted -s ${TARGET} name ${PARTITION} 'BOOT' 1>&3 2>&4
|
||||
disk_sync
|
||||
mkfs.hfsplus -s -v "BOOT" ${TARGET}${PARTITION} 1>&3 2>&4
|
||||
fsck.hfsplus -y ${TARGET}${PARTITION} 1>&3 2>&4
|
||||
BOOT=$(mktemp -d "/tmp/mounts.XXXXXX")
|
||||
mount ${TARGET}${PARTITION} ${BOOT} 1>&3 2>&4
|
||||
PARTITION=$(( ${PARTITION} + 1 ))
|
||||
}
|
||||
|
||||
create_boot_usb(){
|
||||
echo " INFO: Creating BOOT Partition"
|
||||
PARTITION="1"
|
||||
parted -s ${TARGET} mkpart primary HFS 40s 1048542s 1>&3 2>&4
|
||||
parted -s ${TARGET} set ${PARTITION} atvrecv on 1>&3 2>&4
|
||||
parted -s ${TARGET} name ${PARTITION} 'BOOT' 1>&3 2>&4
|
||||
disk_sync
|
||||
PARTITION=$(( ${PARTITION} + 1 ))
|
||||
}
|
||||
|
||||
create_storage(){
|
||||
echo " INFO: Creating STORAGE Partition"
|
||||
P1_END=$(parted -s ${TARGET} unit s print | grep atvrecv | awk '{print $3}' | sed 's/s//g')
|
||||
P2_START=$(( ${P1_END} + 1 ))
|
||||
DRIVE_END=$(parted -s ${TARGET} unit s print | grep ${TARGET} | awk '{print $3}' | sed 's/s//g')
|
||||
SWAP_SIZE=$(( 512 * 1024 * 1024 / 512 )) # 512MB in bytes / 512 byte sectors
|
||||
if [ "${SWAP}" = "TRUE" -a "${FUNCTION}" = "install-hdd" ]; then
|
||||
P2_END=$(( ${DRIVE_END} - ${SWAP_SIZE} - 40 ))
|
||||
else
|
||||
P2_END=$(( ${DRIVE_END} - 40 ))
|
||||
fi
|
||||
parted -s ${TARGET} mkpart primary ext4 ${P2_START}s ${P2_END}s 1>&3 2>&4
|
||||
parted -s ${TARGET} name ${PARTITION} 'STORAGE' 1>&3 2>&4
|
||||
disk_sync
|
||||
mkfs.ext4 -L "STORAGE" ${TARGET}${PARTITION} 1>&3 2>&4
|
||||
fsck.ext4 -y ${TARGET}${PARTITION} 1>&3 2>&4
|
||||
STORAGE=$(mktemp -d "/tmp/mounts.XXXXXX")
|
||||
mount ${TARGET}${PARTITION} ${STORAGE} 1>&3 2>&4
|
||||
PARTITION=$(( ${PARTITION} + 1 ))
|
||||
}
|
||||
|
||||
create_swap(){
|
||||
if [ "${SWAP}" = "TRUE" ]; then
|
||||
echo " INFO: Creating LINUX-SWAP Partition"
|
||||
P2_END=$(parted -s ${TARGET} unit s print | grep STORAGE | awk '{print $3}' | sed 's/s//g')
|
||||
DRIVE_END=$(parted -s ${TARGET} unit s print | grep ${TARGET} | awk '{print $3}' | sed 's/s//g')
|
||||
P3_START=$(( ${P2_END} + 1 ))
|
||||
P3_END=$(( ${DRIVE_END} - 40 ))
|
||||
parted -s ${TARGET} mkpart primary linux-swap ${P3_START}s ${P3_END}s 1>&3 2>&4
|
||||
parted -s ${TARGET} name ${PARTITION} 'LINUX-SWAP' 1>&3 2>&4
|
||||
mkswap ${TARGET}${PARTITION} 1>&3 2>&4
|
||||
disk_sync
|
||||
fi
|
||||
}
|
||||
|
||||
install_hdd(){
|
||||
TARGET=${HDD}
|
||||
SWAP="TRUE"
|
||||
echo ""
|
||||
echo " WARN: Continuing with installation will replace the original Apple OS or current"
|
||||
echo " Linux OS on the AppleTV's internal hard drive with OpenELEC. If you do not"
|
||||
echo " want installation to contine please POWER OFF your AppleTV within the next"
|
||||
echo " 30 seconds and remove the USB key."
|
||||
catnap
|
||||
create_target
|
||||
create_boot
|
||||
create_storage
|
||||
create_swap
|
||||
echo " INFO: Creating BOOT Files"
|
||||
cp -av /mnt/rootfs/boot.efi "${BOOT}"/ 1>&3 2>&4
|
||||
cp -av /mnt/rootfs/BootLogo.png "${BOOT}"/ 1>&3 2>&4
|
||||
cp -Rv /mnt/rootfs/System "${BOOT}"/ 1>&3 2>&4
|
||||
cp -av /mnt/rootfs/MACH_KERNEL "${BOOT}"/ 1>&3 2>&4
|
||||
cp -av /mnt/rootfs/SYSTEM "${BOOT}"/ 1>&3 2>&4
|
||||
if [ "${SLOWBOOT}" = "TRUE" ]; then
|
||||
cp -av /mnt/rootfs/com.apple.Boot.usb "${BOOT}"/com.apple.Boot.plist 1>&3 2>&4
|
||||
else
|
||||
cp -av /mnt/rootfs/com.apple.Boot.hdd "${BOOT}"/com.apple.Boot.plist 1>&3 2>&4
|
||||
fi
|
||||
chown root:root "${BOOT}"/* 1>&3 2>&4
|
||||
mkdir -p ${STORAGE}/.update 1>&3 2>&4
|
||||
mkdir -p ${STORAGE}/.cache/services 1>&3 2>&4
|
||||
echo SSHD_START=true > ${STORAGE}/.cache/services/ssh.conf
|
||||
# for systemd testing we also need to touch sshd.conf
|
||||
touch ${STORAGE}/.cache/services/sshd.conf
|
||||
remove_temp_mounts 1>&3 2>&4
|
||||
echo ""
|
||||
echo " INFO: Installation Completed!"
|
||||
echo ""
|
||||
echo " INFO: Ignore the warnings below as we reboot :)"
|
||||
echo ""
|
||||
}
|
||||
|
||||
install_usb(){
|
||||
TARGET=${USB}
|
||||
SWAP="FALSE"
|
||||
create_target
|
||||
create_boot_usb
|
||||
create_storage
|
||||
if [ "${NOHDD}" = "TRUE" ]; then
|
||||
cp -av /mnt/rootfs/com.apple.Boot.hdd /mnt/rootfs/com.apple.Boot.plist 1>&3 2>&4
|
||||
else
|
||||
cp -av /mnt/rootfs/com.apple.Boot.usb /mnt/rootfs/com.apple.Boot.plist 1>&3 2>&4
|
||||
fi
|
||||
mkdir -p ${STORAGE}/.update 1>&3 2>&4
|
||||
mkdir -p ${STORAGE}/.cache/services 1>&3 2>&4
|
||||
echo SSHD_START=true > ${STORAGE}/.cache/services/ssh.conf
|
||||
# for systemd testing we also need to touch sshd.conf
|
||||
touch ${STORAGE}/.cache/services/sshd.conf
|
||||
remove_temp_mounts 1>&3 2>&4
|
||||
echo ""
|
||||
echo " INFO: Installation Completed!"
|
||||
echo ""
|
||||
echo " INFO: Ignore the warnings below as we reboot :)"
|
||||
echo ""
|
||||
}
|
||||
|
||||
update(){
|
||||
echo ""
|
||||
echo " INFO: Checking ${HDD}1 Filesystem for Errors"
|
||||
fsck.hfsplus ${HDD}1 1>&3 2>&4
|
||||
# echo " INFO: Checking ${HDD}2 Filesystem for Errors"
|
||||
# fsck.ext4 ${HDD}2 1>&3 2>&4
|
||||
mkdir -p /mnt/boot 1>&3 2>&4
|
||||
echo " INFO: Mounting BOOT Partition"
|
||||
mount -t hfsplus -o rw,force ${HDD}1 /mnt/boot 1>&3 2>&4
|
||||
echo " INFO: Updating MACH_KERNEL and SYSTEM"
|
||||
cp -av /mnt/rootfs/MACH_KERNEL /mnt/boot/ 1>&3 2>&4
|
||||
cp -av /mnt/rootfs/SYSTEM /mnt/boot/ 1>&3 2>&4
|
||||
echo ""
|
||||
echo " INFO: Files updated!"
|
||||
echo ""
|
||||
echo " INFO: Ignore the warnings below as we reboot :)"
|
||||
echo ""
|
||||
}
|
||||
|
||||
factoryrestore(){
|
||||
DISKSIZE=$(parted -s ${HDD} unit s print | grep "Disk ${HDD}:" | awk '{print $3}' | sed 's/s//g')
|
||||
let SECTORS="${DISKSIZE}"-262145
|
||||
echo " WARN: Continuing with restore will erase OpenELEC from the internal HDD of your"
|
||||
echo " AppleTV and will reinstall AppleOS files to prepare for a factory-restore"
|
||||
echo " boot. To abort the restore, POWER OFF your AppleTV in the next 30 seconds"
|
||||
echo ""
|
||||
catnap
|
||||
echo " INFO: Creating GPT Scheme"
|
||||
parted -s ${HDD} mklabel gpt 1>&3 2>&4
|
||||
echo " INFO: Creating Partitions"
|
||||
parted -s ${HDD} mkpart primary fat32 40s 69671s 1>&3 2>&4
|
||||
parted -s ${HDD} mkpart primary HFS 69672s 888823s 1>&3 2>&4
|
||||
parted -s ${HDD} mkpart primary HFS 888824s 2732015s 1>&3 2>&4
|
||||
parted -s ${HDD} mkpart primary HFS 2732016s ${SECTORS}s 1>&3 2>&4
|
||||
partprobe ${HDD} 1>&3 2>&4
|
||||
parted -s ${HDD} set 2 atvrecv on 1>&3 2>&4
|
||||
parted -s ${HDD} set 1 boot on 1>&3 2>&4
|
||||
echo " INFO: Creating Filesystems"
|
||||
mkfs.msdos -F 32 -n EFI ${HDD}1 1>&3 2>&4
|
||||
mkfs.hfsplus -v Recovery ${HDD}2 1>&3 2>&4
|
||||
mkfs.hfsplus -J -v OSBoot ${HDD}3 1>&3 2>&4
|
||||
mkfs.hfsplus -J -v Media ${HDD}4 1>&3 2>&4
|
||||
partprobe ${HDD} 1>&3 2>&4
|
||||
echo " INFO: Restoring Recovery Files"
|
||||
mkdir /mnt/Recovery 1>&3 2>&4
|
||||
mount -t hfsplus -o rw,force ${HDD}2 /mnt/Recovery 1>&3 2>&4
|
||||
cp -Rv /mnt/rootfs/restore/* /mnt/Recovery 1>&3 2>&4
|
||||
sync 1>&3 2>&4
|
||||
sleep 2
|
||||
umount /mnt/Recovery 1>&3 2>&4
|
||||
sleep 2
|
||||
echo y | gptsync ${HDD} 1>&3 2>&4
|
||||
sleep 2
|
||||
echo ""
|
||||
echo " INFO: Preparation has completed!"
|
||||
echo ""
|
||||
echo " INFO: Ignore the warnings below as we reboot :)"
|
||||
echo ""
|
||||
}
|
||||
|
||||
emergency(){
|
||||
echo ""
|
||||
echo " INFO: Telnet login available; user = 'root' and password = 'root'"
|
||||
echo ""
|
||||
telnetd -l /bin/login
|
||||
}
|
||||
|
||||
cleanup_hdd(){
|
||||
umount /mnt/rootfs 1>&3 2>&4
|
||||
echo y | gptsync ${HDD} 1>&3 2>&4
|
||||
dd if=/dev/zero of=${USB} bs=512 count=40 1>&3 2>&4
|
||||
}
|
||||
|
||||
cleanup_usb(){
|
||||
umount /mnt/rootfs 1>&3 2>&4
|
||||
echo y | gptsync ${USB} 1>&3 2>&4
|
||||
}
|
||||
|
||||
snooze(){
|
||||
sleep 100000
|
||||
}
|
||||
|
||||
catnap(){
|
||||
sleep 30
|
||||
}
|
||||
|
||||
pause(){
|
||||
sleep 10
|
||||
}
|
||||
|
||||
error(){
|
||||
case $ERROR in
|
||||
download) echo " FAIL: The files could not be downloaded, aborting!";;
|
||||
badchecksum) echo " FAIL: Checksum does not match, aborting!";;
|
||||
noipaddress) echo " FAIL: Failed to lease an ipv4 address, aborting!";;
|
||||
*) echo " FAIL: There was an error, aborting!";;
|
||||
esac
|
||||
echo ""
|
||||
if [ -z "${IPADDRESS}" ]; then
|
||||
network
|
||||
fi
|
||||
emergency
|
||||
snooze
|
||||
}
|
||||
|
||||
main(){
|
||||
blink
|
||||
check_verbose
|
||||
check_debug
|
||||
check_function
|
||||
check_bootdevice
|
||||
banner
|
||||
case $FUNCTION in
|
||||
install-hdd)
|
||||
prepare
|
||||
install_hdd
|
||||
cleanup_hdd
|
||||
pause
|
||||
reboot
|
||||
;;
|
||||
install-hdd-offline)
|
||||
prepare
|
||||
install_hdd
|
||||
cleanup_hdd
|
||||
pause
|
||||
reboot
|
||||
;;
|
||||
install-hdd-offline-debug)
|
||||
prepare
|
||||
install_hdd
|
||||
cleanup_hdd
|
||||
pause
|
||||
reboot
|
||||
;;
|
||||
install-usb)
|
||||
prepare
|
||||
install_usb
|
||||
cleanup_usb
|
||||
pause
|
||||
reboot
|
||||
;;
|
||||
install-usb-offline)
|
||||
prepare
|
||||
install_usb
|
||||
cleanup_usb
|
||||
pause
|
||||
reboot
|
||||
;;
|
||||
install-usb-offline-debug)
|
||||
prepare
|
||||
install_usb
|
||||
cleanup_usb
|
||||
pause
|
||||
reboot
|
||||
;;
|
||||
update)
|
||||
prepare
|
||||
update
|
||||
cleanup_hdd
|
||||
pause
|
||||
reboot
|
||||
;;
|
||||
update-offline)
|
||||
prepare
|
||||
update
|
||||
cleanup_hdd
|
||||
pause
|
||||
reboot
|
||||
;;
|
||||
factoryrestore)
|
||||
prepare
|
||||
factoryrestore
|
||||
cleanup_hdd
|
||||
pause
|
||||
reboot
|
||||
;;
|
||||
emergency)
|
||||
network
|
||||
emergency
|
||||
;;
|
||||
*)
|
||||
error
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main
|
||||
snooze
|
@ -23,7 +23,7 @@ PKG_ARCH="i386 x86_64"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="http://code.google.com/p/atv-bootloader/"
|
||||
PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz"
|
||||
PKG_DEPENDS_TARGET="toolchain darwin-cross linux"
|
||||
PKG_DEPENDS_TARGET="toolchain atvboot darwin-cross linux"
|
||||
PKG_PRIORITY="optional"
|
||||
PKG_SECTION="tools"
|
||||
PKG_SHORTDESC="atv-bootloader: Tool to create a mach_kernel compaitible kernel image"
|
||||
|
25
packages/tools/atv-bootloader/release
Executable file
25
packages/tools/atv-bootloader/release
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# OpenELEC is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OpenELEC is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
. config/options $1
|
||||
|
||||
mkdir -p $RELEASE_DIR/3rdparty/atvboot
|
||||
cp -PR $BUILD/atvboot-*/boot.efi $RELEASE_DIR/3rdparty/atvboot
|
||||
cp -PR $BUILD/atvboot-*/mach_kernel $RELEASE_DIR/3rdparty/atvboot
|
41
packages/tools/atvboot/package.mk
Normal file
41
packages/tools/atvboot/package.mk
Normal file
@ -0,0 +1,41 @@
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# OpenELEC is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OpenELEC is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
PKG_NAME="atvboot"
|
||||
PKG_VERSION="1"
|
||||
PKG_REV="1"
|
||||
PKG_ARCH="i386 x86_64"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="http://openelec.tv"
|
||||
PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz"
|
||||
PKG_DEPENDS_TARGET="toolchain"
|
||||
PKG_PRIORITY="optional"
|
||||
PKG_SECTION="tools"
|
||||
PKG_SHORTDESC="atvboot: ATV Bootloader files"
|
||||
PKG_LONGDESC="atvboot: ATV Bootloader files"
|
||||
|
||||
PKG_IS_ADDON="no"
|
||||
PKG_AUTORECONF="no"
|
||||
|
||||
make_target() {
|
||||
: # nothing todo
|
||||
}
|
||||
|
||||
makeinstall_target() {
|
||||
: # nothing todo
|
||||
}
|
BIN
projects/ATV/3rdparty/atvboot/BootLogo.png
vendored
BIN
projects/ATV/3rdparty/atvboot/BootLogo.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 67 KiB |
BIN
projects/ATV/3rdparty/atvboot/System/.DS_Store
vendored
BIN
projects/ATV/3rdparty/atvboot/System/.DS_Store
vendored
Binary file not shown.
Binary file not shown.
@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>KernelMemoryAccess</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.osxbook.kext.KernelMemoryAccess</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>KernelMemoryAccess</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>KEXT</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0.0</string>
|
||||
<key>OSBundleLibraries</key>
|
||||
<dict>
|
||||
<key>com.apple.kernel.6.0</key>
|
||||
<string>7.9.9</string>
|
||||
<key>com.apple.kpi.bsd</key>
|
||||
<string>8.0.0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
Binary file not shown.
BIN
projects/ATV/3rdparty/atvboot/boot.efi
vendored
BIN
projects/ATV/3rdparty/atvboot/boot.efi
vendored
Binary file not shown.
9
projects/ATV/3rdparty/atvboot/boot_linux.sh
vendored
9
projects/ATV/3rdparty/atvboot/boot_linux.sh
vendored
@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
echo "this is a boot_linux.sh script"
|
||||
#
|
||||
#
|
||||
#mkdir -p /tmp/rootfs
|
||||
#mount /dev/sda4 /tmp/rootfs
|
||||
#kexec --load /tmp/rootfs/vmlinux --initrd=/tmp/rootfs/initrd/gz --command-line="root=/dev/sda4 initrd=initrd.gz"
|
||||
#kexec -e
|
BIN
projects/ATV/3rdparty/atvboot/mach_kernel
vendored
BIN
projects/ATV/3rdparty/atvboot/mach_kernel
vendored
Binary file not shown.
7
projects/ATV/3rdparty/atvboot/patchstick.sh
vendored
7
projects/ATV/3rdparty/atvboot/patchstick.sh
vendored
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#
|
||||
echo "this is a patchstick stript"
|
||||
#
|
||||
#
|
||||
#
|
@ -277,7 +277,15 @@ IMAGE_NAME="$DISTRONAME-$TARGET_VERSION"
|
||||
tar cf $TARGET_IMG/$IMAGE_NAME.tar -C target $IMAGE_NAME
|
||||
|
||||
# create image files if requested
|
||||
if [ "$1" = "mkimage" -a -n "$BOOTLOADER" ]; then
|
||||
if [ "$1" = "mkimage" -a "$BOOTLOADER" = "atv-bootloader" ]; then
|
||||
# variables used in image script must be passed
|
||||
sudo env \
|
||||
ROOT="$ROOT" \
|
||||
RELEASE_DIR="$RELEASE_DIR" \
|
||||
TARGET_IMG="$TARGET_IMG" \
|
||||
IMAGE_NAME="$IMAGE_NAME" \
|
||||
$SCRIPTS/mkimage-atv
|
||||
elif [ "$1" = "mkimage" -a -n "$BOOTLOADER" ]; then
|
||||
if [ "$2" == "efi" ] ; then
|
||||
UEFI=yes
|
||||
fi
|
||||
|
114
scripts/mkimage-atv
Executable file
114
scripts/mkimage-atv
Executable file
@ -0,0 +1,114 @@
|
||||
#!/bin/sh -xv
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2014 Christian Hewitt (chewitt@openelec.tv)
|
||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# OpenELEC is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OpenELEC is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
################################################################################
|
||||
# variables such as $ROOT $PATH must be passed via env from scripts/image - the
|
||||
# mkimage-atv script also requires 'kpartx' to be installed.
|
||||
################################################################################
|
||||
|
||||
# set variables:
|
||||
OE_TMP=$(mktemp -d)
|
||||
VERBOSE="FALSE"
|
||||
IMGSIZE="200" # size of BOOT in MB
|
||||
IMGUSB="$IMAGE_NAME-usb.img"
|
||||
IMGHDD="$IMAGE_NAME-hdd.img"
|
||||
|
||||
# set verbose output on/off:
|
||||
if [ "${VERBOSE}" = "TRUE" ]; then
|
||||
exec 3>&1
|
||||
exec 4>&2
|
||||
else
|
||||
exec 3> /dev/null
|
||||
exec 4> /dev/null
|
||||
fi
|
||||
|
||||
# check for kpartx
|
||||
KPARTX=$(which kpartx)
|
||||
if [ -z "$KPARTX" ]; then
|
||||
echo "kpartx was not found, exiting!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# loop through image options
|
||||
for IMAGE in $IMGUSB $IMGHDD; do
|
||||
|
||||
# set the installer function
|
||||
IMGFILE="$IMAGE"
|
||||
if [ "$IMGFILE" = "$IMGUSB" ]; then
|
||||
FUNCTION="install-usb"
|
||||
else
|
||||
FUNCTION="install-hdd"
|
||||
fi
|
||||
|
||||
# create USB image
|
||||
echo "Creating $IMGFILE"
|
||||
|
||||
SYSTEM_PART_END=$(( $IMGSIZE * 1024 * 1024 / 512 - 40 ))
|
||||
|
||||
dd if=/dev/zero of=$IMGFILE bs=1M count=$IMGSIZE 1>&3 2>&4
|
||||
parted -s $IMGFILE mklabel gpt 1>&3 2>&4
|
||||
parted -s $IMGFILE -a min unit s mkpart primary HFS 40 $SYSTEM_PART_END 1>&3 2>&4
|
||||
parted -s $IMGFILE name 1 OPENELEC 1>&3 2>&4
|
||||
parted -s $IMGFILE set 1 atvrecv on 1>&3 2>&4
|
||||
kpartx -a $IMGFILE 1>&3 2>&4
|
||||
mkfs.hfsplus -s -v OPENELEC /dev/mapper/loop0p1 1>&3 2>&4
|
||||
fsck.hfsplus -f /dev/mapper/loop0p1 1>&3 2>&4
|
||||
|
||||
# mount the image file
|
||||
mount /dev/mapper/loop0p1 $OE_TMP 1>&3 2>&4
|
||||
|
||||
# copy recovery files
|
||||
cp -Rv $RELEASE_DIR/3rdparty/atvboot/* $OE_TMP 1>&3 2>&4
|
||||
echo $FUNCTION > $OE_TMP/function
|
||||
|
||||
# copy MACH_KERNEL/SYSTEM/.md5 files
|
||||
cp $RELEASE_DIR/target/* $OE_TMP
|
||||
|
||||
# unmount the image file
|
||||
sync 1>&3 2>&4
|
||||
sleep 2
|
||||
# umount $OE_TMP 1>&3 2>&4
|
||||
# rm -rf $OE_TMP 1>&3 2>&4
|
||||
|
||||
# sync everything up
|
||||
# echo y | gptsync /dev/loop0 1>&3 2>&4
|
||||
# sleep 2
|
||||
# kpartx -d $IMGFILE 1>&3 2>&4
|
||||
sync 1>&3 2>&4
|
||||
|
||||
# wait a bit
|
||||
sleep 2
|
||||
|
||||
# gzip the image file and move to target/
|
||||
# gzip $IMGFILE
|
||||
# IMGFILE="$IMGFILE.gz"
|
||||
|
||||
# change file owner to match target/
|
||||
# USR=$(ls -dl $ROOT/target | awk '{print $3}')
|
||||
# GRP=$(ls -dl $ROOT/target | awk '{print $4}')
|
||||
# chown $USR:$GRP $IMGFILE
|
||||
|
||||
# move to target/
|
||||
# mv $IMGFILE target/
|
||||
|
||||
# close the loop
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user