WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: piCore-7.0alpha1  (Read 8293 times)

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
piCore-7.0alpha1
« on: August 13, 2015, 09:23:41 AM »
Team Tiny Core is pleased to announce the availability of piCore-7.0alpha1, the Raspberry Pi port of Tiny Core Linux (TC). Base system components updated to the latest upstream versions:

* kernel 4.1.4
* glibc 2.22
* BusyBox 1.23.2
* gcc 5.2.0
* e2fsprog 1.42.13
* util-linux 2.26.2

This version supports the RPi CM (Compute Module).

As a new feature Micro Python added to base. It is a small footprint version of Python 3.4 developed for embedded systems, ideal for scripting tools replacing shell.

Download links:

http://tinycorelinux.net/7.x/armv7/test_releases/ - for RPi2
http://tinycorelinux.net/7.x/armv6/test_releases/ - for all other boards

Only the SSH version is offered. If you want GUI, install TC.tcz from the repo. To get the base system with cloud mode, no persistent storage just delete the second partition, /dev/mmcblk0p2 on the SD card.

To enable special devices and interfaces check config.txt file and read https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README

The final notice, don't forget to expand /dev/mmcblk0p2 before adding extensions, as described in README.
« Last Edit: August 13, 2015, 09:50:11 AM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline sbp

  • Sr. Member
  • ****
  • Posts: 429
    • piCorePlayer homepage
Re: piCore-7.0alpha1
« Reply #1 on: August 13, 2015, 12:29:26 PM »
Hi Bela.

I'm testing the RPI2 version at the moment.

I have great sound coming from the analog onboard audio card, and USB DAC and the IQAudiO I2S audio DAC - so that is great.

Regards
Steen

I will check the wifi later.

PS: the problem we had with expanding the partition is gone in this version.
« Last Edit: August 13, 2015, 12:32:47 PM by sbp »

Offline sbp

  • Sr. Member
  • ****
  • Posts: 429
    • piCorePlayer homepage
Re: piCore-7.0alpha1
« Reply #2 on: August 13, 2015, 01:31:30 PM »
Hi Bela

I noticed one strange issue.

In piCorePlayer we have a script running from bootlocal.sh which set all the stuff we need for our audio player.

I don't know how to explain but it newer fully disappears after booting so we newer come directly to the prompt. It always needs a physical press on the "Enter" button - and then we are at the tc promt.
It has always been like this - and it is still like this.

But with the new version, there is a problem that now I can't reboot as long at our script is not terminated by an "Enter" press.

It doesn't matter how I try - via SSH and do a "sudo reboot" it wont reboot.
We use HTTPD as a web server and we have a reboot button on one of the piCorePlayer web-pages. It wont reboot.

But if I then press enter on the attached keyboard so that our boot-script terminates it reboots immediately (so it have received the reboot commands but they are not executed before we get to the terminal prompt).

It has not been like this before. Here we were able to reboot even though our script run from the bootlocal.sh file behaved just like it does now.

So what to do?

Steen

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: piCore-7.0alpha1
« Reply #3 on: August 13, 2015, 01:50:19 PM »
Hi sbp
Is the last line of your script missing a carriage return?

Offline sbp

  • Sr. Member
  • ****
  • Posts: 429
    • piCorePlayer homepage
Re: piCore-7.0alpha1
« Reply #4 on: August 13, 2015, 01:56:25 PM »
Hi Rich

This is our bootlocal.sh file:
Code: [Select]
#!/bin/sh
# put other system startup commands here

GREEN="$(echo -e '\033[1;32m')"

echo
echo "${GREEN}Running bootlocal.sh..."
/home/tc/www/cgi-bin/do_rebootstuff.sh


And this is our script called do_rebootstuff.sh

Code: [Select]
#!/bin/sh

# Version: 0.20 2015-07-09 SBP
# Revised method of loading wifi firmware.

# Version: 0.19 2015-07-04 GE
# Added dropbear fix to allow scp to work between piCorePlayers.

# Version: 0.18 2015-06-25 SBP
# Added script that automatically set correct timezone.

# Version: 0.17 2015-06-04 GE
# Renamed $pCPHOME to $PCPHOME.
# Minor updates.

# Version: 0.16 2015-05-21 SBP
# Use saved custom ALSA settings after pCP updating.

# Version: 0.16 2015-05-10 GE
# Added wait for network before starting squeezelite.

# Version: 0.15 2015-05-06 SBP
# Added logic to skip not needed options.

# Version: 0.14 2015-04-05 SBP
# Added logic to wait for soundcards and restart squeezelite if not properly started.

# Version: 0.13 2015-03-24 SBP
# Added section to load wifi for wifi only based systems (like RPi-A+).
# Revised program startup order.

# Version: 0.12 2015-02-15 SBP
# Updated order.

# Version: 0.11 2015-02-09 GE
# Added pcp_auto_start_fav.
# Added stop/start crond.
# Added pcp_user_commands.
# Moved timezone before essential stuff.
# Added ANSI colours to messages.

# Version: 0.10 2015-01-06 SBP
# Removed unneeded piCorePlayer.dep check

# Version: 0.09 2014-12-09 SBP
# Added support for the HiFiBerry AMP card.
# Moved saving to config file from extern newconfig to pcp-functions.
# Moved loading correct audio modules to pcp-functions.

# Version: 0.08 2014-10-09 SBP
# Added Analog/HDMI output selection (moved from enable/disablehdmi.sh)

# Version: 0.07 2014-10-07 GE
# Added echos for booting debugging purposes.

# Version: 0.06 2014-09-28 SBP
# Added support for the HiFiBerry+ and IQaudIO+ cards. Improved the custom ALSA settings logic.

# Version: 0.05 2014-09-04 GE
# Added cron-job variables and LMS auto-start variable.

# Version: 0.06 2014-09-09 GE
# Added pcp_auto_start_lms at end of script.

# Version: 0.05 2014-09-04 GE
# Added timezone function.

# Version: 0.04 2014-08-31 SBP
# Minor formatting.

# Version: 0.03 2014-08-30 SBP
# Clean up + added analog amixer use.
# Improved the alsamixer use.

# Version: 0.02 2014-08-26 GE
# Clean up.

# Version: 0.01 2014-06-25 SBP
# Original.

. /home/tc/www/cgi-bin/pcp-functions

# Read from pcp-functions file
echo "${GREEN}Starting piCorePlayer setup...${NORMAL}"
echo -n "${BLUE}Loading pcp-functions... ${NORMAL}"
pcp_variables
echo "${GREEN}Done.${NORMAL}"

# Read from config file.
echo -n "${BLUE}Loading configuration file... ${NORMAL}"
. $CONFIGCFG
echo "${GREEN}Done.${NORMAL}"

# Remove all traces of pCP if pCP.tcz is deleted
# for now we need to check if pCP is installed via pCP.tcz or via the old piCorePlayer
# in the future this check is not needed

# Check for pCP installed via pCP.tcz and pCP.tcz not present any more
if [ PCP_SOURCE = tcz ]; then
if [ ! -f /mnt/mmcblk0p2/tce/optional/pCP.tcz ]; then
echo "${YELLOW} Removing all traces of piCorePlayer... ${NORMAL}"
sudo sed -i "/do_rebootstuff.sh/d" /opt/bootlocal.sh
sudo sed -i "/usr\/local\/sbin\/config.cfg/d" /opt/.filetool.lst
# sudo filetool.sh -b # should be enabled later but not while testing
echo "${GREEN} Done. will reboot in 5 sec. ${NORMAL}"
wait 5
# sudo reboot # should be enabled later but not while testing
else
break
fi
else
break
fi

# Mount USB stick if present
echo "${BLUE}Checking for newconfig.cfg on sda1... ${NORMAL}"

# Check if sda1 is mounted, otherwise mount it
MNTUSB=/mnt/sda1
if mount | grep $MNTUSB; then
echo "${YELLOW}  sda1 mounted.${NORMAL}"
else
# FIX: check if sda1 is inserted before trying to mount it.
echo "${YELLOW}  Trying to mount sda1.${RED}"
sudo mount /dev/sda1 >/dev/null 2>&1
fi

# Check if newconfig.cfg is present
if [ -f $MNTUSB/newconfig.cfg ]; then
echo -n "${YELLOW}  newconfig.cfg found on sda1.${NORMAL}"
sudo dos2unix -u $MNTUSB/newconfig.cfg
# Read variables from newconfig and save to config.
. $MNTUSB/newconfig.cfg
pcp_save_to_config
pcp_set_timezone >/dev/null 2>&1
sudo mv $MNTUSB/newconfig.cfg $MNTUSB/usedconfig.cfg
if [ $AUDIO = HDMI ]; then sudo $PCPHOME/enablehdmi.sh; else sudo $PCPHOME/disablehdmi.sh; fi
else
echo -n "${YELLOW}  newconfig.cfg not found on sda1.${NORMAL}"
fi
echo "${GREEN} Done.${NORMAL}"

# Check if a newconfig.cfg file is present on mmcblk0p1 - requested by SqueezePlug and CommandorROR and used for insitu update
echo "${BLUE}Checking for newconfig.cfg on mmcblk0p1... ${NORMAL}"
pcp_mount_mmcblk0p1_nohtml >/dev/null 2>&1
if [ -f /mnt/mmcblk0p1/newconfig.cfg ]; then
echo -n "${YELLOW}  newconfig.cfg found on mmcblk0p1.${NORMAL}"
sudo dos2unix -u /mnt/mmcblk0p1/newconfig.cfg

# Read variables from newconfig, set timezone, do audio stuff save to config and backup.
. /mnt/mmcblk0p1/newconfig.cfg
pcp_timezone
#=========================================================================================
# Copy ALSA settings back so they are restored after an update
#-----------------------------------------------------------------------------------------
sudo cp /mnt/mmcblk0p1/asound.conf /etc/ >/dev/null 2>&1
sudo rm -f /mnt/mmcblk0p1/asound.conf >/dev/null 2>&1
sudo cp /mnt/mmcblk0p1/asound.state /var/lib/alsa/ >/dev/null 2>&1
sudo rm /mnt/mmcblk0p1/asound.state >/dev/null 2>&1
#-----------------------------------------------------------------------------------------
sudo rm -f /mnt/mmcblk0p1/newconfig.cfg
if [ $AUDIO = HDMI ]; then sudo $PCPHOME/enablehdmi.sh; else sudo $PCPHOME/disablehdmi.sh; fi
pcp_save_to_config
pcp_backup_nohtml >/dev/null 2>&1
else
echo -n "${YELLOW}  newconfig.cfg not found on mmcblk0p1.${NORMAL}"
fi
pcp_umount_mmcblk0p1_nohtml >/dev/null 2>&1
echo "${GREEN} Done.${NORMAL}"

# If using a RPi-A+ card or wifi manually set to on - we need to load the wireless firmware if not already loaded
if [ $WIFI = "on" ]; then
if grep -Fxq "wifi.tcz" /mnt/mmcblk0p2/tce/onboot.lst; then
echo "${GREEN}Wifi firmware already loaded.${NORMAL}"
else
# Add wifi related modules back
echo "${GREEN}Loading wifi firmware and modules.${NORMAL}"
sudo fgrep -vxf /mnt/mmcblk0p2/tce/onboot.lst /mnt/mmcblk0p2/tce/piCorePlayer.dep >> /mnt/mmcblk0p2/tce/onboot.lst
sudo -u tc tce-load -i firmware-ralinkwifi.tcz >/dev/null 2>&1
[ $? = 0 ] && echo "${YELLOW}  Ralink firmware loaded.${NORMAL}" || echo "${RED}  Ralink firmware load error.${NORMAL}"
sudo -u tc tce-load -i firmware-rtlwifi.tcz >/dev/null 2>&1
[ $? = 0 ] && echo "${YELLOW}  Realtek firmware loaded.${NORMAL}" || echo "${RED}  Realtek firmware load error.${NORMAL}"
sudo -u tc tce-load -i firmware-atheros.tcz >/dev/null 2>&1
[ $? = 0 ] && echo "${YELLOW}  Atheros firmware loaded.${NORMAL}" || echo "${RED}  Atheros firmware load error.${NORMAL}"
sudo -u tc tce-load -i wifi.tcz >/dev/null 2>&1
[ $? = 0 ] && echo "${YELLOW}  Wifi modules loaded.${NORMAL}" || echo "${RED}  Wifi modules load error.${NORMAL}"
echo "${GREEN} Done.${NORMAL}"
fi
fi

if [ $WIFI = "on" ]; then
# Save the parameters to the wifi.db
echo -n "${BLUE}Reading config.cfg... ${NORMAL}"
. /usr/local/sbin/config.cfg
echo "${GREEN}Done.${NORMAL}"

# Only add backslash if not empty
echo -n "${BLUE}Updating wifi.db... ${NORMAL}"
if [ x"" = x"$SSID" ]; then
break
else
SSSID=`echo "$SSID" | sed 's/\ /\\\ /g'`
# Change SSSID back to SSID
SSID=$SSSID
sudo echo ${SSID}$'\t'${PASSWORD}$'\t'${ENCRYPTION}> /home/tc/wifi.db
fi
echo "${GREEN}Done.${NORMAL}"
fi

# Loading configuration file config.cfg
echo -n "${BLUE}Loading configuration file... ${NORMAL}"
. $CONFIGCFG
echo "${GREEN}Done.${NORMAL}"

echo -n "${BLUE}Loading sound modules... ${NORMAL}"
sudo modprobe snd-bcm2835
sudo modprobe snd_soc_bcm2708_i2s
sudo modprobe snd_soc_wm8804
echo "${GREEN}Done.${NORMAL}"

# Connect wifi if WIFI is on
echo -n "${BLUE}Checking wifi... ${NORMAL}"
if [ $WIFI = on ]; then
echo "${YELLOW}  wifi is on.${NORMAL}"
sleep 1
sudo ifconfig wlan0 down
sudo ifconfig wlan0 up
sudo iwconfig wlan0 power off >/dev/null 2>&1
sudo /usr/local/bin/wifi.sh -a

# Try to reconnect to wifi if failed - will try two times before continuing booting
for i in 1 2; do
if ifconfig wlan0 | grep -q "inet addr:"; then
echo "${YELLOW}  wifi is connected ($i).${NORMAL}"
else
echo "${RED}  Network connection down! Attempting reconnection two times before continuing.${NORMAL}"
sudo ifconfig wlan0 down
sleep 1
sudo ifconfig wlan0 up
sleep 1
sudo iwconfig wlan0 power off >/dev/null 2>&1
sleep 1
sudo /usr/local/bin/wifi.sh -a
sleep 5
   fi
done
fi
echo "${GREEN}Done.${NORMAL}"

echo -n "${BLUE}Loading pcp-lms-functions... ${NORMAL}"
. /home/tc/www/cgi-bin/pcp-lms-functions
echo "${GREEN}Done.${NORMAL}"

# Load the correct output audio modules
echo -n "${BLUE}Loading I2S modules... ${NORMAL}"
pcp_read_chosen_audio >/dev/null 2>&1
echo "${GREEN}Done.${NORMAL}"

echo -n "${YELLOW}Waiting for soundcards to populate"
for i in 1 2 3 4 5 6 7 8 9 10; do
echo -n "."
aplay -l | grep PLAYBACK >/dev/null 2>&1
[ $? = 0 ] && break || sleep 1
done
[ $i -lt 10 ] && echo "${GREEN} Done ($i).${NORMAL}" || echo "${RED} Failed ($i).${NORMAL}"

# Check for onboard sound card is card=0 and analog is chosen, so amixer is only used here
echo -n "${BLUE}Starting ALSA configuration... ${NORMAL}"
aplay -l | grep 'card 0: ALSA'  >/dev/null 2>&1
if [ $? == 0 ] && [ $AUDIO = Analog ]; then
# Set the analog output via audio jack
sudo amixer cset numid=3 1 >/dev/null 2>&1
if [ $ALSAlevelout = Default ]; then
sudo amixer set PCM 400 unmute >/dev/null 2>&1
fi
fi

# Check for onboard sound card is card=0, and HDMI is chosen so HDMI amixer settings is enabled
aplay -l | grep 'card 0: ALSA'  >/dev/null 2>&1
if [ $? == 0 ] && [ $AUDIO = HDMI ]; then
# Set the analog output via HDMI out
sudo amixer cset numid=3 2 >/dev/null 2>&1
if [ $ALSAlevelout = Default ]; then
sudo amixer set PCM 400 unmute >/dev/null 2>&1
fi
fi

# If Custom ALSA settings are used, then restore the settings
if [ $ALSAlevelout = Custom ]; then
alsactl restore
fi
echo "${GREEN}Done.${NORMAL}"

# Start the essential stuff for piCorePlayer
echo -n "${YELLOW}Waiting for network."
CNT=1
until ifconfig | grep -q Bcast
do
if [ $((CNT++)) -gt 20 ]; then
break
else
echo -n "."
sleep 1
fi
done
echo "${GREEN} Done ($CNT).${NORMAL}"

echo -n "${BLUE}Starting Squeezelite... ${NORMAL}"
/usr/local/etc/init.d/squeezelite start >/dev/null 2>&1
echo "${GREEN}Done.${NORMAL}"

echo -n "${BLUE}Starting Dropbear SSH server... ${NORMAL}"
/usr/local/etc/init.d/dropbear start >/dev/null 2>&1
echo "${GREEN}Done.${NORMAL}"

# Dropbear fix to allow scp to work
if [ ! -e /usr/bin/dbclient ]; then
echo -n "${BLUE}Fixing Dropbear symbolic links... ${NORMAL}"
sudo ln -s /usr/local/sbin/dropbearmulti /usr/bin/dbclient
sudo ln -s /usr/local/sbin/dropbearmulti /usr/bin/scp
echo "${GREEN}Done.${NORMAL}"
fi

echo -n "${BLUE}Starting httpd web server... ${NORMAL}"
/usr/local/etc/init.d/httpd start >/dev/null 2>&1
echo "${GREEN}Done.${NORMAL}"

if [ $A_S_LMS = "Enabled" ]; then
echo -n "${BLUE}Starting auto start LMS... ${NORMAL}"
pcp_auto_start_lms
echo "${GREEN}Done.${NORMAL}"
fi

if [ $A_S_FAV = "Enabled" ]; then
echo -n "${BLUE}Starting auto start FAV... ${NORMAL}"
pcp_auto_start_fav
echo "${GREEN}Done.${NORMAL}"
fi

if [ x"" != x"$USER_COMMAND_1" ] || [ x"" != x"$USER_COMMAND_2" ] || [ x"" != x"$USER_COMMAND_3" ]; then
echo -n "${BLUE}Starting user commands... ${NORMAL}"
pcp_user_commands
echo "${GREEN}Done.${NORMAL}"
fi

if [ $JIVELITE = "YES" ]; then
echo -n "${BLUE}Starting Jivelite... ${NORMAL}"
/opt/jivelite/bin/jivelite-sp >/dev/null 2>&1
echo "${GREEN}Done.${NORMAL}"
fi

# Automatically set the timezone
if [ x"" = x"$TIMEZONE" ] && [ $(pcp_internet_accessible) = 0 ]; then
echo "${BLUE}Auto set of timezone settings, if wrong they can be changed on tweaks page... ${NORMAL}"
# Fetch timezone from Ubuntu's geoip server
TZ1=`wget -O - -q http://geoip.ubuntu.com/lookup | sed -n -e 's/.*<TimeZone>\(.*\)<\/TimeZone>.*/\1/p'`
# Translate country/city to timezone string
TIMEZONE=`wget -O - -q http://svn.fonosfera.org/fon-ng/trunk/luci/modules/admin-fon/root/etc/timezones.db | grep $TZ1 | sed "s@$TZ1 @@"`
echo "${YELLOW}Timezone settings for $TZ1 are used.${NORMAL}"
pcp_save_to_config
pcp_set_timezone >/dev/null 2>&1
TZ=$TIMEZONE
echo "${GREEN}Done.${NORMAL}"
fi

# Save the parameters to the config file
echo -n "${BLUE}Updating configuration... ${NORMAL}"
pcp_backup_nohtml >/dev/null 2>&1
echo "${GREEN}Done.${NORMAL}"

# Display the IP address
ifconfig eth0 2>&1 | grep inet >/dev/null 2>&1 && echo "${BLUE}eth0 IP: $(pcp_eth0_ip)${NORMAL}"
ifconfig wlan0 2>&1 | grep inet >/dev/null 2>&1 && echo "${BLUE}wlan0 IP: $(pcp_wlan0_ip)${NORMAL}"

echo "${GREEN}Finished piCorePlayer setup.${NORMAL}"


Steen

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: piCore-7.0alpha1
« Reply #5 on: August 13, 2015, 02:14:41 PM »
Hi sbp
Just a guess on my part, but it might be because bootlocal runs in the background. What happens if you call it from bootsync
and don't background it?


Offline sbp

  • Sr. Member
  • ****
  • Posts: 429
    • piCorePlayer homepage
Re: piCore-7.0alpha1
« Reply #6 on: August 14, 2015, 12:15:26 AM »
SORRY - my bad.

I accidentally added the bootcode pause to the cmdline in the new version I tested.
So naturally it would wait for me - stupid me.

Regards
Steen
 

Offline sbp

  • Sr. Member
  • ****
  • Posts: 429
    • piCorePlayer homepage
Re: piCore-7.0alpha1
« Reply #7 on: August 14, 2015, 12:36:42 AM »
Hi tested three different wifi dongles all working fine:

a D-Link DWA-131 using this:
r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"

a Ralink dongle using
rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin

a TP-link (Realtek) dongle using:
usbcore: registered new interface driver r8188eu

All working fine with no problems.

Steen

Offline jgrulich

  • Sr. Member
  • ****
  • Posts: 341
    • GRULICH DESIGN - R&D Lab.
Re: piCore-7.0alpha1
« Reply #8 on: August 18, 2015, 02:20:29 PM »
Hi Béla,

great job, seems that it works well.
Please share the .config file for make the kernel and kernel modules. I need some modules like w1, rtc, net-usb, raspidac3 ...

Regards,

Jan

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: piCore-7.0alpha1
« Reply #9 on: August 25, 2015, 09:39:36 PM »
Don't know where you find the time Bela.
Seems to work fine so far.

Had a look at Windows 10 IoT and Snappy for Pi, compared to piCore they are bloatware.

Been trying to use the new micropython, just because shell scripting is so yesterday:)
I think the micropython-lib needs to be tcz'ed for anyone used to python 2/3 coding.

Trying now to see if the method I used for gpio tweaking via shell script can be done by micropython.
ie read/write to files /sys/class/gpio/...
Might be easiest to just use the python interface to the pigpio daemon.
http://abyz.co.uk/rpi/pigpio/index.html

Micropython has some interesting links like this one
http://openmv.io/
Run Openmv on a Raspberry Pi?

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: piCore-7.0alpha1
« Reply #10 on: August 26, 2015, 04:57:12 AM »
@gavinmc42

Thanks for the feedback. I'm using 7.0alpha1 regularly and it works fine.

Do not know Snappy. Tried WINDOS10 IoT, it is different kind of animal. Requires minimum 8GB SD card. Has nice screens, but my ordinary USB keyboard doesn't work, WiFi stick not recognised, etc. Well, it is written on the MS WEB page, no suprise. First version, hopefully they will fix it. Good question, how much apps will be written, we will see. Good point you can work in Python, not only in C# which is not bad anyhow. For sure there are .NET anc C# guys happy to use their skills on RPi2.

MicroPython is a nice program. The os module is already part of piCore base, so you can execute external programs with os.system(), have common file system operations, etc. Will add other modules in tcz packages later.

If you want to submit pigpio.tcz you are welcome :)
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."