Difference between revisions of "User:DenisB"

From ArmadeusWiki
Jump to: navigation, search
m (Suppress an unuseful line)
(Misc 1 : Qemu launching: some lines of a bash scripts looked ugly)
Line 87: Line 87:
 
set -vx
 
set -vx
 
  [ -d  ${NOM_DIR_MNT}/usr/local/bin ] || $SUDO mkdir -p ${NOM_DIR_MNT}/usr/local/bin
 
  [ -d  ${NOM_DIR_MNT}/usr/local/bin ] || $SUDO mkdir -p ${NOM_DIR_MNT}/usr/local/bin
  $SUDO cp -rpuv ${TFTBOOT}/* ${NOM_DIR_MNT}/usr/local/bin/.
+
  $SUDO cp -rpuv ${TFTBOOT}"/"* ${NOM_DIR_MNT}/usr/local/bin/.
 
  #
 
  #
 
  # one **must** unmount the qemu  image before qemu can use it
 
  # one **must** unmount the qemu  image before qemu can use it
Line 100: Line 100:
  
 
Nota : copies which are made on an emulated image wo not appear on real hardware....
 
Nota : copies which are made on an emulated image wo not appear on real hardware....
 +
 
==Misc 2 ==
 
==Misc 2 ==

Revision as of 10:49, 24 October 2011

Misc 1 : Qemu launching

1) A script to make qemu launching automatic

Sometimes, the list of commands one has to type as host can be very long and tedious; and forgetting to type one of them leads to unpleasant results (ex : a mounted image should be unmounted before being used by qemu)

a bash script like this one, once adapted, might give ideas to avoid errors..

echo "          image pour qemu : ${NOM_IMAGE:=armadeus-qemu.img}
        montee dans  ${NOM_DIR_MNT:=qemu-mnt} "
echo -e "       repertoire de transit : ${TFTBOOT:=tftboot} 
        rafraichissement ${rafraichir:=no} 
	options -rw ou ro- : ${OPTION:=rw} 
        RAM :${RAMSIZE:=96M} DISQUE: ${DISKSIZE:=160} 
        image de boot :${VMBOOT:=./vmlinuz-2.6.29.6-versatile-armadeus}
"

# sets sudo options (if one is not sudoer, one might launch this script as root)
#

SUDO=
udo=`sudo echo alut`
[ s${udo} == "salut" ]  && SUDO=sudo
#

 [ -f ${NOM_IMAGE} ]   || rafraichir=oui_evidemment
 [ -d $TFTBOOT ]       || mkdir $TFTBOOT
 [ -d ${NOM_DIR_MNT} ] || mkdir ${NOM_DIR_MNT}

 make shell_env && source armadeus_env.sh
 export PATH=${ARMADEUS_TOOLCHAIN_PATH}/../bin/:${PATH}

 # fixes armadeus-4.0 $ARMADEUS_ROOTFS_TAR gets the right name

 tempo=
 ls $ARMADEUS_ROOTFS_DIR
 [ -f $ARMADEUS_ROOTFS_TAR ] || tempo=`echo  $ARMADEUS_ROOTFS_TAR | sed -e "s/\.arm\././"`
 [ z$tempo != "z" ] && ARMADEUS_ROOTFS_TAR=$tempo
# ls -al $ARMADEUS_ROOTFS_TAR

 if [ $rafraichir = no ]
 then
   echo pas de rafraichissement
 else
   # destroys and creates an new image
   \rm $NOM_IMAGE
   dd if=/dev/zero of=${NOM_IMAGE} bs=1MB count=${DISKSIZE}
   $SUDO /sbin/mke2fs -F -m 0 -b 1024 ${NOM_IMAGE}
 fi

# for old versions of life CDs, where, sometimes, there are not enough mount points
 #  mknod /dev/loop/333 b 7 333
 #  losetup /dev/loop/333 ${NOM_IMAGE}
 #  mount /dev/loop/333 ${NOM_DIR_MNT}

 $SUDO mount -t ext2 -o loop $NOM_IMAGE ${NOM_DIR_MNT}
 $SUDO tar xf $ARMADEUS_ROOTFS_TAR -C ${NOM_DIR_MNT}/
[ -f ${NOM_DIR_MNT}/usr/local/bin ] &&  $SUDO \rm  ${NOM_DIR_MNT}/usr/local/bin

 # comments lines with tty (else, initialisation endlessly loops  under qemu)
  # sudo vi ${NOM_DIR_MNT}/etc/inittab
  # editing can be tedious if one does it every time: has been automated wwith sed
 $SUDO sed --in-place -e "s/^ttySMX/#ttySMX/"  ${NOM_DIR_MNT}/etc/inittab

 # creates a french (and german)  keyboard layout launcher and puts it in a temporary dir
 $SUDO  echo "loadkmap</etc/i18n/fr.kmap" > ${TFTBOOT}/kfr
 $SUDO  echo "loadkmap</etc/i18n/de.kmap" > ${TFTBOOT}/kde
 $SUDO chmod +x ${TFTBOOT}/k*

 # prepares other softs

 for monmac in qemu/Makefile makefilua # myoscillo/Makefile
  do
   [ -f $monmac ] &&  make -f $monmac &&  make -f $monmac install
  done
  TSTDIR=/usr/local/armadeus-4.0/myoscillo # places where one has some code to test
  opwd=`pwd`
  [ -d ${TSTDIR} ] && cd ${TSTDIR} && make && make install
  [ -d  ${opwd}/fontes ] && cd ${opwd}/fontes && make && make install
  cd $opwd
#       sleep 8 # you have some time to admire make at  work
#
 # puts everything one wants to download (from the temporary folder) in to 
 # what will become, in the emulated board, /usr/local/bin (is in the PATH) ....
set -vx
 [ -d   ${NOM_DIR_MNT}/usr/local/bin ] || $SUDO mkdir -p ${NOM_DIR_MNT}/usr/local/bin
 $SUDO cp -rpuv ${TFTBOOT}"/"* ${NOM_DIR_MNT}/usr/local/bin/.
 #
 # one **must** unmount the qemu  image before qemu can use it
 $SUDO umount ${NOM_DIR_MNT}
#
 qemu-system-arm -M versatilepb -kernel ${VMBOOT} -hda ${NOM_IMAGE} -append "root=/dev/sda mem=${RAMSIZE} ${OPTION}"

Nota : this script has been tested and run with some satisfaction for one month on Scientific Linux - 5.7 (a Red Hat clone, able to mount NTFS partitions and having a live DVD) and a Mageia-1: emulated cards were apf9328 and apf27.

Nota : Some things are very unstandard : using /usr/local as a working directory on ones host is a consequence of lazy mounts on a Scientific Linux live DVDD.... The size of the disks and the RAM do not need to be realistic, as it is meant for some tests (and lacking 500 K of disk , without tools to test it, might be frustrating)

Nota : copies which are made on an emulated image wo not appear on real hardware....

Misc 2