[Hamara-devel] Sugam on BeagleBone Black

Gurvinder Dadyala gurvinder at techblue.co.uk
Wed Mar 4 08:45:37 GMT 2015


Raju

Here is the script you can use to create Hamara Core

--------------------------------------------------Script Starts 
Here-------------------------------------------------------
#!/bin/bash

# build your own Raspberry Pi SD card
# you need at least
# apt-get install binfmt-support qemu qemu-user-static debootstrap 
kpartx lvm2 dosfstools

deb_mirror="http://arm.hamaralinux.org/hamara"
#deb_local_mirror="http://arm.hamaralinux.org/hamara"

bootsize="64M"
deb_release="namaste"

device=$1
buildenv="/tmp/rpi"
rootfs="${buildenv}/rootfs"
bootfs="${rootfs}/boot"

mydate=`date +%Y%m%d`

if [ "$deb_local_mirror" == "" ]; then
   deb_local_mirror=$deb_mirror
fi

image=""


if [ $EUID -ne 0 ]; then
   echo "this tool must be run as root"
   exit 1
fi

if ! [ -b $device ]; then
   echo "$device is not a block device"
   exit 1
fi

if [ "$device" == "" ]; then
   echo "no block device given, just creating an image"
   mkdir -p $buildenv
   image="${buildenv}/rpi_basic_${deb_release}_${mydate}.img"
   dd if=/dev/zero of=$image bs=1MB count=1000
   device=`losetup -f --show $image`
   echo "image $image created and mounted as $device"
else
   dd if=/dev/zero of=$device bs=512 count=1
fi

fdisk $device << EOF
n
p
1

+$bootsize
t
c
n
p
2


w
EOF


if [ "$image" != "" ]; then
   losetup -d $device
   device=`kpartx -va $image | sed -E 's/.*(loop[0-9])p.*/\1/g' | head -1`
   device="/dev/mapper/${device}"
   bootp=${device}p1
   rootp=${device}p2
else
   if ! [ -b ${device}1 ]; then
     bootp=${device}p1
     rootp=${device}p2
     if ! [ -b ${bootp} ]; then
       echo "uh, oh, something went wrong, can't find bootpartition 
neither as ${device}1 nor as ${device}p1, exiting."
       exit 1
     fi
   else
     bootp=${device}1
     rootp=${device}2
   fi
fi

mkfs.vfat $bootp
mkfs.ext4 $rootp

mkdir -p $rootfs

mount $rootp $rootfs

cd $rootfs

debootstrap --foreign --arch armel $deb_release $rootfs $deb_local_mirror
cp /usr/bin/qemu-arm-static usr/bin/
LANG=C chroot $rootfs /debootstrap/debootstrap --second-stage

mount $bootp $bootfs

echo "deb $deb_local_mirror $deb_release main contrib
" > etc/apt/sources.list

echo "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 
console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" > 
boot/cmdline.txt

echo "proc            /proc           proc    defaults 0       0
/dev/mmcblk0p1  /boot           vfat    defaults        0       0
" > etc/fstab

echo "raspberrypi" > etc/hostname

echo "auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
" > etc/network/interfaces

echo "vchiq
snd_bcm2835
" >> etc/modules

echo "console-common    console-data/keymap/policy    select Select 
keymap from full list
console-common    console-data/keymap/full    select de-latin1-nodeadkeys
" > debconf.set

echo "#!/bin/bash
debconf-set-selections debconf.set
cp usr/share/keyrings/hamara-archive-keyring.gpg /etc/apt/trusted.gpg.d/
rm -f debconf.set
apt-get update
apt-get -y install git-core binutils ca-certificates curl
wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update
chmod +x /usr/bin/rpi-update
mkdir -p /lib/modules/3.1.9+
touch /boot/start.elf
rpi-update
apt-get -y install locales console-common ntp openssh-server less vim
echo \"root:raspberry\" | chpasswd
sed -i -e 's/KERNEL\!=\"eth\*|/KERNEL\!=\"/' 
/lib/udev/rules.d/75-persistent-net-generator.rules
rm -f /etc/udev/rules.d/70-persistent-net.rules
rm -f third-stage
" > third-stage
chmod +x third-stage
LANG=C chroot $rootfs /third-stage

echo "deb $deb_mirror $deb_release main contrib
" > etc/apt/sources.list

echo "#!/bin/bash
aptitude update
aptitude clean
apt-get clean
rm -f cleanup
" > cleanup
chmod +x cleanup
LANG=C chroot $rootfs /cleanup

cd

umount $bootp
umount $rootp

if [ "$image" != "" ]; then
   kpartx -d $image
   echo "created image $image"
fi

echo "done."


--------------------------------------------------Script Ends 
Here-------------------------------------------------------

Now this script is specifically from Raspberry Pi because if you check 
in the end of script we are using Raspberry Kernel. According to me that 
is where you need to use Beaglebone kernel.
I am not sure whether you have any knowledge of debootstrap and kernel 
compilation, I would still like you to understand script rather than 
just just executing and creating debootstrap. Going through script will 
also give you overall understanding of core creation.

Let me know if you have any questions.



On Tuesday 03 March 2015 02:56 PM, Raju D. Vindane wrote:
>
> On 03/03/2015 01:16 PM, Gurvinder Dadyala wrote:
>> Raju
>>
>> We need to get the hardware first in order to test it. Overall 
>> process is not that difficult, we have already ported Hamara for 
>> Rapbberry Pi so it is just alteration of few steps.
>>
>> Following is procedure to initiate port
>> - Prepare Debootstrap depending on ARM architecture. Debootstrap is 
>> base file system without kernel.
>> - Compile board specific kernel
>> - DD image to sdcard
>> - Boot system
>>
>> We have already have a script created for Rapberry pi, If you want I 
>> can share that with you. You can also test it because you have board.
> I want to get started doing this. Please share the script. I'll try to 
> get this tested as soon as possible.
>>
>> On Tuesday 03 March 2015 11:35 AM, Raju D. Vindane wrote:
>>> How much estimated time should it take to get Sugam ported to 
>>> BeagleBone Black?
>>> How will be the procedure. I have not done much in this space, but i 
>>> closely want to contribute with this.
>>>
>>> Raju
>>> _______________________________________________
>>> Hamara-devel mailing list
>>> Hamara-devel at lists.hamaralinux.org
>>> http://lists.hamaralinux.org/listinfo/hamara-devel
>>
>

-- 

Regards,

Gurvinder Dadyala
Senior System Administrator
Email- gurvinder at techblue.co.uk
Contact No - 0845-0047-142
Extension No - 5012

FOR AND ON BEHALF OF:
Technology Blueprint Ltd
23 Clemens Street
Royal Leamington Spa
Warwickshire
CV31 2DW


Confidentiality Notice: This e-mail is intended solely for the use of the individual to whom it is addressed and may contain information that is privileged, confidential or otherwise exempt from disclosure. If the reader of this e-mail is not the intended recipient or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the original message at the listed email address. Thank You.



More information about the Hamara-devel mailing list