summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mk/host-bottom.mk9
-rw-r--r--mk/perl.mk13
-rw-r--r--mk/pkg-bottom.mk2
-rw-r--r--package/alsa-lib/Makefile4
-rw-r--r--package/logitechmediaserver/Makefile2
-rw-r--r--package/mpdbox/Makefile6
-rw-r--r--package/p5-audio-scan/Makefile2
-rw-r--r--package/p5-dbd-sqlite/Makefile4
-rw-r--r--package/p5-dbi/Makefile9
-rw-r--r--package/perl/Makefile17
-rw-r--r--package/squeezelite/Makefile8
-rwxr-xr-xscripts/install.sh441
-rw-r--r--target/arm/Makefile9
-rw-r--r--target/arm/kernel/raspberry-pi2
-rw-r--r--target/config/Config.in.runtime1
-rw-r--r--target/config/Config.in.target3
16 files changed, 386 insertions, 146 deletions
diff --git a/mk/host-bottom.mk b/mk/host-bottom.mk
index 0a3add597..11c2aae26 100644
--- a/mk/host-bottom.mk
+++ b/mk/host-bottom.mk
@@ -67,6 +67,15 @@ endif
ifeq (${HOST_STYLE},manual)
${MAKE} host-configure $(MAKE_TRACE)
endif
+ifeq (${HOST_STYLE},perl)
+ @$(CMD_TRACE) "configuring perl module... "
+ cd ${WRKBUILD}; \
+ PATH='${HOST_PATH}' \
+ PERL_MM_USE_DEFAULT=1 \
+ PERL_AUTOINSTALL=--skipdeps \
+ $(HOST_PERL_ENV) \
+ perl-host Makefile.PL ${HOST_CONFIGURE_ARGS}
+endif
touch $@
host-build:
diff --git a/mk/perl.mk b/mk/perl.mk
index a874a0b76..f4f6fcc66 100644
--- a/mk/perl.mk
+++ b/mk/perl.mk
@@ -6,6 +6,7 @@ PERL_ENV:= AR="$(TARGET_AR)" \
FULL_AR="$(TARGET_AR)" \
CC="$(TARGET_CC)" \
CCFLAGS="$(TARGET_CFLAGS)" \
+ OPTIMIZE=" " \
LD="$(TARGET_CC)" \
LDDLFLAGS="-shared $(TARGET_LDFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
@@ -16,3 +17,15 @@ PERL_ENV:= AR="$(TARGET_AR)" \
INSTALLVENDORARCH=$(PERL_SITEDIR)/$(PERL_ARCHNAME) \
INSTALLVENDORBIN=/usr/bin \
INSTALLVENDORSCRIPT=/usr/bin
+HOST_PERL_ENV:= CC="$(CC_FOR_BUILD)" \
+ CCFLAGS="$(CFLAGS_FOR_BUILD)" \
+ OPTIMIZE=" " \
+ LD="$(CC_FOR_BUILD)" \
+ LDDLFLAGS="-shared $(LDFLAGS_FOR_BUILD)" \
+ LDFLAGS="$(LDFLAGS_FOR_BUILD)" \
+ DESTDIR=$(WRKINST) \
+ INSTALLDIRS=vendor \
+ INSTALLVENDORLIB=$(PERL_SITEDIR) \
+ INSTALLVENDORARCH=$(PERL_SITEDIR)/$(PERL_ARCHNAME) \
+ INSTALLVENDORBIN=/usr/bin \
+ INSTALLVENDORSCRIPT=/usr/bin
diff --git a/mk/pkg-bottom.mk b/mk/pkg-bottom.mk
index d81b8915c..4296c98c3 100644
--- a/mk/pkg-bottom.mk
+++ b/mk/pkg-bottom.mk
@@ -89,7 +89,7 @@ else ifneq ($(filter perl,${CONFIG_STYLE}),)
PERL_MM_USE_DEFAULT=1 \
PERL_AUTOINSTALL=--skipdeps \
$(PERL_ENV) \
- perl Makefile.PL ${CONFIGURE_ARGS}
+ perl-host Makefile.PL ${CONFIGURE_ARGS}
else ifeq ($(strip ${CONFIG_STYLE}),)
@$(CMD_TRACE) "configuring... "
cd ${WRKBUILD}; rm -f config.{cache,status}; \
diff --git a/package/alsa-lib/Makefile b/package/alsa-lib/Makefile
index 6461e02f4..dd5e9a3b2 100644
--- a/package/alsa-lib/Makefile
+++ b/package/alsa-lib/Makefile
@@ -5,7 +5,7 @@ include ${ADK_TOPDIR}/rules.mk
PKG_NAME:= alsa-lib
PKG_VERSION:= 1.0.28
-PKG_RELEASE:= 3
+PKG_RELEASE:= 4
PKG_MD5SUM:= c9e21b88a2b3e6e12ea7ba0f3b271fc3
PKG_DESCR:= sound library
PKG_SECTION:= libs/audio
@@ -34,7 +34,7 @@ CONFIGURE_ARGS+= --disable-python
alsa-lib-install:
${INSTALL_DIR} ${IDIR_ALSA_LIB}/usr/lib ${IDIR_ALSA_LIB}/usr/share/alsa
${CP} ${WRKINST}/usr/lib/libasound.so* ${IDIR_ALSA_LIB}/usr/lib
- ${CP} ${WRKINST}/usr/share/alsa/* ${IDIR_ALSA_LIB}/usr/share/alsa
+ ${CP} ${WRKINST}/usr/share/alsa/alsa.conf ${IDIR_ALSA_LIB}/usr/share/alsa
include ${ADK_TOPDIR}/mk/host-bottom.mk
include ${ADK_TOPDIR}/mk/pkg-bottom.mk
diff --git a/package/logitechmediaserver/Makefile b/package/logitechmediaserver/Makefile
index 6d118f4e0..daafeefb0 100644
--- a/package/logitechmediaserver/Makefile
+++ b/package/logitechmediaserver/Makefile
@@ -11,7 +11,7 @@ PKG_DESCR:= popular media server
PKG_SECTION:= mm/audio
PKG_DEPENDS:= perl p5-xml-parser p5-dbi p5-ev p5-html-parser
PKG_DEPENDS+= p5-json-xs p5-digest-sha1 p5-yaml-xs p5-sub-name
-PKG_DEPENDS+= p5-xml-parser-expat p5-time-hires p5-common-sense
+PKG_DEPENDS+= p5-xml-parser-expat p5-common-sense
PKG_DEPENDS+= p5-types-serialiser p5-audio-scan p5-image-scale
PKG_DEPENDS+= p5-dbd-sqlite p5-tie-refhash
PKG_BUILDDEP:= perl
diff --git a/package/mpdbox/Makefile b/package/mpdbox/Makefile
index b431a0b72..b0f2c2605 100644
--- a/package/mpdbox/Makefile
+++ b/package/mpdbox/Makefile
@@ -4,16 +4,14 @@
include $(ADK_TOPDIR)/rules.mk
PKG_NAME:= mpdbox
-PKG_VERSION:= 1.0
-PKG_RELEASE:= 2
+PKG_VERSION:= 1.0.1
+PKG_RELEASE:= 1
PKG_MD5SUM:= ac0dc1cc7141c1eca66d8ddd98574e0b
PKG_DESCR:= mpd web interface
PKG_SECTION:= mm/audio
PKG_URL:= http://www.openadk.org/cgi-bin/gitweb.cgi?p=mpdbox.git;a=summary
PKG_SITES:= http://www.openadk.org/distfiles/
-DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz
-
include $(ADK_TOPDIR)/mk/package.mk
$(eval $(call PKG_template,MPDBOX,mpdbox,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
diff --git a/package/p5-audio-scan/Makefile b/package/p5-audio-scan/Makefile
index 346dd5681..e08f27718 100644
--- a/package/p5-audio-scan/Makefile
+++ b/package/p5-audio-scan/Makefile
@@ -20,6 +20,8 @@ include $(ADK_TOPDIR)/mk/package.mk
$(eval $(call PKG_template,P5_AUDIO_SCAN,p5-audio-scan,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
+TARGET_CFLAGS+= -fPIC
+
include $(ADK_TOPDIR)/mk/perl.mk
CONFIG_STYLE:= perl
diff --git a/package/p5-dbd-sqlite/Makefile b/package/p5-dbd-sqlite/Makefile
index 1be5008c6..abcd09a83 100644
--- a/package/p5-dbd-sqlite/Makefile
+++ b/package/p5-dbd-sqlite/Makefile
@@ -9,8 +9,8 @@ PKG_RELEASE:= 1
PKG_MD5SUM:= 86cfaf477cb9ddc39508f74f4268fc79
PKG_DESCR:= self-contained rdbms in a dbi driver
PKG_SECTION:= dev/perl
-PKG_DEPENDS:= perl
-PKG_BUILDDEP:= perl
+PKG_DEPENDS:= perl p5-dbi
+PKG_BUILDDEP:= perl p5-dbi-host
PKG_SITES:= http://cpan.metacpan.org/authors/id/I/IS/ISHIGAKI/
DISTFILES:= DBD-SQLite-${PKG_VERSION}.tar.gz
diff --git a/package/p5-dbi/Makefile b/package/p5-dbi/Makefile
index 6380059dd..1c85cf8be 100644
--- a/package/p5-dbi/Makefile
+++ b/package/p5-dbi/Makefile
@@ -16,18 +16,27 @@ PKG_SITES:= http://cpan.metacpan.org/authors/id/T/TI/TIMB/
DISTFILES:= DBI-${PKG_VERSION}.tar.gz
WRKDIST= ${WRKDIR}/DBI-${PKG_VERSION}
+include $(ADK_TOPDIR)/mk/host.mk
include $(ADK_TOPDIR)/mk/package.mk
+$(eval $(call HOST_template,P5_DBI,p5-dbi,$(PKG_VERSION)-${PKG_RELEASE}))
$(eval $(call PKG_template,P5_DBI,p5-dbi,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
+TARGET_CFLAGS+= -fPIC
+
include $(ADK_TOPDIR)/mk/perl.mk
+HOST_STYLE:= perl
CONFIG_STYLE:= perl
XAKE_FLAGS+= $(PERL_ENV)
+hostpost-install:
+ (cd $(WRKBUILD) && PATH='$(HOST_PATH)' $(HOST_PERL_ENV) make install)
+
p5-dbi-install:
$(INSTALL_DIR) $(IDIR_P5_DBI)$(PERL_SITEDIR)
$(CP) $(WRKINST)$(PERL_SITEDIR)/* \
$(IDIR_P5_DBI)$(PERL_SITEDIR)
+include ${ADK_TOPDIR}/mk/host-bottom.mk
include ${ADK_TOPDIR}/mk/pkg-bottom.mk
diff --git a/package/perl/Makefile b/package/perl/Makefile
index b866cb05c..11fa4678e 100644
--- a/package/perl/Makefile
+++ b/package/perl/Makefile
@@ -34,8 +34,9 @@ host-configure:
$(SED) "s#@@STAGING_HOST_DIR@@/perl-host#./perl#" ${WRKBUILD}/Makefile.SH
$(SED) "s#@@LIB@@#-Ilib#" ${WRKBUILD}/Makefile.SH
# darwin workaround
+ $(CP) ${WRKBUILD}/hints/darwin.sh ${WRKBUILD}/hints/darwin.sh.bak
$(SED) "s#^usedl.*##" ${WRKBUILD}/hints/darwin.sh
- (cd ${WRKBUILD}; ${BASH} ./Configure -des -Duseperlio -Uusedl -Uusethreads -Uuseshrplib -Dprefix=${STAGING_HOST_DIR}/usr)
+ (cd ${WRKBUILD}; ${BASH} ./Configure -des -Uusedl -Uusethreads -Duseperlio -Uuseshrplib -Dprefix=${STAGING_HOST_DIR}/usr)
host-build:
cd ${WRKBUILD} && env CC_FOR_BUILD="gcc" ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \
@@ -44,8 +45,16 @@ host-build:
perl-hostinstall:
cd ${WRKBUILD} && env CC_FOR_BUILD="gcc" ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \
${HOST_MAKE_FLAGS} ${HOST_INSTALL_TARGET} $(MAKE_TRACE)
- mv ${STAGING_HOST_DIR}/usr/bin/perl ${STAGING_HOST_DIR}/usr/bin/perl-host
+ mv ${STAGING_HOST_DIR}/usr/bin/perl ${STAGING_HOST_DIR}/usr/bin/perl-static
cp ${WRKBUILD}/miniperl ${STAGING_HOST_DIR}/usr/bin
+ # now build perl a second time for perl modules (dynamic)
+ $(CP) ${WRKBUILD}/hints/darwin.sh.bak ${WRKBUILD}/hints/darwin.sh
+ (cd ${WRKBUILD}; rm config.sh; ${BASH} ./Configure -des -Uuseshrplib -Dprefix=${STAGING_HOST_DIR}/usr)
+ cd ${WRKBUILD} && env CC_FOR_BUILD="gcc" ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \
+ ${HOST_MAKE_FLAGS} ${HOST_ALL_TARGET} $(MAKE_TRACE)
+ cd ${WRKBUILD} && env CC_FOR_BUILD="gcc" ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \
+ ${HOST_MAKE_FLAGS} ${HOST_INSTALL_TARGET} $(MAKE_TRACE)
+ mv ${STAGING_HOST_DIR}/usr/bin/perl ${STAGING_HOST_DIR}/usr/bin/perl-host
do-configure:
sed \
@@ -71,7 +80,7 @@ do-build:
(cd ${WRKBUILD}; $(MAKE))
do-install:
- (cd ${WRKBUILD}; $(STAGING_HOST_DIR)/usr/bin/perl-host installperl --destdir=${WRKINST})
+ (cd ${WRKBUILD}; $(STAGING_HOST_DIR)/usr/bin/perl-static installperl --destdir=${WRKINST})
perl-install:
${INSTALL_DIR} ${IDIR_PERL}/usr/bin
@@ -79,7 +88,7 @@ perl-install:
${CP} ${WRKINST}/usr/lib/perl5/${PKG_VERSION}/* \
${IDIR_PERL}/usr/lib/perl5/${PKG_VERSION}
${INSTALL_BIN} ${WRKINST}/usr/bin/perl ${IDIR_PERL}/usr/bin/
- touch $(STAGING_TARGET_DIR)/usr/lib/perl5/$(PKG_VERSION)/$(ADK_TARGET_CPU_ARCH)-linux/CORE/patchlevel-debian.h
+ touch $(IDIR_PERL)/usr/lib/perl5/$(PKG_VERSION)/$(ADK_TARGET_CPU_ARCH)-linux/CORE/patchlevel-debian.h
include ${ADK_TOPDIR}/mk/host-bottom.mk
include ${ADK_TOPDIR}/mk/pkg-bottom.mk
diff --git a/package/squeezelite/Makefile b/package/squeezelite/Makefile
index 3adf26997..ad58abf97 100644
--- a/package/squeezelite/Makefile
+++ b/package/squeezelite/Makefile
@@ -4,8 +4,8 @@
include $(ADK_TOPDIR)/rules.mk
PKG_NAME:= squeezelite
-PKG_VERSION:= 1.5
-PKG_RELEASE:= 3
+PKG_VERSION:= 1.6.4
+PKG_RELEASE:= 1
PKG_MD5SUM:= 7605af4d64291495645f88575a564475
PKG_DESCR:= headless squeezebox emulator
PKG_SECTION:= mm/audio
@@ -16,14 +16,12 @@ PKG_BUILDDEP+= faad2
PKG_URL:= http://code.google.com/p/squeezelite/
PKG_SITES:= http://openadk.org/distfiles/
-DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz
-PKG_LIBC_DEPENDS:= glibc musl
-
include $(ADK_TOPDIR)/mk/package.mk
$(eval $(call PKG_template,SQUEEZELITE,squeezelite,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
TARGET_CPPFLAGS+= -D_GNU_SOURCE -D_POSIX_SOURCE
+TARGET_LDFLAGS+= -ldl
CONFIG_STYLE:= manual
INSTALL_STYLE:= manual
diff --git a/scripts/install.sh b/scripts/install.sh
index 1e589d0cd..a874bfb69 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -24,12 +24,7 @@
# ware Foundation.
#-
# Prepare a USB stick or CF/SD/MMC card or hard disc for installation
-# of OpenADK:
-# • install a Master Boot Record containing a MirBSD PBR loading GRUB
-# • write GRUB2 core.img just past the MBR
-# • create a root partition and extract the OpenADK image
-# just built there
-# • create a cfgfs partition
+# of OpenADK
ADK_TOPDIR=$(pwd)
HOST=$(gcc -dumpmachine)
@@ -60,6 +55,7 @@ ostype=$(uname -s)
fs=ext4
cfgfs=1
+datafssz=0
noformat=0
quiet=0
serial=0
@@ -68,31 +64,36 @@ panicreboot=10
function usage {
cat >&2 <<EOF
-Syntax: $me [-f filesystem] [-c cfgfssize] [-p panictime] [±q] [-s serialspeed]
- [±t] -n /dev/sdb image
+Syntax: $me [-f filesystem] [-c cfgfssize] [-d datafssize] [-n]
+ [-p panictime] [±q] [-s serialspeed] [±t] <target> <device> <archive>
+Partition sizes are in MiB. Filesystem type is currently ignored (ext4).
Defaults: -c 1 -p 10 -s 115200; -t = enable serial console
EOF
exit $1
}
-while getopts "f:c:hp:qs:nt" ch; do
+while getopts "c:d:f:hnp:qs:t" ch; do
case $ch {
- (c) if (( (cfgfs = OPTARG) < 0 || cfgfs > 5 )); then
+ (c) if (( (cfgfs = OPTARG) < 0 || cfgfs > 16 )); then
print -u2 "$me: -c $OPTARG out of bounds"
exit 1
fi ;;
- (h) usage 0 ;;
- (p) if (( (panicreboot = OPTARG) < 0 || panicreboot > 300 )); then
- print -u2 "$me: -p $OPTARG out of bounds"
+ (d) if (( (datafssz = OPTARG) < 0 )); then
+ print -u2 "$me: -d $OPTARG out of bounds"
exit 1
fi ;;
- (q) quiet=1 ;;
- (+q) quiet=0 ;;
(f) if [[ $OPTARG != @(ext2|ext3|ext4|xfs) ]]; then
print -u2 "$me: filesystem $OPTARG invalid"
exit 1
fi
fs=$OPTARG ;;
+ (h) usage 0 ;;
+ (p) if (( (panicreboot = OPTARG) < 0 || panicreboot > 300 )); then
+ print -u2 "$me: -p $OPTARG out of bounds"
+ exit 1
+ fi ;;
+ (q) quiet=1 ;;
+ (+q) quiet=0 ;;
(s) if [[ $OPTARG != @(96|192|384|576|1152)00 ]]; then
print -u2 "$me: serial speed $OPTARG invalid"
exit 1
@@ -106,18 +107,15 @@ while getopts "f:c:hp:qs:nt" ch; do
done
shift $((OPTIND - 1))
-(( $# == 2 )) || usage 1
+(( $# == 3 )) || usage 1
f=0
-tools="mkfs.$fs tune2fs"
case $ostype {
(Linux)
- ;;
-(DragonFly|*BSD*)
- print -u2 Sorry, not ported to the OS "'$ostype'" yet.
+ tools="bc mkfs.$fs tune2fs"
;;
(Darwin)
- print -u2 Sorry, not ported to the OS "'$ostype'" yet.
+ tools="bc diskutil"
;;
(*)
print -u2 Sorry, not ported to the OS "'$ostype'" yet.
@@ -135,9 +133,16 @@ for tool in $tools; do
done
(( f )) && exit 1
-tgt=$1
-src=$2
+target=$1
+tgt=$2
+src=$3
+case $target {
+(raspberry-pi|solidrun-imx6|default) ;;
+(*)
+ print -u2 "Unknown target '$target', exiting"
+ exit 1 ;;
+}
if [[ ! -b $tgt ]]; then
print -u2 "'$tgt' is not a block device, exiting"
exit 1
@@ -149,30 +154,54 @@ fi
(( quiet )) || print "Installing $src on $tgt."
case $ostype {
-(DragonFly|*BSD*)
- basedev=${tgt%c}
- tgt=${basedev}c
- part=${basedev}i
- match=\'${basedev}\''[a-p]'
- function mount_fs {
- mount -t ext2fs "$1" "$2"
- }
- ;;
(Darwin)
+ R=/Volumes/ADKROOT; diskutil unmount $R
+ B=/Volumes/ADKBOOT; diskutil unmount $B
+ D=/Volumes/ADKDATA; diskutil unmount $D
basedev=$tgt
- part=${basedev}s1
+ rootpart=${basedev}s1
+ datapart=${basedev}s2
+ if [[ $target = raspberry-pi ]]; then
+ bootpart=${basedev}s1
+ rootpart=${basedev}s2
+ datapart=${basedev}s3
+ fi
match=\'${basedev}\''?(s+([0-9]))'
function mount_fs {
- fuse-ext2 "$1" "$2" -o rw+
- sleep 3
+ }
+ function umount_fs {
+ diskutil unmount "$1"
+ }
+ function create_fs {
+ if [[ $3 = ext4 ]]; then
+ fstype=UFSD_EXTFS4
+ fi
+ if [[ $3 = vfat ]]; then
+ fstype=fat32
+ fi
+ diskutil eraseVolume $fstype "$2" "$1"
}
;;
(Linux)
basedev=$tgt
- part=${basedev}1
+ rootpart=${basedev}1
+ datapart=${basedev}2
+ if [[ $target = raspberry-pi ]]; then
+ bootpart=${basedev}1
+ rootpart=${basedev}2
+ datapart=${basedev}3
+ fi
+
match=\'${basedev}\''+([0-9])'
function mount_fs {
- mount -t $fs "$1" "$2"
+ mount -t "$3" "$1" "$2"
+ }
+ function umount_fs {
+ umount "$1"
+ }
+ function create_fs {
+ mkfs.$3 "$1"
+ tune2fs -c 0 -i 0 "$1"
}
;;
}
@@ -190,12 +219,51 @@ if (( !quiet )); then
[[ $x = Yes ]] || exit 0
fi
+if ! T=$(mktemp -d /tmp/openadk.XXXXXXXXXX); then
+ print -u2 Error creating temporary directory.
+ exit 1
+fi
+if [[ $ostype != Darwin ]]; then
+ R=$T/rootmnt
+ B=$T/bootmnt
+ D=$T/datamnt
+ mkdir -p "$R" "$B" "$D"
+fi
+
+# get disk size
dksz=$(dkgetsz "$tgt")
+
+# partition layouts:
+# n̲a̲m̲e̲ p̲a̲r̲t̲#̲0̲ p̲̲a̲r̲t̲#̲1̲ p̲̲a̲r̲t̲#̲2̲ p̲̲a̲r̲t̲#̲3̲
+# default: 0x83(system) 0x83(?data) -(unused) 0x88(cfgfs)
+# raspberry: 0x0B(boot) 0x83(system) 0x83(?data) 0x88(cfgfs)
+
+syspartno=0
+
+# sizes:
+# boot(raspberry) - fixed (100 MiB)
+# cfgfs - fixed (parameter, max. 16 MiB)
+# data - flexible (parameter)
+# system - everything else
+
+if [[ $target = raspberry-pi ]]; then
+ syspartno=1
+ bootfssz=100
+ if (( grub )); then
+ print -u2 "Cannot combine GRUB with $target"
+ rm -rf "$T"
+ exit 1
+ fi
+else
+ bootfssz=0
+fi
+
heads=64
secs=32
(( cyls = dksz / heads / secs ))
-if (( cyls < (cfgfs + 2) )); then
+if (( cyls < (bootfssz + cfgfs + datafssz + 2) )); then
print -u2 "Size of $tgt is $dksz, this looks fishy?"
+ rm -rf "$T"
exit 1
fi
@@ -205,12 +273,12 @@ else
statcmd='stat -c %s' # GNU stat
fi
-if ! T=$(mktemp -d /tmp/openadk.XXXXXXXXXX); then
- print -u2 Error creating temporary directory.
- exit 1
+if (( grub )); then
+ tar -xOzf "$src" boot/grub/core.img >"$T/core.img"
+ integer coreimgsz=$($statcmd "$T/core.img")
+else
+ coreimgsz=65024
fi
-tar -xOzf "$src" boot/grub/core.img >"$T/core.img"
-integer coreimgsz=$($statcmd "$T/core.img")
if (( coreimgsz < 1024 )); then
print -u2 core.img is probably too small: $coreimgsz
rm -rf "$T"
@@ -232,17 +300,30 @@ else
corepatchofs=$((0x414))
fi
# partition offset: at least coreendsec+1 but aligned on a multiple of secs
-(( partofs = ((coreendsec / secs) + 1) * secs ))
+#(( partofs = ((coreendsec / secs) + 1) * secs ))
+# we just use 2048 all the time, since some loaders are longer
+partofs=2048
+if [[ $target = raspberry-pi ]]; then
+ (( spartofs = partofs + (100 * 2048) ))
+else
+ spartofs=$partofs
+fi
-(( quiet )) || print Preparing MBR and GRUB2...
+(( quiet )) || if (( grub )); then
+ print Preparing MBR and GRUB2...
+else
+ print Preparing MBR...
+fi
dd if=/dev/zero of="$T/firsttrack" count=$partofs 2>/dev/null
+# add another MiB to clear the first partition
+dd if=/dev/zero bs=1048576 count=1 >>"$T/firsttrack" 2>/dev/null
echo $corestartsec $coreendsec | mksh "$ADK_TOPDIR/scripts/bootgrub.mksh" \
- -A -g $((cyls-cfgfs)):$heads:$secs -M 1:0x83 -O $partofs | \
- dd of="$T/firsttrack" conv=notrunc 2>/dev/null
-dd if="$T/core.img" of="$T/firsttrack" conv=notrunc seek=$corestartsec \
- 2>/dev/null
+ -A -g $((cyls - bootfssz - cfgfs - datafssz)):$heads:$secs -M 1:0x83 \
+ -O $spartofs | dd of="$T/firsttrack" conv=notrunc 2>/dev/null
+(( grub )) && dd if="$T/core.img" of="$T/firsttrack" conv=notrunc \
+ seek=$corestartsec 2>/dev/null
# set partition where it can find /boot/grub
-print -n '\0\0\0\0' | \
+(( grub )) && print -n '\0\0\0\0' | \
dd of="$T/firsttrack" conv=notrunc bs=1 seek=$corepatchofs 2>/dev/null
# create cfgfs partition (mostly taken from bootgrub.mksh)
@@ -286,90 +367,208 @@ while (( curptr < 16 )); do
ostr=$ostr\\0${thecode[curptr++]#8#}
done
print -n "$ostr" | \
- dd of="$T/firsttrack" conv=notrunc bs=1 seek=$((0x1CE)) 2>/dev/null
+ dd of="$T/firsttrack" conv=notrunc bs=1 seek=$((0x1EE)) 2>/dev/null
-(( quiet )) || print Writing MBR and GRUB2 to target device...
-dd if="$T/firsttrack" of="$tgt"
-
-if [[ $basedev = /dev/svnd+([0-9]) ]]; then
- (( quiet )) || print "Creating BSD disklabel on target device..."
- # c: whole device (must be so)
- # i: ext2fs (matching first partition)
- # j: cfgfs (matching second partition)
- # p: MBR and GRUB2 area (by tradition)
- cat >"$T/bsdlabel" <<-EOF
- type: vnd
- disk: vnd device
- label: OpenADK
- flags:
- bytes/sector: 512
- sectors/track: $secs
- tracks/cylinder: $heads
- sectors/cylinder: $((heads * secs))
- cylinders: $cyls
- total sectors: $((cyls * heads * secs))
- rpm: 3600
- interleave: 1
- trackskew: 0
- cylinderskew: 0
- headswitch: 0
- track-to-track seek: 0
- drivedata: 0
-
- 16 partitions:
- c: $((cyls * heads * secs)) 0 unused
- i: $(((cyls - cfgfs) * heads * secs - partofs)) $partofs ext2fs
- j: $((cfgfs * heads * secs)) $(((cyls - cfgfs) * heads * secs)) unknown
- p: $partofs 0 unknown
-EOF
- disklabel -R ${basedev#/dev/} "$T/bsdlabel"
+if (( datafssz )); then
+ # create data partition (copy of the above :)
+ set -A thecode
+ typeset -Uui8 thecode
+ mbrpno=0
+ set -A g_code $cyls $heads $secs
+ (( psz = (cyls - cfgfs) * g_code[1] * g_code[2] ))
+ (( pofs = (cyls - cfgfs - datafssz) * g_code[1] * g_code[2] ))
+ set -A o_code # g_code equivalent for partition offset
+ (( o_code[2] = pofs % g_code[2] + 1 ))
+ (( o_code[1] = pofs / g_code[2] ))
+ (( o_code[0] = o_code[1] / g_code[1] + 1 ))
+ (( o_code[1] = o_code[1] % g_code[1] + 1 ))
+ # boot flag; C/H/S offset
+ thecode[mbrpno++]=0x00
+ (( thecode[mbrpno++] = o_code[1] - 1 ))
+ (( cylno = o_code[0] > 1024 ? 1023 : o_code[0] - 1 ))
+ (( thecode[mbrpno++] = o_code[2] | ((cylno & 0x0300) >> 2) ))
+ (( thecode[mbrpno++] = cylno & 0x00FF ))
+ # partition type; C/H/S end
+ (( thecode[mbrpno++] = 0x83 ))
+ (( thecode[mbrpno++] = g_code[1] - 1 ))
+ (( cylno = (g_code[0] - cfgfs) > 1024 ? 1023 : g_code[0] - cfgfs - 1 ))
+ (( thecode[mbrpno++] = g_code[2] | ((cylno & 0x0300) >> 2) ))
+ (( thecode[mbrpno++] = cylno & 0x00FF ))
+ # partition offset, size (LBA)
+ (( thecode[mbrpno++] = pofs & 0xFF ))
+ (( thecode[mbrpno++] = (pofs >> 8) & 0xFF ))
+ (( thecode[mbrpno++] = (pofs >> 16) & 0xFF ))
+ (( thecode[mbrpno++] = (pofs >> 24) & 0xFF ))
+ (( pssz = psz - pofs ))
+ (( thecode[mbrpno++] = pssz & 0xFF ))
+ (( thecode[mbrpno++] = (pssz >> 8) & 0xFF ))
+ (( thecode[mbrpno++] = (pssz >> 16) & 0xFF ))
+ (( thecode[mbrpno++] = (pssz >> 24) & 0xFF ))
+ # write partition table entry
+ ostr=
+ curptr=0
+ while (( curptr < 16 )); do
+ ostr=$ostr\\0${thecode[curptr++]#8#}
+ done
+ print -n "$ostr" | \
+ dd of="$T/firsttrack" conv=notrunc bs=1 seek=$((0x1CE)) 2>/dev/null
fi
-(( quiet )) || print "Creating filesystem on ${part}..."
-q=
-(( quiet )) && q=-q
-(( noformat )) || mkfs.$fs -F $q "$part"
-partuuid=$(/sbin/fdisk -l /dev/sdc|awk '/Disk identifier/ { print $3 "-01" }'|sed -e "s#^0x##")
-(( noformat )) || tune2fs -c 0 -i 0 "$part"
+if [[ $target = raspberry-pi ]]; then
+ # move system and data partition from #0/#1 to #1/#2
+ dd if="$T/firsttrack" bs=1 skip=$((0x1BE)) count=32 of="$T/x" 2>/dev/null
+ dd of="$T/firsttrack" conv=notrunc bs=1 seek=$((0x1CE)) if="$T/x" 2>/dev/null
+ # create boot partition (copy of the above :)
+ set -A thecode
+ typeset -Uui8 thecode
+ mbrpno=0
+ set -A g_code $cyls $heads $secs
+ psz=$spartofs
+ pofs=$partofs
+ set -A o_code # g_code equivalent for partition offset
+ (( o_code[2] = pofs % g_code[2] + 1 ))
+ (( o_code[1] = pofs / g_code[2] ))
+ (( o_code[0] = o_code[1] / g_code[1] + 1 ))
+ (( o_code[1] = o_code[1] % g_code[1] + 1 ))
+ # boot flag; C/H/S offset
+ thecode[mbrpno++]=0x00
+ (( thecode[mbrpno++] = o_code[1] - 1 ))
+ (( cylno = o_code[0] > 1024 ? 1023 : o_code[0] - 1 ))
+ (( thecode[mbrpno++] = o_code[2] | ((cylno & 0x0300) >> 2) ))
+ (( thecode[mbrpno++] = cylno & 0x00FF ))
+ # partition type; C/H/S end
+ (( thecode[mbrpno++] = 0x0B ))
+ (( thecode[mbrpno++] = g_code[1] - 1 ))
+ (( cylno = (spartofs / 2048) > 1024 ? 1023 : (spartofs / 2048) - 1 ))
+ (( thecode[mbrpno++] = g_code[2] | ((cylno & 0x0300) >> 2) ))
+ (( thecode[mbrpno++] = cylno & 0x00FF ))
+ # partition offset, size (LBA)
+ (( thecode[mbrpno++] = pofs & 0xFF ))
+ (( thecode[mbrpno++] = (pofs >> 8) & 0xFF ))
+ (( thecode[mbrpno++] = (pofs >> 16) & 0xFF ))
+ (( thecode[mbrpno++] = (pofs >> 24) & 0xFF ))
+ (( pssz = psz - pofs ))
+ (( thecode[mbrpno++] = pssz & 0xFF ))
+ (( thecode[mbrpno++] = (pssz >> 8) & 0xFF ))
+ (( thecode[mbrpno++] = (pssz >> 16) & 0xFF ))
+ (( thecode[mbrpno++] = (pssz >> 24) & 0xFF ))
+ # write partition table entry
+ ostr=
+ curptr=0
+ while (( curptr < 16 )); do
+ ostr=$ostr\\0${thecode[curptr++]#8#}
+ done
+ print -n "$ostr" | \
+ dd of="$T/firsttrack" conv=notrunc bs=1 seek=$((0x1BE)) 2>/dev/null
+fi
-(( quiet )) || print Extracting installation archive...
-mount_fs "$part" "$T"
-gzip -dc "$src" | (cd "$T"; tar -xvpf -)
-cd "$T"
+# disk signature
rnddev=/dev/urandom
[[ -c /dev/arandom ]] && rnddev=/dev/arandom
+dd if=$rnddev bs=4 count=1 2>/dev/null | \
+ dd of="$T/firsttrack" conv=notrunc bs=1 seek=$((0x1B8)) 2>/dev/null
+print -n '\0\0' | \
+ dd of="$T/firsttrack" conv=notrunc bs=1 seek=$((0x1BC)) 2>/dev/null
+partuuid=$(dd if="$T/firsttrack" bs=1 count=4 skip=$((0x1B8)) 2>/dev/null | \
+ hexdump -e '1/4 "%08x"')-0$((syspartno+1))
+
+(( quiet )) || print Cleaning out partitions...
+(( datafssz )) && dd if=/dev/zero bs=1048576 count=1 \
+ seek=$((cyls - cfgfs - datafssz)) 2>/dev/null
+dd if=/dev/zero bs=1048576 count=1 seek=$((spartofs / 2048)) 2>/dev/null
+
+(( quiet )) || if (( grub )); then
+ print Writing MBR and GRUB2 to target device... system PARTUUID=$partuuid
+else
+ print Writing MBR to target device... system PARTUUID=$partuuid
+fi
+dd if="$T/firsttrack" of="$tgt"
+
+case $target {
+(solidrun-imx6)
+ fwdir=$(dirname "$src")
+ dd if="$fwdir/SPL" of="$tgt" bs=1024 seek=1
+ dd if="$fwdir/u-boot.img" of="$tgt" bs=1024 seek=42
+ ;;
+(raspberry-pi)
+ (( quiet )) || print "Creating filesystem on ${bootpart}..."
+ (( noformat )) || create_fs "$bootpart" ADKBOOT vfat
+ ;;
+}
+
+(( quiet )) || print "Creating filesystem on ${rootpart}..."
+(( noformat )) || create_fs "$rootpart" ADKROOT ext4
+
+if (( datafssz )); then
+ (( quiet )) || print "Creating filesystem on ${datapart}..."
+ (( noformat )) || create_fs "$datapart" ADKDATA ext4
+ mount_fs "$datapart" "$D" ext4
+ mkdir -m0755 "$D/mpd" "$D/xbmc"
+ umount_fs "$D"
+fi
+
+(( quiet )) || print Extracting installation archive...
+mount_fs "$rootpart" "$R" ext4
+gzip -dc "$src" | (cd "$R"; tar -xpf -)
+
+case $target {
+(raspberry-pi)
+ mount_fs "$bootpart" "$B" vfat
+ for x in "$R"/boot/.*; do
+ [[ -e "$x" ]] && mv -f "$R"/boot/.* "$B/"
+ break
+ done
+ for x in "$R"/boot/*; do
+ [[ -e "$x" ]] && mv -f "$R"/boot/* "$B/"
+ break
+ done
+ umount_fs "$B"
+ ;;
+(solidrun-imx6)
+ for x in "$fwdir"/*.dtb; do
+ [[ -e "$x" ]] && cp "$fwdir"/*.dtb "$R/boot/"
+ break
+ done
+ ;;
+}
+
+cd "$R"
dd if=$rnddev bs=16 count=1 >>etc/.rnd 2>/dev/null
(( quiet )) || print Fixing up permissions...
chown 0:0 tmp
chmod 1777 tmp
[[ -f usr/bin/sudo ]] && chmod 4755 usr/bin/sudo
-(( quiet )) || print Configuring GRUB2 bootloader...
-mkdir -p boot/grub
-(
- print set default=0
- print set timeout=1
- if (( serial )); then
- print serial --unit=0 --speed=$speed
- print terminal_output serial
- print terminal_input serial
- consargs="console=ttyS0,$speed console=tty0"
- else
- print terminal_output console
- print terminal_input console
- consargs="console=tty0"
- fi
- print
- print 'menuentry "GNU/Linux (OpenADK)" {'
- linuxargs="root=PARTUUID=$partuuid $consargs"
- (( panicreboot )) && linuxargs="$linuxargs panic=$panicreboot"
- print "\tlinux /boot/kernel $linuxargs"
- print '}'
-) >boot/grub/grub.cfg
+
+if (( grub )); then
+ (( quiet )) || print Configuring GRUB2 bootloader...
+ mkdir -p boot/grub
+ (
+ print set default=0
+ print set timeout=1
+ if (( serial )); then
+ print serial --unit=0 --speed=$speed
+ print terminal_output serial
+ print terminal_input serial
+ consargs="console=ttyS0,$speed console=tty0"
+ else
+ print terminal_output console
+ print terminal_input console
+ consargs="console=tty0"
+ fi
+ print
+ print 'menuentry "GNU/Linux (OpenADK)" {'
+ linuxargs="root=PARTUUID=$partuuid $consargs"
+ (( panicreboot )) && linuxargs="$linuxargs panic=$panicreboot"
+ print "\tlinux /boot/kernel $linuxargs"
+ print '}'
+ ) >boot/grub/grub.cfg
+fi
+
(( quiet )) || print Finishing up...
cd "$ADK_TOPDIR"
-umount "$T"
-
-(( quiet )) || print "\nNote: the rootfs UUID is: $partuuid"
+sync
+umount_fs "$R"
+sync
rm -rf "$T"
exit 0
diff --git a/target/arm/Makefile b/target/arm/Makefile
index fb8a2b217..fd7d78a0f 100644
--- a/target/arm/Makefile
+++ b/target/arm/Makefile
@@ -45,16 +45,15 @@ ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VERSATILEPB)$(ADK_TARGET_QEMU_ARM_MODEL_TERRIE
endif
ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
@echo "Use following command to install it on SD card:"
- @echo "sudo ./scripts/install-rpi.sh /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
+ @echo "sudo ./scripts/install.sh raspberry-pi /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
@echo "Use following command to install with a writable data partition"
- @echo "sudo ./scripts/install-rpi.sh -d /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
+ @echo "sudo ./scripts/install.sh -d raspberry-pi /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
endif
ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6),y)
@echo "Use following command to install it on SD card:"
- @echo "sudo ./scripts/install-solidrun.sh /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL) $(FW_DIR)"
+ @echo "sudo ./scripts/install.sh solidrun-imx6 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
@echo "Use following command to install with a writable data partition"
- @echo "sudo ./scripts/install-solidrun.sh -d /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL) $(FW_DIR)"
-
+ @echo "sudo ./scripts/install.sh -d solidrun-imx6 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
endif
endif
ifeq ($(ADK_TARGET_FS),initramfs)
diff --git a/target/arm/kernel/raspberry-pi b/target/arm/kernel/raspberry-pi
index 135c473e3..0d75541e0 100644
--- a/target/arm/kernel/raspberry-pi
+++ b/target/arm/kernel/raspberry-pi
@@ -9,4 +9,6 @@ CONFIG_BCM2708_VCMEM=y
CONFIG_BCM2708_DMAER=y
CONFIG_VFP=y
CONFIG_BCM2708_VCHIQ=y
+CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_CMDLINE_EXTEND=y
diff --git a/target/config/Config.in.runtime b/target/config/Config.in.runtime
index 2caec15ec..207bcc0c1 100644
--- a/target/config/Config.in.runtime
+++ b/target/config/Config.in.runtime
@@ -133,6 +133,7 @@ config ADK_RUNTIME_CONSOLE_SERIAL_DEVICE
default "ttyAMA0" if ADK_TARGET_QEMU_ARM_MODEL_VERSATILEPB || ADK_TARGET_QEMU_ARM_MODEL_VEXPRESS_A9 || ADK_TARGET_SYSTEM_ARM_FM || ADK_TARGET_SYSTEM_QEMU_AARCH64
default "ttySC1" if ADK_TARGET_SYSTEM_QEMU_SH
default "ttymxc0" if ADK_TARGET_SYSTEM_SOLIDRUN_IMX6
+ default "ttyAMA0" if ADK_TARGET_SYSTEM_RASPBERRY_PI
default "ttyS0"
config ADK_RUNTIME_CONSOLE_SERIAL_SPEED
diff --git a/target/config/Config.in.target b/target/config/Config.in.target
index 764a3357b..0415e0ce5 100644
--- a/target/config/Config.in.target
+++ b/target/config/Config.in.target
@@ -50,7 +50,8 @@ config ADK_TARGET_CMDLINE
default "console=ttyS0,115200 console=tty0" if ADK_TARGET_SYSTEM_IBM_X40 && ADK_RUNTIME_VERBOSE_INIT_VGA
default "console=tty0 console=ttyS0,115200" if ADK_TARGET_SYSTEM_IBM_X40 && ADK_RUNTIME_VERBOSE_INIT_SERIAL
default "console=tty0" if ADK_TARGET_SYSTEM_LEMOTE_YEELONG
- default "console=tty1" if ADK_TARGET_SYSTEM_RASPBERRY_PI
+ default "console=ttyAMA0 console=tty1" if ADK_TARGET_SYSTEM_RASPBERRY_PI && ADK_RUNTIME_VERBOSE_INIT_VGA
+ default "console=tty1 console=ttyAMA0" if ADK_TARGET_SYSTEM_RASPBERRY_PI && ADK_RUNTIME_VERBOSE_INIT_SERIAL
default "console=ttyS0,115200 console=tty0 fbcon=rotate:1" if ADK_TARGET_SYSTEM_SHARP_ZAURUS
default "console=ttyS0,9600" if ADK_TARGET_SYSTEM_FON_FON2100
default "console=ttyS0,38400" if ADK_TARGET_SYSTEM_PCENGINES_WRAP