Raspberry PI and Ultimate Edition
![Post Post](./styles/prosilver_se/imageset/icon_post_target.gif)
Introduction:
Many will think an introduction is unnecessary, I am fairly well known in the Linux community. We get new users all the time, so I do deem it necessary to introduce myself. I am Glenn Cady better known via my nickname "TheeMahn" on the Internet. I have been writing software in excess of 30 years steadily approaching 35 years. While it may appear to the untrained eye I have earned the nickname, many things happen behind the scenes that most users are not aware of. I would like to take the time to make apparent.
Ultimate Edition as a whole has tons of beta testers (local and worldwide), moderators and administrators that not only test the Operating Systems that I build or that software I have written builds for them. They additionally test software I have written and take the time to answer your questions while I am busy programming and do so for free. I do want to give the Ultimate Edition community kudos, for allowing me to do my job.
Disclaimer:
I hate having to do this... CYOA. I'd say the chance of this going sour is close to ZERO. As we all know loading custom O/S's in a device is a risky process. We are not responsible if you brick your device while following these procedures although the chances are very low or null. We can't even guarantee you that this tutorial will work on your device unless it meets required conditions like version,model number,region or specific country etc.
Flashing roms,kernels and recoveries too is a highly risky job. All the posts which guide to install/flash are meant only for a particular device flashing these on other models or devices will surely brick it and at this stage we are not at all responsible as we didn't guide you to do so.
I take ZERO responsibility for any data loss or hardware loss proceed at your own risk.
And finally, Happy flashing!
What is a Raspberry PI?:
That tiny board is a quad core Arm Based PC. in specific:
802.11n WiFi, Bluetooth 4.0, and a quad-core 64-bit ARM Cortex A53 running at 1.2 GHz. It’s a usable desktop computer. Available now at the usual Pi retailers for $35, I paid $38 for mine. They are really fun to toy around with. I also purchased a 32GB Samsung EVO+ the fastest "hard drive" it will take from what I have researched for $11. I have successfully built Ultimate Edition 5.0 using mate as a DE with KODI and does well at streaming movies through the air from the JackHammer (my main rig).
I am ordering a 8TB single drive NAS (Network Attached Storage) tomorrow to replace a 6TB Seagate, I have 2 of them currently. The one that failed on me after 1 yr and 4 months (warrantee was 1yr). Seagate sucks. They have taken my software to aid their cause. The NAS will be Western Digital will be enroute & 3 years warrantee, Your data is more important then the warantee. What will transpire is I will take that Seagate 6TB drive throw it into the freezer for 15 minutes and unload it's data to the WD NAS. I knew about it before they ever wrote the article. I will get at least a portion, if not all my information back. Sorry for blowing off steam, but that at the time was about $600 in hard disks and utilizing my software and not so much as a thanks, how would you feel? I will openly write software for Western Digital for free to sink them. The moral of the story is... I am the last one you want to piss in my Weeties. I promise you verification..
I have thought about setting the Raspberry PI up as a NAS. The Raspberry PI 3 does have 4 USB ports and I do have 4 USB cases that will hold up to a 6TB drive & a bunch of hard disks I am not currently using Ultimate Edition NAS
![Wink ;)](./images/smilies/icon_e_wink.gif)
Without a doubt I would have to hard wire it to Gigabit. I doubt it has the balls to feed the entire house. I have a pretty heavy setup household wise. I may look into it or least try. The smallest drive in that drawer is 2TB minus the 1 TB laptop drive, most are 3TB.
EDIT 08/23/16: 8TB NAS has been here, guess what the 6 TB drive I dumped into the freezer, had no problems. I have it jacked into the back of the 8TB NAS and working fine, the NAS runs Debian (I have ripped apart the firmware using bin walker & will work through custom when I burn the 4 burners I have hot) So in essence I have a 14TB NAS accessible from anywhere in the world. The transition from 14.04 to 16.04 made it unreadable (used a live Ultimate Edition 4.2 and realized there was nothing wrong with it, the NAS did not complain as well). Bonus: I can set up accounts on it and beta testers can test as I build. I am sorry I do not have Gigabit upstream bandwidth right now. I do have a 300 Megabit cable modem capabile of 8 channel upstreams however my provider does not support it YET!!! $10 off my cable bill each month. When they do get to my area and they will I am set same price, they are currently upgrading my entire state.
It get's much worse, or better depending on your perception. I could put a USB 3 HUB (I have 3 of them) in-between it and stack in 3 more hard disks
![Wink ;)](./images/smilies/icon_e_wink.gif)
I hope you guys are ok with me blowing off steam. I have an AC adapter capable of 1.7 Gigabits through the air AC wireless and a "3.2 Gigabit" through the air capable router by the same company Netgear. I just trough across the room the wifi adapter not the router. When it worked worked well, better then any adapter I have ever seen. The wife does not like cables strewn throughout the house & I do not like to wait for squat. A win 10 upgrade rendered it useless, do I blame Netgear or Microsoft? I am not a betting man, but I bet Micro$oft. I mean useless not picked up in Linux as well. I will touch bases with this again on a heavy level. I will blog about it. I do blow off steam on a consistent and constant level, I may bring up the 6TB issues as well It does make me feel better to get it off my chest.
Source code:
This is far from a final product, I thought I would be nice to share source code with you as I fix the kinks in what will be introduced to tmosb (TheeMahn's O/S builder. Tmosb currently extracts such images including Raspberian:
This is not to be taken lightly, building is much more complex then extracting. Did you read the Disclaimer?
- Code: Select all
#!/bin/bash
# you need at least
# apt-get install binfmt-support qemu qemu-user-static debootstrap kpartx lvm2 dosfstools
deb_mirror="http://ports.archive.ubuntu.com/ubuntu"
ARCH="armhf"
bootsize="64M"
deb_release="xenial"
device=$1
CURRENT="$PWD"
buildenv="/root/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 [[ "$device" == "" ]]; then
echo "no block device given, just creating an image"
mkdir -p "$buildenv"
image="${buildenv}/ultimate-edition-5.0-lite-pi_${mydate}.img"
dd if=/dev/zero of="$image" bs=1MB count=3200
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
if ! [[ -b "$device" ]]; then
echo "$device is not a block device"
exit 1;
fi
fdisk $device << EOF
n
p
1
+$bootsize
t
c
n
p
2
w
EOF
partprobe
sync
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
partprobe
sync
mkfs.vfat $bootp
mkfs.ext4 $rootp
mkdir -p $rootfs
mount $rootp $rootfs
cd "$rootfs" || exit 1;
if ! [[ -f "${rootfs}/usr/bin/qemu-arm-static" ]]; then
echo "Qemu support & debootstrap Stage 1: debootstrap --arch=$ARCH --verbose --foreign $deb_release $rootfs in $PWD"
debootstrap --arch=$ARCH --verbose --foreign $deb_release $rootfs
else
echo "Debootstrap Stage 1 process has previously completed."
fi
if ! [[ -f "${rootfs}/usr/bin/qemu-arm-static" ]]; then
#debootstrap --foreign --arch=$ARCH $deb_release $rootfs $deb_local_mirror
echo "Copying qemu arm support. For stage 2"
cp /usr/bin/qemu-arm-static "${rootfs}/usr/bin/"
else
if [[ -f "/usr/bin/qemu-arm-static" ]]; then
cp /usr/bin/qemu-arm-static "${rootfs}/usr/bin/"
else
echo "qemu arm support is not installed. Exiting."
exit 1;
fi
fi
if [[ -f "${rootfs}/usr/bin/qemu-arm-static" && -d "${rootfs}/debootstrap" ]]; then
LANG=C chroot $rootfs /debootstrap/debootstrap --second-stage
else
echo "Debootstrap Stage 2 process has previously completed."
fi
if [[ -f "$CURRENT/ultimate-edition-5.0-lite-core-files.deb" && -d "${rootfs}/tmp/" ]]; then
echo "Copying core files to chroot."
cp "$CURRENT/ultimate-edition-5.0-lite-core-files.deb" ${rootfs}/tmp/
echo "Copying tmmount"
cp /usr/share/ultimate_edition/tmmount "${rootfs}/tmp/"
#echo "Injecting virtualization work-around, we will undo this later."
#echo "#${rootfs}/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so" > /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
else
echo "Injecting virtualization work-around, we will undo this later."
echo "#${rootfs}/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so" > /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
fi
mount $bootp $bootfs
echo "Injecting virtualization work-around, we will undo this later."
echo "#${rootfs}/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so" > /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
echo "Injecting sources."
#deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
if [[ "$ARCH" == "armhf" || "$ARCH" == "armel" || "$ARCH" == "powerpc" ]]; then
DEFAULTREPO="http://ports.ubuntu.com/"
CODEBASE="$deb_release"
fi
echo "Injecting $DEFAULTREPO of $CODEBASE $ARCH into sources list..."
echo "###### $UOS Repos" > "${rootfs}/etc/apt/sources.list"
echo "deb $DEFAULTREPO $CODEBASE main restricted universe multiverse" >> "${rootfs}/etc/apt/sources.list"
echo "# deb-src $DEFAULTREPO $CODEBASE main restricted universe multiverse" >> "${rootfs}/etc/apt/sources.list"
echo "" >> "${rootfs}/etc/apt/sources.list"
echo "###### $UOS Update Repos" >> "${rootfs}/etc/apt/sources.list"
echo "deb $DEFAULTREPO $CODEBASE-security main restricted universe multiverse" >> "${rootfs}/etc/apt/sources.list"
echo "deb $DEFAULTREPO $CODEBASE-updates main restricted universe multiverse" >> "${rootfs}/etc/apt/sources.list"
echo "deb $DEFAULTREPO $CODEBASE-proposed main restricted universe multiverse" >> "${rootfs}/etc/apt/sources.list"
echo "deb $DEFAULTREPO $CODEBASE-backports main restricted universe multiverse" >> "${rootfs}/etc/apt/sources.list"
echo "# deb-src $DEFAULTREPO $CODEBASE-security main restricted universe multiverse" >> "${rootfs}/etc/apt/sources.list"
echo "# deb-src $DEFAULTREPO $CODEBASE-updates main restricted universe multiverse" >> "${rootfs}/etc/apt/sources.list"
echo "# deb-src $DEFAULTREPO $CODEBASE-proposed main restricted universe multiverse" >> "${rootfs}/etc/apt/sources.list"
echo "# deb-src $DEFAULTREPO $CODEBASE-backports main restricted universe multiverse" >> "${rootfs}/etc/apt/sources.list"
echo "" >> "${rootfs}/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 "ultimate" > 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
if [[ -f /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so ]]; then
echo "Rectifing PI based work-around."
echo "#/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so" > /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
else
echo "no /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so found."
fi
debconf-set-selections /debconf.set
rm -f /debconf.set
apt-get update
apt-get -f -y dist-upgrade
apt-get -y install git-core binutils ca-certificates curl wget
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
cd /tmp/
dpkg -i ultimate-edition-5.0-lite-core-files.deb
apt-get -y install locales console-common ntp openssh-server less vim aptitude
echo \"root:raspberry\" | chpasswd
apt-get dist-upgrade
#rm -f /etc/udev/rules.d/70-persistent-net.rules
rm -f third-stage
' > third-stage
chmod +x third-stage
sudo proot -q qemu-arm -S $rootfs -b $bootfs:/boot ./third-stage
echo "#!/bin/bash
aptitude update
aptitude clean
apt-get clean
rm -f cleanup
echo "Undoing virtualization work-around."
echo "${rootfs}/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so" > /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
" > cleanup
chmod +x cleanup
LANG=C chroot $rootfs /cleanup
LANG=C
sudo proot -q qemu-arm -S $rootfs -b $bootfs:/boot /bin/bash
echo "#!/bin/bash
apt-get autoclean
apt-get clean
echo "Undoing virtualization work-around."
echo "${rootfs}/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so" > /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
rm -f cleanup
" > cleanup
chmod +x cleanup
sudo proot -q qemu-arm -S $rootfs -b $bootfs:/boot ./cleanup
#proot $rootfs /tmp/tmmount --force -r
cd
umount $bootp
umount $rootp
if [ "$image" != "" ]; then
kpartx -d $image
echo "created image $image"
fi
echo "compressing ..."
tar -czvf $image.tar.gz $image
Hardware:
Nighthawk X6 R8000 AC wireless router
Jackhammer current feeds the entire house, components can be read from my sig. (or can it)
Bedroom: Quad core Atom Baytrail running Windows 10 on a 28" higher then HD screen, USB hub, USB AC 1200 wireless adapter
Woman room: Quad core android currently (a mainboard is in route) A Solid PC with 3D Nand SSD is coming, already ordered.
Downstairs: 3D TV on a 8 core Andoer, Arm based, Bluray that is application & INTERNET friendly.
Mancave: You never know what is rolling here,
Multiple units utilizing INTERNET independently