From 10997d993a55465525b026b9404f5809687e9e3c Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 7 Feb 2010 20:15:25 +0100 Subject: implement adkupdate and adkinstall for rb532 boards --- mk/image.mk | 7 +++++- package/adkinstall/src/adkinstall.rb532 | 39 ++++++++++++++++++++------------- package/base-files/extra/sbin/adkupdate | 5 +++++ package/cfgfs/Makefile | 2 +- target/rb532/Makefile | 32 +++++++++++++++++---------- 5 files changed, 57 insertions(+), 28 deletions(-) diff --git a/mk/image.mk b/mk/image.mk index 04506f0cd..04fae43bf 100644 --- a/mk/image.mk +++ b/mk/image.mk @@ -54,12 +54,17 @@ image-prepare-post: INITRAMFS= ${ADK_TARGET}-${ADK_LIBC}-${FS} ROOTFSSQUASHFS= ${ADK_TARGET}-${ADK_LIBC}-${FS}.img -ROOTFSTARBALL= ${ADK_TARGET}-${ADK_LIBC}-${FS}.tar.gz +ROOTFSTARBALL= ${ADK_TARGET}-${ADK_LIBC}-${FS}+kernel.tar.gz +ROOTFSUSERTARBALL= ${ADK_TARGET}-${ADK_LIBC}-${FS}.tar.gz INITRAMFS_PIGGYBACK= ${ADK_TARGET}-${ADK_LIBC}-${FS}.cpio ${BIN_DIR}/${ROOTFSTARBALL}: ${TARGET_DIR} cd ${TARGET_DIR}; tar -cf - --owner=0 --group=0 . | gzip -n9 >$@ +${BIN_DIR}/${ROOTFSUSERTARBALL}: ${TARGET_DIR} + cd ${TARGET_DIR}; tar --exclude ./boot -cf - --owner=0 --group=0 . \ + | gzip -n9 >$@ + ${BIN_DIR}/${INITRAMFS}: ${TARGET_DIR} cd ${TARGET_DIR}; find . | sed -n '/^\.\//s///p' | sort | \ cpio -R 0:0 -oC512 -Mdist -Hnewc | ${ADK_COMPRESSION_TOOL} >$@ diff --git a/package/adkinstall/src/adkinstall.rb532 b/package/adkinstall/src/adkinstall.rb532 index ca2ffde0d..e71848325 100644 --- a/package/adkinstall/src/adkinstall.rb532 +++ b/package/adkinstall/src/adkinstall.rb532 @@ -14,9 +14,11 @@ if [ -z $2 ];then printf "Please give your root tar archive as second parameter\n" exit 1 fi -if [ -z $3 ];then - printf "Please give your kernel as third parameter\n" - exit 1 +if [ $cfinstall -eq 1 ];then + if [ -z $3 ];then + printf "Please give your kernel as third parameter\n" + exit 1 + fi fi case $1 in nand) @@ -26,7 +28,7 @@ case $1 in cfinstall=1 ;; *) - printf "Target not recognized\n" + printf "Target device not known.\n" exit 1 ;; esac @@ -53,26 +55,33 @@ if [ $cfinstall -eq 1 ];then fi if [ $nandinstall -eq 1 ];then - printf "Installing kernel\n" - mount -t yaffs2 /dev/mtdblock0 /mnt - cp $3 /mnt/kernel - sync - umount /mnt + printf "Preparing mountpoints\n" mount -t yaffs2 /dev/mtdblock1 /mnt rm -rf /mnt/* >/dev/null 2>&1 + mkdir /mnt/boot + mount -t yaffs2 /dev/mtdblock0 /mnt/boot fi printf "Extracting install archive\n" tar -C /mnt -xzpf $2 +if [ $? -ne 0 ];then + printf "Extracting of install archive failed" + exit 1 +fi chmod 1777 /mnt/tmp chmod 4755 /mnt/bin/busybox -printf "Creating device nodes\n" -mknod -m 666 /mnt/dev/null c 1 3 -mknod -m 622 /mnt/dev/console c 5 1 -mknod -m 666 /mnt/dev/tty c 5 0 +sync +if [ $nandinstall -eq 1 ];then + umount /mnt/boot +fi umount /mnt -printf "Successfully installed.\n" -exit 0 +if [ $? -ne 0 ];then + printf "Unmounting filesystem failed" + exit 1 +else + printf "Successfully installed.\n" + exit 0 +fi diff --git a/package/base-files/extra/sbin/adkupdate b/package/base-files/extra/sbin/adkupdate index d41e23a0f..db1dfb73a 100755 --- a/package/base-files/extra/sbin/adkupdate +++ b/package/base-files/extra/sbin/adkupdate @@ -12,6 +12,8 @@ else updatecmd="gunzip -c | tar -xf -" fi +system=$(awk '/system type/ { print $5 }' /proc/cpuinfo 2>/dev/null) + check_exit() { if [ $? -ne 0 ];then echo "Update failed." @@ -23,6 +25,9 @@ prepare() { cd / umount -f /etc mount -o remount,rw / + if [ "$system" == "RB532" ];then + mount -t yaffs2 /dev/mtdblock0 /boot + fi } extract_from_file() { diff --git a/package/cfgfs/Makefile b/package/cfgfs/Makefile index 5650386ae..5d7fc7ae1 100644 --- a/package/cfgfs/Makefile +++ b/package/cfgfs/Makefile @@ -14,7 +14,7 @@ PKG_TARGET_DEPENDS:= alix wrap foxboard ag241 rb532 WRKDIST= ${WRKDIR}/${PKG_NAME}-${PKG_VERSION} NO_DISTFILES:= 1 -CFLINE_CFGFS:= select BUSYBOX_COMM\n\tselect BUSYBOX_MD5SUM\n\tselect BUSYBOX_XARGS\n\tselect BUSYBOX_FEATURE_SORT_BIG\n\tdepends on !ADK_TARGET_ROOTFS_NFSROOT +CFLINE_CFGFS:= select BUSYBOX_COMM\n\tselect BUSYBOX_MD5SUM\n\tselect BUSYBOX_XARGS\n\tselect BUSYBOX_FEATURE_SORT_BIG\n\tselect BUSYBOX_DIFF\n\tdepends on !ADK_TARGET_ROOTFS_NFSROOT include ${TOPDIR}/mk/package.mk diff --git a/target/rb532/Makefile b/target/rb532/Makefile index 27a070c31..88145c64c 100644 --- a/target/rb532/Makefile +++ b/target/rb532/Makefile @@ -11,28 +11,38 @@ OSTRIP:=-R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build kernel-install: $(TARGET_CROSS)objcopy $(OSTRIP) -S $(LINUX_DIR)/vmlinux \ - $(BIN_DIR)/${ADK_TARGET}-${FS}-kernel + $(TARGET_DIR)/boot/kernel + cp $(TARGET_DIR)/boot/kernel \ + $(BUILD_DIR)/${ADK_TARGET}-${FS}-kernel ifeq ($(FS),ext2-cf) -imageinstall: $(BIN_DIR)/$(ROOTFSTARBALL) +imageinstall: $(BIN_DIR)/$(ROOTFSUSERTARBALL) + @cp $(BUILD_DIR)/${ADK_TARGET}-${FS}-kernel \ + $(BIN_DIR)/${ADK_TARGET}-${FS}-kernel @echo @echo 'The kernel file is: ${BIN_DIR}/${ADK_TARGET}-${FS}-kernel' - @echo "The RootFS tarball is: $(BIN_DIR)/$(ROOTFSTARBALL)," - @echo 'Login as user root with password linux123 via ssh or console' + @echo "The RootFS tarball is: $(BIN_DIR)/$(ROOTFSUSERTARBALL)" + @echo "Boot the board via network (tftp/nfsroot) and use adkinstall." + @echo "If you just want to update, use adkupdate." + @echo 'Login as user root with password linux123 via ssh or console.' endif ifeq ($(FS),nfsroot) -imageinstall: $(BIN_DIR)/$(ROOTFSTARBALL) +imageinstall: $(BIN_DIR)/$(ROOTFSUSERTARBALL) + @cp $(BUILD_DIR)/${ADK_TARGET}-${FS}-kernel \ + $(BIN_DIR)/${ADK_TARGET}-${FS}-kernel @echo @echo 'The kernel file is: ${BIN_DIR}/${ADK_TARGET}-${FS}-kernel' - @echo 'The nfs root tarball is: ${BIN_DIR}/${ROOTFSTARBALL}' - @echo 'Login as user root with password linux123 via ssh or console' + @echo 'The nfs root tarball is: ${BIN_DIR}/${ROOTFSUSERTARBALL}' + @echo 'Login as user root with password linux123 via ssh or console.' endif ifeq ($(FS),yaffs) imageinstall: $(BIN_DIR)/$(ROOTFSTARBALL) - @echo - @echo 'The kernel file is: ${BIN_DIR}/${ADK_TARGET}-${FS}-kernel' - @echo "The RootFS tarball is: $(BIN_DIR)/$(ROOTFSTARBALL)," - @echo 'Login as user root with password linux123 via ssh or console' + @echo + @echo "The RootFS tarball is:" + @echo "$(BIN_DIR)/$(ROOTFSTARBALL)" + @echo "Boot the board via network (tftp/nfsroot) and use adkinstall." + @echo "If you just want to update, use adkupdate." + @echo 'Login as user root with password linux123 via ssh or console.' endif -- cgit v1.2.3