Merge branch 'master' of git://openelec.git.sourceforge.net/gitroot/openelec/openelec-installer

This commit is contained in:
Stephan Raue 2010-07-04 00:01:11 +02:00
commit 909d25f934
29 changed files with 1259 additions and 58 deletions

View File

@ -4,6 +4,7 @@ all: system
system: system:
./scripts/install image system ./scripts/install image system
./scripts/install image installer
release: release:
./scripts/install image release ./scripts/install image release

View File

@ -12,7 +12,7 @@ cd $PKG_BUILD/ncurses-host
make -C include make -C include
make -C progs tic make -C progs tic
cp -PR progs/tic $ROOT/$TOOLCHAIN/bin cp progs/tic $ROOT/$TOOLCHAIN/bin
cd "$CWD" cd "$CWD"
@ -83,3 +83,8 @@ $MAKEINSTALL -C form
cp $SYSROOT_PREFIX/usr/include/ncurses/curses.h \ cp $SYSROOT_PREFIX/usr/include/ncurses/curses.h \
$SYSROOT_PREFIX/usr/include/ncurses/term.h \ $SYSROOT_PREFIX/usr/include/ncurses/term.h \
$SYSROOT_PREFIX/usr/include/ $SYSROOT_PREFIX/usr/include/
cp misc/ncurses-config $ROOT/$TOOLCHAIN/bin
chmod +x $ROOT/$TOOLCHAIN/bin/ncurses-config
$SED "s:\(['=\" ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" \
$ROOT/$TOOLCHAIN/bin/ncurses-config

View File

@ -105,11 +105,6 @@ case "$2" in
[ "$TESTING" = yes ] && $SCRIPTS/install testing [ "$TESTING" = yes ] && $SCRIPTS/install testing
[ "$DEVTOOLS" = yes ] && $SCRIPTS/install debug [ "$DEVTOOLS" = yes ] && $SCRIPTS/install debug
# Devtools for Coreboot... (not for Release)
[ "$COREBOOT" = yes ] && $SCRIPTS/install superiotool
[ "$COREBOOT" = yes ] && $SCRIPTS/install flashrom
[ "$COREBOOT" = yes ] && $SCRIPTS/install getpir
# setting # setting
echo $TARGET_VERSION > $INSTALL/etc/release echo $TARGET_VERSION > $INSTALL/etc/release
@ -130,9 +125,67 @@ case "$2" in
rm -rf $FAKEROOT_SCRIPT rm -rf $FAKEROOT_SCRIPT
;; ;;
installer)
$SCRIPTS/install squashfs
export INSTALL=$BUILD/$1/$2
rm -rf $INSTALL
mkdir -p $INSTALL
mkdir -p $INSTALL/bin
mkdir -p $INSTALL/etc
mkdir -p $INSTALL/lib
mkdir -p $INSTALL/sbin
mkdir -p $INSTALL/dev
mkdir -p $INSTALL/proc
mkdir -p $INSTALL/sys
mkdir -p $INSTALL/usr
mkdir -p $INSTALL/var
mkdir -p $INSTALL/flash
mkdir -p $INSTALL/storage
ln -sf /var $INSTALL/usr/var
ln -sf /var/tmp $INSTALL/tmp
ln -sf /var/media $INSTALL/media
if [ $TARGET_ARCH = x86_64 ]; then
ln -s /lib $INSTALL/lib64
ln -s lib $INSTALL/usr/lib64
fi
# Basissystem...
$SCRIPTS/install eglibc
$SCRIPTS/install gcc-final
$SCRIPTS/install linux $2
$SCRIPTS/install busybox
$SCRIPTS/install installer
echo "OpenELEC" > $INSTALL/etc/distribution
echo "$PROJECT.$TARGET_ARCH" > $INSTALL/etc/arch
echo "$OPENELEC_VERSION" > $INSTALL/etc/version
echo "OpenELEC.tv - Date of build: $BUILD_DATE Build: $BZR_BUILD" > $INSTALL/etc/openelec-release
# setting
echo $TARGET_VERSION > $INSTALL/etc/release
# strip kernel modules
for MOD in `find $INSTALL/lib/modules/ -name *.ko`; do
$STRIP --strip-debug $MOD
done
mkdir -p $ROOT/target
rm -rf $ROOT/target/OpenELEC-$TARGET_VERSION.$2
# $ROOT/$TOOLCHAIN/bin/mksquashfs $INSTALL $ROOT/target/OpenELEC-$TARGET_VERSION.$2 -noappend -comp lzma
$ROOT/$TOOLCHAIN/bin/mksquashfs $INSTALL $ROOT/target/OpenELEC-$TARGET_VERSION.$2 -noappend
chmod 0644 $ROOT/target/OpenELEC-$TARGET_VERSION.$2
;;
release) release)
$SCRIPTS/install image system $SCRIPTS/install image system
$SCRIPTS/install image installer
# cleanup # cleanup
rm -rf $BUILD/$2/OpenELEC-$TARGET_VERSION rm -rf $BUILD/$2/OpenELEC-$TARGET_VERSION
@ -148,6 +201,7 @@ case "$2" in
mkdir -p $BUILD/$2/OpenELEC-$TARGET_VERSION/target mkdir -p $BUILD/$2/OpenELEC-$TARGET_VERSION/target
cp $ROOT/target/OpenELEC-$TARGET_VERSION.system $BUILD/$2/OpenELEC-$TARGET_VERSION/target/SYSTEM cp $ROOT/target/OpenELEC-$TARGET_VERSION.system $BUILD/$2/OpenELEC-$TARGET_VERSION/target/SYSTEM
cp $ROOT/target/OpenELEC-$TARGET_VERSION.kernel $BUILD/$2/OpenELEC-$TARGET_VERSION/target/KERNEL cp $ROOT/target/OpenELEC-$TARGET_VERSION.kernel $BUILD/$2/OpenELEC-$TARGET_VERSION/target/KERNEL
cp $ROOT/target/OpenELEC-$TARGET_VERSION.installator $BUILD/$2/OpenELEC-$TARGET_VERSION/target/INSTALLATOR
# create release directory # create release directory
mkdir -p $ROOT/target mkdir -p $ROOT/target

View File

@ -3,6 +3,7 @@
UPDATE_DIR=/storage/.update UPDATE_DIR=/storage/.update
IMAGE_SYSTEM="SYSTEM" IMAGE_SYSTEM="SYSTEM"
IMAGE_INSTALLER="INSTALLER"
IMAGE_KERNEL="KERNEL" IMAGE_KERNEL="KERNEL"
REBOOT=0 REBOOT=0
@ -16,8 +17,8 @@ REBOOT=0
debugging) debugging)
DEBUG=yes DEBUG=yes
;; ;;
splash) nosplash)
SPLASH=yes SPLASH=no
;; ;;
bootchart) bootchart)
BOOTCHART=yes BOOTCHART=yes
@ -25,9 +26,18 @@ REBOOT=0
fastboot) fastboot)
FASTBOOT=yes FASTBOOT=yes
;; ;;
installer)
INSTALLER=yes
;;
esac esac
done done
if [ ! "$INSTALLER" = "yes" ]; then
IMAGE="$IMAGE_SYSTEM"
else
IMAGE="$IMAGE_INSTALLER"
fi
if test "$FASTBOOT" = yes; then if test "$FASTBOOT" = yes; then
IONICE="/bin/busybox ionice -c 1 -n 0" IONICE="/bin/busybox ionice -c 1 -n 0"
fi fi
@ -39,7 +49,9 @@ REBOOT=0
} }
show_splash() { show_splash() {
if [ "$SPLASH" = yes ]; then if [ "$SPLASH" = no ]; then
break
else
if [ -f "/bin/ply-image" -a -f "/splash.png" ]; then if [ -f "/bin/ply-image" -a -f "/splash.png" ]; then
/bin/ply-image /splash.png /bin/ply-image /splash.png
fi fi
@ -80,18 +92,21 @@ REBOOT=0
show_splash show_splash
mount_part "$boot" "/flash" "ro,noatime" mount_part "$boot" "/flash" "ro,noatime"
mount_part "$disk" "/storage" "rw,noatime"
update "Kernel" "$IMAGE_KERNEL" "/flash/$IMAGE_KERNEL" if [ ! "$INSTALLER" = "yes" ]; then
update "System" "$IMAGE_SYSTEM" "/flash/$IMAGE_SYSTEM" mount_part "$disk" "/storage" "rw,noatime"
update "Kernel" "$IMAGE_KERNEL" "/flash/$IMAGE_KERNEL"
update "System" "$IMAGE_SYSTEM" "/flash/$IMAGE_SYSTEM"
update "Installer" "$IMAGE_INSTALLER" "/flash/$IMAGE_INSTALLER"
if test "$REBOOT" -eq 1; then if test "$REBOOT" -eq 1; then
echo "System reboots now..." && \ echo "System reboots now..." && \
/bin/busybox reboot /bin/busybox reboot
fi
fi fi
if [ -f "/flash/$IMAGE_SYSTEM" ]; then if [ -f "/flash/$IMAGE" ]; then
mount_part "/flash/$IMAGE_SYSTEM" "/sysroot" "loop" mount_part "/flash/$IMAGE" "/sysroot" "loop"
[ $ERR_ENV -ne 0 ] && debug_shell [ $ERR_ENV -ne 0 ] && debug_shell
else else
error "INIT_2" "Could not find system." error "INIT_2" "Could not find system."
@ -100,7 +115,10 @@ REBOOT=0
# move /flash and /storage to /sysroot # move /flash and /storage to /sysroot
/bin/busybox mount --move /flash /sysroot/flash /bin/busybox mount --move /flash /sysroot/flash
/bin/busybox mount --move /storage /sysroot/storage
if [ ! "$INSTALLER" = "yes" ]; then
/bin/busybox mount --move /storage /sysroot/storage
fi
# unmount all other filesystems # unmount all other filesystems
/bin/busybox umount /dev /bin/busybox umount /dev

View File

@ -1,22 +0,0 @@
#!/bin/sh
. config/options
$SCRIPTS/build toolchain
cd $PKG_BUILD
./configure --host=$TARGET_NAME \
--build=$HOST_NAME \
--prefix=/usr \
--disable-libuuid \
--disable-libblkid \
--disable-debugfs \
--disable-imager \
--disable-resizer \
--disable-uuidd \
make -C lib/et
make -C lib/ext2fs
$MAKEINSTALL -C lib/et
$MAKEINSTALL -C lib/ext2fs

View File

@ -1,17 +0,0 @@
#!/bin/sh
. config/options
mkdir -p $INSTALL/bin
cp $PKG_BUILD/mount/.libs/mount $INSTALL/bin
cp $PKG_BUILD/mount/.libs/umount $INSTALL/bin
mkdir -p $INSTALL/sbin
cp $PKG_BUILD/fdisk/sfdisk $INSTALL/sbin
cp $PKG_BUILD/misc-utils/.libs/blkid $INSTALL/sbin
mkdir -p $INSTALL/usr/lib
cp -PR $PKG_BUILD/shlibs/blkid/src/.libs/libblkid.so* $INSTALL/usr/lib
rm -rf $INSTALL/usr/lib/libblkid.so*T
cp -PR $PKG_BUILD/shlibs/uuid/src/.libs/libuuid.so* $INSTALL/usr/lib
rm -rf $INSTALL/usr/lib/libuuid.so*T

View File

@ -1 +0,0 @@
http://prdownloads.sourceforge.net/e2fsprogs/e2fsprogs-1.41.11.tar.gz

View File

@ -6,6 +6,7 @@ $SCRIPTS/install util-linux-ng
mkdir -p $INSTALL/usr/bin mkdir -p $INSTALL/usr/bin
cp $PKG_BUILD/parted/.libs/parted $INSTALL/usr/bin cp $PKG_BUILD/parted/.libs/parted $INSTALL/usr/bin
cp $PKG_BUILD/partprobe/.libs/partprobe $INSTALL/usr/bin
mkdir -p $INSTALL/usr/lib mkdir -p $INSTALL/usr/lib
cp -P $PKG_BUILD/libparted/.libs/*.so* $INSTALL/usr/lib cp -P $PKG_BUILD/libparted/.libs/*.so* $INSTALL/usr/lib

14
packages/tools/bc/build Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
. config/options
$SCRIPTS/build toolchain
cd $PKG_BUILD
./configure --host=$TARGET_NAME \
--build=$HOST_NAME \
--prefix=/usr \
--disable-nls \
make

6
packages/tools/bc/install Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
. config/options
mkdir -p $INSTALL/usr/bin
cp $PKG_BUILD/bc/bc $INSTALL/usr/bin

1
packages/tools/bc/url Normal file
View File

@ -0,0 +1 @@
ftp://ftp.gnu.org/gnu/bc/bc-1.06.tar.gz

25
packages/tools/dialog/build Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
. config/options
$SCRIPTS/build toolchain
$SCRIPTS/build ncurses
cd $PKG_BUILD
ac_cv_path_NCURSES_CONFIG="$ROOT/$TOOLCHAIN/bin/ncurses-config" \
./configure --host=$TARGET_NAME \
--build=$HOST_NAME \
--prefix=/usr \
--disable-nls \
--without-dbmalloc \
--without-dmalloc \
--with-ncurses \
--disable-widec \
--disable-rc-file \
--disable-Xdialog \
--disable-form \
--disable-mixedform \
--disable-tailbox \
make

8
packages/tools/dialog/install Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
. config/options
$SCRIPTS/install ncurses
mkdir -p $INSTALL/usr/bin
cp $PKG_BUILD/dialog $INSTALL/usr/bin

View File

@ -0,0 +1 @@
ftp://invisible-island.net/dialog/dialog-1.1-20100428.tgz

41
packages/tools/e2fsprogs/build Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
. config/options
$SCRIPTS/build toolchain
$SCRIPTS/build util-linux-ng
cd $PKG_BUILD
./configure --host=$TARGET_NAME \
--build=$HOST_NAME \
--prefix=/usr \
--sysconfdir=/etc \
--enable-static \
--disable-shared \
--enable-verbose-makecmds \
--enable-symlink-install \
--enable-symlink-build \
--disable-compression \
--disable-htree \
--enable-elf-shlibs \
--disable-bsd-shlibs \
--disable-profile \
--disable-jbd-debug \
--disable-blkid-debug \
--disable-testio-debug \
--disable-libuuid \
--disable-libblkid \
--disable-debugfs \
--disable-imager \
--disable-resizer \
--disable-fsck \
--disable-e2initrd-helper \
--enable-tls \
--disable-uuidd \
--disable-nls \
--disable-rpath \
--with-gnu-ld \
make

View File

@ -0,0 +1,20 @@
#!/bin/sh
. config/options
$SCRIPTS/install util-linux-ng
mkdir -p $INSTALL/etc
cp $PKG_BUILD/misc/mke2fs.conf $INSTALL/etc
mkdir -p $INSTALL/usr/sbin
cp $PKG_BUILD/misc/mke2fs $INSTALL/usr/sbin
cp $PKG_BUILD/misc/tune2fs $INSTALL/usr/sbin
cp $PKG_BUILD/e2fsck/e2fsck $INSTALL/usr/sbin
mkdir -p $INSTALL/usr/lib
cp -P $PKG_BUILD/lib/*.so.[0-9] $INSTALL/usr/lib
cp -P $PKG_BUILD/lib/e2p/libe2p.so.* $INSTALL/usr/lib
cp -P $PKG_BUILD/lib/et/libcom_err.so.* $INSTALL/usr/lib
cp -P $PKG_BUILD/lib/ext2fs/libext2fs.so.* $INSTALL/usr/lib
cp -P $PKG_BUILD/lib/ss/libss.so.* $INSTALL/usr/lib

View File

@ -0,0 +1 @@
http://downloads.sourceforge.net/project/e2fsprogs/e2fsprogs/1.41.12/e2fsprogs-1.41.12.tar.gz

11
packages/tools/flashrom/build Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
. config/options
$SCRIPTS/build toolchain
$SCRIPTS/build zlib
$SCRIPTS/build pciutils
cd $PKG_BUILD
$MAKE CC=$TARGET_CC STRIP=$STRIP

10
packages/tools/flashrom/install Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
. config/options
$SCRIPTS/install zlib
$SCRIPTS/install pciutils
$SCRIPTS/install dmidecode
mkdir -p $INSTALL/usr/bin
cp $PKG_BUILD/flashrom $INSTALL/usr/bin

View File

@ -0,0 +1,467 @@
diff -Naur flashrom-1061/bitbang_spi.c flashrom-1061.patch/bitbang_spi.c
--- flashrom-1061/bitbang_spi.c 2010-06-27 14:12:28.000000000 +0200
+++ flashrom-1061.patch/bitbang_spi.c 2010-06-27 14:16:51.108934759 +0200
@@ -26,17 +26,29 @@
#include "chipdrivers.h"
#include "spi.h"
-/* Length of half a clock period in usecs */
-int bitbang_spi_half_period = 0;
+/* Length of half a clock period in usecs. Default to 1 (500 kHz). */
+int bitbang_spi_half_period = 1;
enum bitbang_spi_master bitbang_spi_master = BITBANG_SPI_INVALID;
const struct bitbang_spi_master_entry bitbang_spi_master_table[] = {
+#if CONFIG_INTERNAL == 1
+#if defined(__i386__) || defined(__x86_64__)
+ {
+ .set_cs = mcp6x_bitbang_set_cs,
+ .set_sck = mcp6x_bitbang_set_sck,
+ .set_mosi = mcp6x_bitbang_set_mosi,
+ .get_miso = mcp6x_bitbang_get_miso,
+ },
+#endif
+#endif
+
{}, /* This entry corresponds to BITBANG_SPI_INVALID. */
};
const int bitbang_spi_master_count = ARRAY_SIZE(bitbang_spi_master_table);
+/* Note that CS# is active low, so val=0 means the chip is active. */
void bitbang_spi_set_cs(int val)
{
bitbang_spi_master_table[bitbang_spi_master].set_cs(val);
@@ -57,10 +69,18 @@
return bitbang_spi_master_table[bitbang_spi_master].get_miso();
}
-int bitbang_spi_init(void)
+int bitbang_spi_init(enum bitbang_spi_master master)
{
+ bitbang_spi_master = master;
+
+ if (bitbang_spi_master == BITBANG_SPI_INVALID) {
+ msg_perr("Invalid bitbang SPI master. \n"
+ "Please report a bug at flashrom@flashrom.org\n");
+ return 1;
+ }
bitbang_spi_set_cs(1);
bitbang_spi_set_sck(0);
+ bitbang_spi_set_mosi(0);
buses_supported = CHIP_BUSTYPE_SPI;
return 0;
}
@@ -87,6 +107,7 @@
{
static unsigned char *bufout = NULL;
static unsigned char *bufin = NULL;
+ unsigned char *tmp;
static int oldbufsize = 0;
int bufsize;
int i;
@@ -98,20 +119,34 @@
bufsize = max(writecnt + readcnt, 260);
/* Never shrink. realloc() calls are expensive. */
if (bufsize > oldbufsize) {
- bufout = realloc(bufout, bufsize);
- if (!bufout) {
+ tmp = realloc(bufout, bufsize);
+ if (!tmp) {
msg_perr("Out of memory!\n");
+ if (bufout)
+ free(bufout);
+ bufout = NULL;
if (bufin)
free(bufin);
+ bufin = NULL;
+ oldbufsize = 0;
exit(1);
- }
- bufin = realloc(bufout, bufsize);
- if (!bufin) {
+ } else
+ bufout = tmp;
+
+ tmp = realloc(bufin, bufsize);
+ if (!tmp) {
msg_perr("Out of memory!\n");
+ if (bufin)
+ free(bufin);
+ bufin = NULL;
if (bufout)
free(bufout);
+ bufout = NULL;
+ oldbufsize = 0;
exit(1);
- }
+ } else
+ bufin = tmp;
+
oldbufsize = bufsize;
}
@@ -135,8 +170,13 @@
int bitbang_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len)
{
- /* Maximum read length is unlimited, use 64k bytes. */
- return spi_read_chunked(flash, buf, start, len, 64 * 1024);
+ /* Maximum read length is unlimited in theory.
+ * The current implementation can handle reads of up to 65536 bytes.
+ * Please note that you need two buffers of 2n+4 bytes each for a read
+ * of n bytes, resulting in a total memory requirement of 4n+8 bytes.
+ * To conserve memory, read in chunks of 256 bytes.
+ */
+ return spi_read_chunked(flash, buf, start, len, 256);
}
int bitbang_spi_write_256(struct flashchip *flash, uint8_t *buf)
diff -Naur flashrom-1061/chipset_enable.c flashrom-1061.patch/chipset_enable.c
--- flashrom-1061/chipset_enable.c 2010-06-27 14:12:28.000000000 +0200
+++ flashrom-1061.patch/chipset_enable.c 2010-06-27 14:16:51.111932537 +0200
@@ -1092,10 +1092,8 @@
{
int ret = 0;
uint8_t val;
- uint16_t status;
char *busname;
- uint32_t mcp_spibaraddr;
- void *mcp_spibar;
+ uint32_t mcp6x_spibaraddr;
struct pci_dev *smbusdev;
msg_pinfo("This chipset is not really supported yet. Guesswork...\n");
@@ -1144,40 +1142,33 @@
smbusdev->bus, smbusdev->dev, smbusdev->func);
/* Locate the BAR where the SPI interface lives. */
- mcp_spibaraddr = pci_read_long(smbusdev, 0x74);
- msg_pdbg("SPI BAR is at 0x%08x, ", mcp_spibaraddr);
+ mcp6x_spibaraddr = pci_read_long(smbusdev, 0x74);
+ msg_pdbg("SPI BAR is at 0x%08x, ", mcp6x_spibaraddr);
/* We hope this has native alignment. We know the SPI interface (well,
* a set of GPIOs that is connected to SPI flash) is at offset 0x530,
* so we expect a size of at least 0x800. Clear the lower bits.
* It is entirely possible that the BAR is 64k big and the low bits are
* reserved for an entirely different purpose.
*/
- mcp_spibaraddr &= ~0x7ff;
- msg_pdbg("after clearing low bits BAR is at 0x%08x\n", mcp_spibaraddr);
+ mcp6x_spibaraddr &= ~0x7ff;
+ msg_pdbg("after clearing low bits BAR is at 0x%08x\n", mcp6x_spibaraddr);
/* Accessing a NULL pointer BAR is evil. Don't do it. */
- if (mcp_spibaraddr && (buses_supported == CHIP_BUSTYPE_SPI)) {
+ if (mcp6x_spibaraddr && (buses_supported == CHIP_BUSTYPE_SPI)) {
/* Map the BAR. Bytewise/wordwise access at 0x530 and 0x540. */
- mcp_spibar = physmap("MCP67 SPI", mcp_spibaraddr, 0x544);
+ mcp6x_spibar = physmap("Nvidia MCP6x SPI", mcp6x_spibaraddr, 0x544);
-/* Guessed. If this is correct, migrate to a separate MCP67 SPI driver. */
-#define MCP67_SPI_CS (1 << 1)
-#define MCP67_SPI_SCK (1 << 2)
-#define MCP67_SPI_MOSI (1 << 3)
-#define MCP67_SPI_MISO (1 << 4)
-#define MCP67_SPI_ENABLE (1 << 0)
-#define MCP67_SPI_IDLE (1 << 8)
-
- status = mmio_readw(mcp_spibar + 0x530);
- msg_pdbg("SPI control is 0x%04x, enable=%i, idle=%i\n",
- status, status & 0x1, (status >> 8) & 0x1);
+ if (mcp6x_spi_init())
+ ret = 1;
+#if 0
/* FIXME: Remove the physunmap once the SPI driver exists. */
- physunmap(mcp_spibar, 0x544);
- } else if (!mcp_spibaraddr && (buses_supported & CHIP_BUSTYPE_SPI)) {
+ physunmap(mcp6x_spibar, 0x544);
+#endif
+ } else if (!mcp6x_spibaraddr && (buses_supported & CHIP_BUSTYPE_SPI)) {
msg_pdbg("Strange. MCP SPI BAR is invalid.\n");
buses_supported &= ~CHIP_BUSTYPE_SPI;
ret = 1;
- } else if (mcp_spibaraddr && !(buses_supported & CHIP_BUSTYPE_SPI)) {
+ } else if (mcp6x_spibaraddr && !(buses_supported & CHIP_BUSTYPE_SPI)) {
msg_pdbg("Strange. MCP SPI BAR is valid, but chipset apparently"
" doesn't have SPI enabled.\n");
} else {
@@ -1215,8 +1206,7 @@
result = enable_flash_mcp55(dev, name);
break;
case CHIP_BUSTYPE_SPI:
- msg_pinfo("SPI on this chipset is not supported yet.\n");
- buses_supported = CHIP_BUSTYPE_NONE;
+ msg_perr("SPI on this chipset is WIP. DO NOT USE!\n");
break;
default:
msg_pinfo("Something went wrong with bus type detection.\n");
@@ -1241,8 +1231,7 @@
msg_pinfo("LPC on this chipset is not supported yet.\n");
break;
case CHIP_BUSTYPE_SPI:
- msg_pinfo("SPI on this chipset is not supported yet.\n");
- buses_supported = CHIP_BUSTYPE_NONE;
+ msg_perr("SPI on this chipset is WIP. DO NOT USE!\n");
break;
default:
msg_pinfo("Something went wrong with bus type detection.\n");
diff -Naur flashrom-1061/flash.h flashrom-1061.patch/flash.h
--- flashrom-1061/flash.h 2010-06-27 14:12:28.000000000 +0200
+++ flashrom-1061.patch/flash.h 2010-06-27 14:16:51.102937596 +0200
@@ -128,13 +128,16 @@
void programmer_delay(int usecs);
enum bitbang_spi_master {
+#if CONFIG_INTERNAL == 1
+#if defined(__i386__) || defined(__x86_64__)
+ BITBANG_SPI_MASTER_MCP,
+#endif
+#endif
BITBANG_SPI_INVALID /* This must always be the last entry. */
};
extern const int bitbang_spi_master_count;
-extern enum bitbang_spi_master bitbang_spi_master;
-
struct bitbang_spi_master_entry {
void (*set_cs) (int val);
void (*set_sck) (int val);
@@ -530,10 +533,22 @@
int ft2232_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
int ft2232_spi_write_256(struct flashchip *flash, uint8_t *buf);
+/* mcp6x_spi.c */
+#if CONFIG_INTERNAL == 1
+#if defined(__i386__) || defined(__x86_64__)
+extern void *mcp6x_spibar;
+int mcp6x_spi_init(void);
+void mcp6x_bitbang_set_cs(int val);
+void mcp6x_bitbang_set_sck(int val);
+void mcp6x_bitbang_set_mosi(int val);
+int mcp6x_bitbang_get_miso(void);
+#endif
+#endif
+
/* bitbang_spi.c */
extern int bitbang_spi_half_period;
extern const struct bitbang_spi_master_entry bitbang_spi_master_table[];
-int bitbang_spi_init(void);
+int bitbang_spi_init(enum bitbang_spi_master master);
int bitbang_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
int bitbang_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
int bitbang_spi_write_256(struct flashchip *flash, uint8_t *buf);
@@ -636,6 +651,7 @@
SPI_CONTROLLER_SB600,
SPI_CONTROLLER_VIA,
SPI_CONTROLLER_WBSIO,
+ SPI_CONTROLLER_MCP6X_BITBANG,
#endif
#endif
#if CONFIG_FT2232_SPI == 1
diff -Naur flashrom-1061/hwaccess.h flashrom-1061.patch/hwaccess.h
--- flashrom-1061/hwaccess.h 2010-06-27 14:12:28.000000000 +0200
+++ flashrom-1061.patch/hwaccess.h 2010-06-27 14:16:51.106934727 +0200
@@ -176,6 +176,10 @@
#define __DARWIN__
#endif
+/* Clarification about OUTB/OUTW/OUTL argument order:
+ * OUT[BWL](val, port)
+ */
+
#if defined(__FreeBSD__) || defined(__DragonFly__)
#include <machine/cpufunc.h>
#define off64_t off_t
diff -Naur flashrom-1061/Makefile flashrom-1061.patch/Makefile
--- flashrom-1061/Makefile 2010-06-27 14:12:28.000000000 +0200
+++ flashrom-1061.patch/Makefile 2010-06-27 14:16:51.110933115 +0200
@@ -107,8 +107,12 @@
# Always enable serprog for now. Needs to be disabled on Windows.
CONFIG_SERPROG ?= yes
-# Bitbanging SPI infrastructure is not used yet.
+# Bitbanging SPI infrastructure, default off unless needed.
+ifeq ($(CONFIG_INTERNAL), yes)
+CONFIG_BITBANG_SPI = yes
+else
CONFIG_BITBANG_SPI ?= no
+endif
# Always enable 3Com NICs for now.
CONFIG_NIC3COM ?= yes
@@ -151,7 +155,7 @@
FEATURE_CFLAGS += -D'CONFIG_INTERNAL=1'
PROGRAMMER_OBJS += processor_enable.o chipset_enable.o board_enable.o cbtable.o dmi.o internal.o
# FIXME: The PROGRAMMER_OBJS below should only be included on x86.
-PROGRAMMER_OBJS += it87spi.o ichspi.o sb600spi.o wbsio_spi.o
+PROGRAMMER_OBJS += it87spi.o ichspi.o sb600spi.o wbsio_spi.o mcp6x_spi.o
NEED_PCI := yes
endif
diff -Naur flashrom-1061/mcp6x_spi.c flashrom-1061.patch/mcp6x_spi.c
--- flashrom-1061/mcp6x_spi.c 1970-01-01 01:00:00.000000000 +0100
+++ flashrom-1061.patch/mcp6x_spi.c 2010-06-27 14:16:51.112932658 +0200
@@ -0,0 +1,132 @@
+/*
+ * This file is part of the flashrom project.
+ *
+ * Copyright (C) 2010 Carl-Daniel Hailfinger
+ *
+ * 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; version 2 of the License.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* Driver for the Nvidia MCP6x/MCP7x MCP6X_SPI controller.
+ * Based on clean room reverse engineered docs from
+ * http://www.flashrom.org/pipermail/flashrom/2009-December/001180.html
+ * created by Michael Karcher.
+ */
+
+#if defined(__i386__) || defined(__x86_64__)
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include "flash.h"
+
+/* We have two sets of pins, out and in. The numbers for both sets are
+ * independent and are bitshift values, not real pin numbers.
+ */
+
+/* Guessed. */
+#define MCP6X_SPI_CS 1
+#define MCP6X_SPI_SCK 2
+#define MCP6X_SPI_MOSI 3
+#define MCP6X_SPI_MISO 4
+#define MCP6X_SPI_ENABLE 0
+#define MCP6X_SPI_IDLE 8
+
+void *mcp6x_spibar = NULL;
+
+void mcp6x_request_spibus(void)
+{
+ uint8_t byte;
+
+ byte = mmio_readb(mcp6x_spibar + 0x530);
+ byte |= 1 << MCP6X_SPI_ENABLE;
+ mmio_writeb(byte, mcp6x_spibar + 0x530);
+
+ /* Wait until we are allowed to use the SPI bus. */
+ while (!(mmio_readw(mcp6x_spibar + 0x530) & (1 << MCP6X_SPI_IDLE))) ;
+}
+
+void mcp6x_release_spibus(void)
+{
+ uint8_t byte;
+
+ byte = mmio_readb(mcp6x_spibar + 0x530);
+ byte &= ~(1 << MCP6X_SPI_ENABLE);
+ mmio_writeb(byte, mcp6x_spibar + 0x530);
+}
+
+void mcp6x_bitbang_set_cs(int val)
+{
+ uint8_t byte;
+
+ /* Requesting and releasing the SPI bus is handled in here to allow the
+ * chipset to use its own SPI engine for native reads.
+ */
+ if (val == 0)
+ mcp6x_request_spibus();
+
+ byte = mmio_readb(mcp6x_spibar + 0x530);
+ byte &= ~(1 << MCP6X_SPI_CS);
+ byte |= (val << MCP6X_SPI_CS);
+ mmio_writeb(byte, mcp6x_spibar + 0x530);
+
+ if (val == 1)
+ mcp6x_release_spibus();
+}
+
+void mcp6x_bitbang_set_sck(int val)
+{
+ uint8_t byte;
+
+ byte = mmio_readb(mcp6x_spibar + 0x530);
+ byte &= ~(1 << MCP6X_SPI_SCK);
+ byte |= (val << MCP6X_SPI_SCK);
+ mmio_writeb(byte, mcp6x_spibar + 0x530);
+}
+
+void mcp6x_bitbang_set_mosi(int val)
+{
+ uint8_t byte;
+
+ byte = mmio_readb(mcp6x_spibar + 0x530);
+ byte &= ~(1 << MCP6X_SPI_MOSI);
+ byte |= (val << MCP6X_SPI_MOSI);
+ mmio_writeb(byte, mcp6x_spibar + 0x530);
+}
+
+int mcp6x_bitbang_get_miso(void)
+{
+ uint8_t byte;
+
+ byte = mmio_readb(mcp6x_spibar + 0x530);
+ byte = (byte >> MCP6X_SPI_MISO) & 0x1;
+ return byte;
+}
+
+int mcp6x_spi_init(void)
+{
+ uint16_t status;
+
+ status = mmio_readw(mcp6x_spibar + 0x530);
+ msg_pdbg("SPI control is 0x%04x, enable=%i, idle=%i\n",
+ status, (status >> MCP6X_SPI_ENABLE) & 0x1,
+ (status >> MCP6X_SPI_IDLE) & 0x1);
+
+ if (bitbang_spi_init(BITBANG_SPI_MASTER_MCP))
+ return 1;
+ spi_controller = SPI_CONTROLLER_MCP6X_BITBANG;
+
+ return 0;
+}
+
+#endif
diff -Naur flashrom-1061/spi25.c flashrom-1061.patch/spi25.c
--- flashrom-1061/spi25.c 2010-06-27 14:12:28.000000000 +0200
+++ flashrom-1061.patch/spi25.c 2010-06-27 14:18:30.952808392 +0200
@@ -182,6 +182,7 @@
#if defined(__i386__) || defined(__x86_64__)
case SPI_CONTROLLER_IT87XX:
case SPI_CONTROLLER_WBSIO:
+ case SPI_CONTROLLER_MCP6X_BITBANG:
msg_cinfo("4 byte RDID not supported on this SPI controller\n");
return 0;
break;
diff -Naur flashrom-1061/spi.c flashrom-1061.patch/spi.c
--- flashrom-1061/spi.c 2010-06-27 14:12:28.000000000 +0200
+++ flashrom-1061.patch/spi.c 2010-06-27 14:16:51.109934600 +0200
@@ -83,6 +83,13 @@
.read = wbsio_spi_read,
.write_256 = wbsio_spi_write_1,
},
+
+ { /* SPI_CONTROLLER_MCP6X_BITBANG */
+ .command = bitbang_spi_send_command,
+ .multicommand = default_spi_send_multicommand,
+ .read = bitbang_spi_read,
+ .write_256 = bitbang_spi_write_256,
+ },
#endif
#endif

View File

@ -0,0 +1 @@
http://sources.openelec.tv/svn/flashrom-1061.tar.bz2

View File

@ -0,0 +1,34 @@
#!/bin/sh
################################################################################
# Copyright (C) 2009-2010 OpenELEC.tv
# http://www.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, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
# starting Installer
#
# runlevels: openelec
. /etc/profile
progress "starting Installer"
while true; do
/usr/bin/installer
sync && poweroff
done

View File

@ -0,0 +1,17 @@
#!/bin/sh
. config/options
$SCRIPTS/install bash
$SCRIPTS/install bc
$SCRIPTS/install dialog
$SCRIPTS/install parted
$SCRIPTS/install e2fsprogs
$SCRIPTS/install syslinux
$SCRIPTS/install flashrom
PKG_DIR=`find $PACKAGES -type d -name $1`
mkdir -p $INSTALL/usr/bin
cp $PKG_DIR/scripts/installer $INSTALL/usr/bin

View File

@ -0,0 +1,444 @@
#!/bin/sh
################################################################################
# Copyright (C) 2009-2010 OpenELEC.tv
# http://www.openelec.tv
#
# This file is part of OpenELEC.tv Mediacenter OS
#
# 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, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
# some DOCs:
# list devices:
# cat /proc/partitions | sed -n "s/\ *[0-9][0-9]*\ *[0-9][0-9]*\ *[0-9][0-9]*\ \([a-z]*\)$/\1/p"
# list all partitionnumbers from /dev/sda:
# parted -m /dev/sda print |grep -v ^/dev |grep -v ^BYT | cut -f1 -d ":"
# list device data from /dev/sda:
# parted -m /dev/sda print |grep /dev/sda
# list mounted partitions:
# mount |grep ^/dev
# list modelnumber:
# parted -m /dev/sda print |grep /dev/sda | cut -f7 -d ":" | sed "s/;//"
# list size:
# parted -m /dev/sda print |grep /dev/sda | cut -f2 -d ":"
# exclude mounted partitions
# for i in `cat /proc/mounts | grep ^/dev/ | cut -f1 -d " " | sed "s/[0-9]//"`; do TEST="$TEST `echo "| grep -v $i"`"; done
# Interpret embedded "\Z" sequences in the dialog text by the following
# character, which tells dialog to set colors or video attributes: 0 through 7
# are the ANSI used in curses: black, red, green, yellow, blue, magenta, cyan
# and white respectively. Bold is set by 'b', reset by 'B'. Reverse is set
# by 'r', reset by 'R'. Underline is set by 'u', reset by 'U'. The settings are
# cumulative, e.g., "\Zb\Z1" makes the following text bold (perhaps bright)
# red. Restore normal settings with "\Zn".
function dbglg() {
# Acts just like echo cmd, with automatic redirection
echo "" >> $LOGFILE
echo "###################################################################" >> $LOGFILE
echo "# $@" >> $LOGFILE
echo "###################################################################" >> $LOGFILE
echo "" >> $LOGFILE
}
function get_device_unmount() {
# get all unmounted devices
# usage: get_devices_unmount
# uses: -
# provides: DEVICES
DEVICES=""
DEVICES=$(parted -m -l | grep ^/dev/sd | cut -f1 -d ":")
for i in $(cat /proc/mounts | grep ^/dev/sd | cut -f1 -d " " | sed "s/[0-9]//"); do
DEVICES=$(echo $DEVICES |sed -e "s|$i||")
done
}
function get_partition() {
# get all partitions of an specifed device
# usage: get_partitions /dev/sda
# uses: -
# provides: PARTITIONS
PARTITIONS=$(parted -m $1 print |grep -v ^/dev |grep -v BYT | cut -f1 -d ":")
}
function create_device_list() {
# create devices list for menu
# usage: create_devices_list
# uses: get_device_unmount
# provides: DEVICE_MODEL, DEVICE_SIZE, DEVICE_LIST, DEVICE_NAME,
# DEVICES (get_device_unmount)
DEVICE_MODEL=""
DEVICE_SIZE=""
DEVICE_LIST=""
DEVICE_NAME=""
get_device_unmount
if [ "$DEVICES" = "" ]; then
msg_no_device
fi
for i in $DEVICES; do
DEVICE_MODEL=$(parted $i -m print | grep ^$i | cut -f7 -d ":" | sed "s/;//")
DEVICE_SIZE=$(parted $i -m print | grep ^$i | cut -f2 -d ":")
DEVICE_NAME=`echo $DEVICE_MODEL ${DEVICE_SIZE} | sed 's/ /_/g'`
DEVICE_LIST="$DEVICE_LIST $i $DEVICE_NAME"
done
}
function create_partition_list() {
# get an overview of all partitions of an specifed device
# usage: get_partition_list /dev/sda
# uses: get_partition
# provides: PARTITION_NUMBER, PARTITION_SIZE, PARTITION_FORMAT,
# PARTITION_LIST, PARTITIONS (get_partition)
PARTITION_NUMBER=""
PARTITION_SIZE=""
PARTITION_FORMAT=""
PARTITION_LIST=""
get_partition $1
for partition in $PARTITIONS; do
PARTITION_NUMBER=$(parted -m $1 print |grep -v ^/dev |grep -v BYT | cut -f1 -d ":")
PARTITION_SIZE=$(parted -m $1 print |grep -v ^/dev |grep -v BYT | cut -f4 -d ":")
PARTITION_FORMAT=$(parted -m $1 print |grep -v ^/dev |grep -v BYT | cut -f5 -d ":")
PARTITION_LIST=" $PARTITION_LIST \n Partition $1$PARTITION_NUMBER Size: $PARTITION_SIZE Format: $PARTITION_FORMAT"
done
}
function do_install_mbr() {
# show menu
MSG_TITLE="\Z4[ (RE)INSTALL MBR ]\Zn"
MSG_MENU="\n Please select the Device to install MBR\n\n Please choose an item:"
MSG_CANCEL="Back"
create_device_list
dialog --colors --backtitle "$BACKTITLE" --cancel-label "$MSG_CANCEL" \
--title "$MSG_TITLE" --menu "$MSG_MENU" 20 50 5 \
$DEVICE_LIST 2> $TMPDIR/device_for_install
# now we must do anything
case $? in
0)
INSTALL_DEVICE=$(< "$TMPDIR/device_for_install" )
# installing mbr
cat /usr/share/syslinux/mbr.bin > $INSTALL_DEVICE
msg_install_ready "Master Boot Record installed on $INSTALL_DEVICE"
;;
1)
menu_main
;;
255)
echo 255
;;
esac
}
function do_install_quick() {
# show menu
MSG_TITLE="\Z4[ QUICK INSTALL MENU ]\Zn"
MSG_MENU="\n You can use the UP/DOWN arrow keys,\n the No. of the choice as a hot key,\n to choose an option.\n\n Please choose an item:"
MSG_CANCEL="Back"
create_device_list
dialog --colors --backtitle "$BACKTITLE" --cancel-label "$MSG_CANCEL" \
--title "$MSG_TITLE" --menu "$MSG_MENU" 20 50 5 \
$DEVICE_LIST 2> $TMPDIR/device_for_install
# now we must do anything
case $? in
0)
INSTALL_DEVICE=$(< "$TMPDIR/device_for_install" )
# remove all partitions
msg_progress_install "1" "get all partitions $INSTALL_DEVICE"
get_partition $INSTALL_DEVICE
for i in $PARTITIONS; do
msg_progress_install "5" "remove partition $1 from $INSTALL_DEVICE"
parted -s $INSTALL_DEVICE rm $i >> $LOGFILE 2>&1
done
# create 2 new partitions (first $PARTSIZE_SYSTEM, second rest)
PARTFIRST_SYSTEM=$(echo 0.1)
PARTLAST_SYSTEM=$(echo $PARTSIZE_SYSTEM - 0.1 | bc)
PARTFIRST_STORAGE=$(echo $PARTLAST_SYSTEM + 0.1 | bc)
PARTLAST_STORAGE=$(echo -0)
msg_progress_install "10" "creating partition on $INSTALL_DEVICE from $PARTFIRST_SYSTEM to $PARTLAST_SYSTEM"
parted -s $INSTALL_DEVICE mkpart primary ext2 -- $PARTFIRST_SYSTEM $PARTLAST_SYSTEM >> $LOGFILE 2>&1
msg_progress_install "13" "creating partition on $INSTALL_DEVICE from $PARTFIRST_STORAGE to $PARTLAST_STORAGE"
parted -s $INSTALL_DEVICE mkpart primary ext2 -- $PARTFIRST_STORAGE $PARTLAST_STORAGE >> $LOGFILE 2>&1
msg_progress_install "16" "setup bootflag on partition 1 of $INSTALL_DEVICE"
parted -s $INSTALL_DEVICE set 1 boot on >> $LOGFILE 2>&1
msg_progress_install "20" "tell kernel we have a new partitiontable on $INSTALL_DEVICE"
partprobe $INSTALL_DEVICE >> $LOGFILE 2>&1
# create filesystem
msg_progress_install "23" "creating filesystem on ${INSTALL_DEVICE}1"
mke2fs -t ext3 ${INSTALL_DEVICE}1 >> $LOGFILE 2>&1
msg_progress_install "25" "set uuid and disklabel $DISKLABEL_SYSTEM on ${INSTALL_DEVICE}1"
tune2fs -U random -L $DISKLABEL_SYSTEM ${INSTALL_DEVICE}1 >> $LOGFILE 2>&1
msg_progress_install "28" "creating filesystem on ${INSTALL_DEVICE}2"
mke2fs -t ext3 ${INSTALL_DEVICE}2 >> $LOGFILE 2>&1
msg_progress_install "30" "set uuid and disklabel $DISKLABEL_STORAGE on ${INSTALL_DEVICE}2"
tune2fs -U random -L $DISKLABEL_STORAGE ${INSTALL_DEVICE}2 >> $LOGFILE 2>&1
# mount system partition
msg_progress_install "35" "creating $TMPDIR/part1"
mkdir -p $TMPDIR/part1 >> $LOGFILE 2>&1
msg_progress_install "40" "mounting ${INSTALL_DEVICE}1 to $TMPDIR/part1"
mount ${INSTALL_DEVICE}1 $TMPDIR/part1 >> $LOGFILE 2>&1
# installing extlinux
msg_progress_install "50" "installing extlinux to $TMPDIR/part1"
extlinux -i $TMPDIR/part1 >> $LOGFILE 2>&1
# installing MBR
msg_progress_install "55" "installing MBR to $INSTALL_DEVICE"
cat /usr/share/syslinux/mbr.bin > $INSTALL_DEVICE
# install system files
msg_progress_install "70" "installing Kernel"
cp /flash/KERNEL $TMPDIR/part1 >> $LOGFILE 2>&1
msg_progress_install "75" "installing System"
cp /flash/SYSTEM $TMPDIR/part1 >> $LOGFILE 2>&1
sync
# configuring bootloader
msg_progress_install "90" "setup bootloader with boot label = $DISKLABEL_SYSTEM and disk label = $DISKLABEL_STORAGE"
echo "DEFAULT linux" > $TMPDIR/part1/extlinux.conf
echo "PROMPT 0" >> $TMPDIR/part1/extlinux.conf
echo " " >> $TMPDIR/part1/extlinux.conf
echo "LABEL linux" >> $TMPDIR/part1/extlinux.conf
echo " KERNEL /KERNEL" >> $TMPDIR/part1/extlinux.conf
echo " APPEND boot=LABEL=$DISKLABEL_SYSTEM disk=LABEL=$DISKLABEL_STORAGE quiet" >> $TMPDIR/part1/extlinux.conf
sync
# umount system partition, remove mountpoint
msg_progress_install "95" "unmount $TMPDIR/part1"
umount $TMPDIR/part1 >> $LOGFILE 2>&1
msg_progress_install "100" "remove $TMPDIR/part1"
rmdir $TMPDIR/part1 >> $LOGFILE 2>&1
menu_main
;;
1)
menu_main
;;
255)
echo 255
;;
esac
}
function msg_not_implemented() {
# show an dialog that this function is not yet implemented
MSG_TITLE="\Z2[ WORK IN PROGRESS ]\Zn"
MSG_INFOBOX=" This function is not yet implemented \n stay tuned!!!"
dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 7 70
}
function msg_warning_beta() {
# show an warning dialog if we use beta software
MSG_TITLE="\Z1[ BETA WARNING ]\Zn"
MSG_INFOBOX=" This installer is Beta \n use it on your own risk!!! \n Please make first an backup !"
dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 7 70
}
function msg_no_device() {
# show an warning dialog if we dont find not mounted devices for install and return to main menu
MSG_TITLE="\Z1[ INFORMATION ]\Zn"
MSG_INFOBOX=" Not found any devices to install. \n be sure you have connected your device via USB or (e)SATA. \n Please try again !"
dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 7 70
menu_main
}
function msg_install_ready() {
# show an dialog that we have installed
MSG_TITLE="\Z1[ INFORMATION ]\Zn"
dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox " $1" 7 70
menu_main
}
function msg_progress_install() {
# show the progress dialog
MSG_TITLE="\Z1[ INSTALLING ]\Zn"
dbglg "$2"
dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --gauge "$2 ..." 6 70 $1 &
}
function menu_main() {
# show the mainmenu
MSG_TITLE="\Z4[ MAIN MENU ]\Zn"
MSG_MENU="\n\ZbQuick Install:\Zn do an default installation on an specific devices, \
\Z1\Zb(this will delete all your data on this device)\Zn \
\n\ZbCustom Install:\Zn do an custom installation \
\n\ZbSetup:\Zn change some settings to run OpenELEC.tv \
\n\ZbBIOS Update:\Zn backup and update your BIOS (only for OEMs) \
\n\ZbShow logfile:\Zn show and save the logfile \
\n \
\nPlease select:"
MSG_CANCEL="Reboot"
dialog --colors --backtitle "$BACKTITLE" --cancel-label "$MSG_CANCEL" \
--title "$MSG_TITLE" --menu "$MSG_MENU" 25 70 8 \
1 "Quick Install OpenELEC.tv" \
2 "Custom Install OpenELEC.tv" \
3 "Setup OpenELEC.tv" \
4 "BIOS update (only for OEM's)" \
5 "Show logfile" 2> $TMPDIR/mainmenu
case $? in
0)
ITEM_MAINMENU=$(< "$TMPDIR/mainmenu" )
case $ITEM_MAINMENU in
1) do_install_quick; break;;
2) menu_custom; break;;
3) menu_setup; break;;
4) menu_bios; break;;
5) logfile_show; break;;
esac;;
1)
do_reboot;;
255)
echo 255;;
esac
}
function menu_setup() {
# TODO: show the setupmenu
msg_not_implemented
menu_main
}
function menu_bios() {
# show the biosmenu
MSG_TITLE="\Z4[ BIOS MENU ]\Zn"
MSG_MENU="\n You can use the UP/DOWN arrow keys,\n the No. of the choice as a hot key,\n to choose an option.\n\n Please choose an item:"
MSG_CANCEL="Back"
dialog --colors --backtitle "$BACKTITLE" --cancel-label "$MSG_CANCEL" \
--title "$MSG_TITLE" --menu "$MSG_MENU" 25 70 5 \
1 "Backup installed BIOS" \
2 "Update BIOS" 2> $TMPDIR/biosmenu
case $? in
0)
ITEM_BIOSMENU=$(< "$TMPDIR/biosmenu" )
case $ITEM_BIOSMENU in
1) bios_backup; break;;
2) bios_update; break;;
esac;;
1)
menu_main;;
255)
echo 255;;
esac
}
function menu_custom() {
# TODO: show the installmenu
msg_not_implemented
menu_main
}
function bios_backup() {
# TODO: create an backup from installed bios
msg_not_implemented
menu_bios
}
function bios_update() {
# TODO: update the bios
msg_not_implemented
menu_bios
}
function logfile_show() {
# TODO: show the logfile
msg_not_implemented
menu_main
}
function do_reboot() {
# reboot on request
clear
sync
reboot
}
# setup needed variables
TMPDIR="/tmp/installer"
BETA="yes"
VERSION="0.1.0"
BACKTITLE="OpenELEC.tv Installer $VERSION"
DISKLABEL_SYSTEM="System"
DISKLABEL_STORAGE="Storage"
PARTSIZE_SYSTEM="128" # Defaultsize of system partition
LOGFILE="$TMPDIR/install.log"
# prepare temporary directory
rm -rf $TMPDIR
mkdir -p $TMPDIR
# main
[ $BETA = "yes" ] && msg_warning_beta
while true; do
menu_main
done
# exit cleanly
exit 0

View File

@ -0,0 +1,2 @@
i386
x86_64

24
packages/tools/syslinux/build Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
. config/options
$SCRIPTS/build toolchain
# ensure we dont use size optimization.
CFLAGS=`echo $CFLAGS | sed -e "s|-Os|-O2|"`
CXXFLAGS=`echo $CXXFLAGS | sed -e "s|-Os|-O2|"`
CFLAGS="$CFLAGS -I`ls -d $ROOT/$BUILD/$1*`/libinstaller"
CFLAGS="$CFLAGS -I`ls -d $ROOT/$BUILD/$1*`/libfat"
SUBDIRS="codepage core libinstaller mtools"
[ $TARGET_ARCH = i386 ] && SUBDIRS="$SUBDIRS mbr"
cd $PKG_BUILD
make CC=$CC \
AR=$AR \
RANLIB=$RANLIB \
LDFLAGS="$LDFLAGS" \
CFLAGS="$CFLAGS -fomit-frame-pointer -D_FILE_OFFSET_BITS=64" \
BSUBDIRS="$SUBDIRS"

11
packages/tools/syslinux/install Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
. config/options
mkdir -p $INSTALL/usr/bin
cp $PKG_BUILD/extlinux/extlinux $INSTALL/usr/bin
cp $PKG_BUILD/linux/syslinux $INSTALL/usr/bin
mkdir -p $INSTALL/usr/share/syslinux
cp $PKG_BUILD/core/isolinux.bin $INSTALL/usr/share/syslinux
cp $PKG_BUILD/mbr/mbr.bin $INSTALL/usr/share/syslinux

View File

@ -0,0 +1 @@
http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-4.01.tar.bz2

23
tools/mkpkg/mkpkg_flashrom Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
echo "getting sources..."
svn co svn://coreboot.org/flashrom/trunk flashrom-latest
echo "getting version..."
cd flashrom-latest
SVN_REV=`LANG=C svn info 2>/dev/null | grep Revision: | sed -e 's/.*\: //'`
echo $SVN_REV
cd ..
echo "copying sources..."
rm -rf flashrom-$SVN_REV
cp -R flashrom-latest flashrom-$SVN_REV
echo "cleaning sources..."
find flashrom-$SVN_REV -name .svn -exec rm -rf {} ";"
echo "packing sources..."
tar cvjf flashrom-$SVN_REV.tar.bz2 flashrom-$SVN_REV
echo "remove temporary sourcedir..."
rm -rf flashrom-$SVN_REV