slitaz-arm rev 49
Renamed spi to sat-rpi (avoid name confusion)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon Mar 10 22:56:34 2014 +0100 (2014-03-10) |
parents | 8656241c4259 |
children | 77d9496b62f5 |
files | Makefile README flavors/rpi/packages.list rpi/README rpi/rootfs/etc/fstab sat-rpi spi |
line diff
1.1 --- a/Makefile Sun Mar 09 20:24:03 2014 +0100 1.2 +++ b/Makefile Mon Mar 10 22:56:34 2014 +0100 1.3 @@ -9,10 +9,10 @@ 1.4 install -m 0755 -d $(DESTDIR)$(PREFIX)/bin 1.5 #install -m 0755 -d $(DESTDIR)$(PREFIX)/share/slitaz-arm 1.6 install -m 0755 sat $(DESTDIR)$(PREFIX)/bin 1.7 - install -m 0755 spi $(DESTDIR)$(PREFIX)/bin 1.8 + install -m 0755 sat-rpi $(DESTDIR)$(PREFIX)/bin 1.9 install -m 0755 rpi/tazberry $(DESTDIR)$(PREFIX)/bin 1.10 1.11 uninstall: 1.12 rm -f $(DESTDIR)$(PREFIX)/bin/sat 1.13 - rm -f $(DESTDIR)$(PREFIX)/bin/spi 1.14 + rm -f $(DESTDIR)$(PREFIX)/bin/sat-rpi 1.15 rm -f $(DESTDIR)$(PREFIX)/bin/tazberry
2.1 --- a/README Sun Mar 09 20:24:03 2014 +0100 2.2 +++ b/README Mon Mar 10 22:56:34 2014 +0100 2.3 @@ -7,7 +7,7 @@ 2.4 2.5 Installation 2.6 -------------------------------------------------------------------------------- 2.7 -To install 'sat' and 'spi' you must have make installed: 2.8 +To install 'sat' and 'sat-rpi' you must have make installed: 2.9 2.10 # make install 2.11 2.12 @@ -21,7 +21,7 @@ 2.13 2.14 Sat quickstart 2.15 -------------- 2.16 -Sat is a tool in the spirit of all SliTaz tools, all commands and options are 2.17 +Sat is a tool in the sat-rpirit of all SliTaz tools, all commands and options are 2.18 accessible via: sat usage or help. To create a distro you first need to have 2.19 some ARM packages. You can use custom cook or the one from the SliTaz mirror. 2.20 Put all your custom *.tazpkg in the packages/ directory and sat will install
3.1 --- a/flavors/rpi/packages.list Sun Mar 09 20:24:03 2014 +0100 3.2 +++ b/flavors/rpi/packages.list Mon Mar 10 22:56:34 2014 +0100 3.3 @@ -19,3 +19,7 @@ 3.4 dropbear 3.5 nano 3.6 clex 3.7 +wireless_tools 3.8 +wpa_supplicant 3.9 +libssl 3.10 +libcrypto
4.1 --- a/rpi/README Sun Mar 09 20:24:03 2014 +0100 4.2 +++ b/rpi/README Mon Mar 10 22:56:34 2014 +0100 4.3 @@ -5,56 +5,56 @@ 4.4 SliTaz Raspberry Pi distro tools and files 4.5 4.6 4.7 -Spi quickstart 4.8 +Sat RPi quickstart 4.9 -------------------------------------------------------------------------------- 4.10 -The Raspberry Pi has a lot of specifications. SliTaz ARM provides 'spi' to build 4.11 +The Raspberry Pi has a lot of specifications. SliTaz ARM provides 'sat-rpi' to build 4.12 custom SliTaz Rpi distro images ready to boot. A SliTaz RPi prebuilt Linux kernel 4.13 package is hosted on the SliTaz mirror. To get the latest version and unpack it: 4.14 4.15 -# spi get-linux 4.16 +# sat-rpi get-linux 4.17 4.18 The 'gen' command will generate a new SliTaz Raspberry Pi distro using 'sat'. 4.19 It will also install needed firmware and boot configuration files from the 4.20 directory: rpi/rootfs. Don't forget to sync your local packages mirror before 4.21 generating the distro to get the latest versions and fixes: 4.22 4.23 -# spi gen 4.24 +# sat-rpi gen 4.25 4.26 Then you can install the distro on the sdcard. It is recommended to use 4.27 3 partitions: one for /boot formatted in FAT32, second for the swap memory 4.28 and third for the root filesystem. You can you use gparted or 'fdisk' to create 4.29 the needed partitions. Main advantages are: more memory for the RPi and 4.30 better security with file permissions. When ready and you know your disk 4.31 -path (spi ls-dev) you can install SliTaz RPi with: 4.32 +path (sat-rpi ls-dev) you can install SliTaz RPi with: 4.33 4.34 -# spi install --dev=/dev/sdX 4.35 +# sat-rpi install --dev=/dev/sdX 4.36 4.37 4.38 -Spi commands and options 4.39 +Sat RPi commands and options 4.40 -------------------------------------------------------------------------------- 4.41 To get the list of commands and options with a short help simply run: 4.42 4.43 -$ spi 4.44 +$ sat-rpi 4.45 4.46 Overclocking 4.47 ------------ 4.48 To enable overclocking select one of the suggested modes from the list. Choosing 4.49 medium is generally a good starting point without risks: 4.50 4.51 -# spi oclock 4.52 -# spi gen --oclock=medium 4.53 +# sat-rpi oclock 4.54 +# sat-rpi gen --oclock=medium 4.55 4.56 SliTaz RPi Kernel 4.57 ----------------- 4.58 -To build the Slitaz RPi Linux Kernel, Spi uses a SliTaz prebuilt ARM cross 4.59 +To build the Slitaz RPi Linux Kernel, Sat RPi uses a SliTaz prebuilt ARM cross 4.60 toolchain and a small patch to modify the kernel configuration. You can browse 4.61 -the RPi SliTaz Mirror for preview versions or get the latest toolchain with spi 4.62 +the RPi SliTaz Mirror for preview versions or get the latest toolchain with sat-rpi 4.63 and build the kernel: 4.64 4.65 -# spi get-prebuilt 4.66 -# spi cook-linux 4.67 +# sat-rpi get-prebuilt 4.68 +# sat-rpi cook-linux 4.69 4.70 -Spi Options 4.71 +Sat RPi Options 4.72 ----------- 4.73 4.74 --turbo: The forced turbo option turns off the dynamic clocks and runs the
5.1 --- a/rpi/rootfs/etc/fstab Sun Mar 09 20:24:03 2014 +0100 5.2 +++ b/rpi/rootfs/etc/fstab Mon Mar 10 22:56:34 2014 +0100 5.3 @@ -4,4 +4,4 @@ 5.4 sysfs /sys sysfs defaults 0 0 5.5 /dev/mmcblk0p1 /boot auto noauto,noatime 1 2 5.6 /dev/mmcblk0p2 none swap sw 0 0 5.7 -/dev/mmcblk0p3 / ext4 noatime 0 1 5.8 +/dev/mmcblk0p3 / btrfs noatime 0 1
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/sat-rpi Mon Mar 10 22:56:34 2014 +0100 6.3 @@ -0,0 +1,485 @@ 6.4 +#!/bin/sh 6.5 +# 6.6 +# Sat RPi - SliTaz Raspberry Pi Build Tool 6.7 +# 6.8 +# Copyright (C) 2012-2014 SliTaz ARM - BSD License 6.9 +# Author: Christophe Lincoln <pankso@slitaz.org> 6.10 +# 6.11 +. /lib/libtaz.sh 6.12 + 6.13 +#: ${arch=armv6hf} 6.14 +: ${arch=arm} 6.15 + 6.16 +# Paths 6.17 +[ "$work" ] || work="$(pwd)" 6.18 +distro="$work/distro" 6.19 +rpi="$work/rpi" 6.20 +data="$rpi/data" 6.21 +boot="$distro/boot" 6.22 +rootfs="$distro/rootfs" 6.23 +rpi_git="$rpi/git" 6.24 +kernel="$rpi_git/linux" 6.25 +firmware="$rpi_git/firmware" 6.26 +tools="$rpi_git/tools" 6.27 + 6.28 +# URLs 6.29 +rpi_mirror="http://mirror.slitaz.org/arm/rpi/" 6.30 +fw_url="https://github.com/raspberrypi/firmware/raw/master/boot/" 6.31 +tools_url="https://raw.github.com/raspberrypi/tools/master/mkimage/" 6.32 +rpi_git_url="git://github.com/raspberrypi/" 6.33 + 6.34 +# Lists 6.35 +fwlist="bootcode.bin fixup.dat start.elf" 6.36 +toolslist="imagetool-uncompressed.py args-uncompressed.txt \ 6.37 +boot-uncompressed.txt" 6.38 + 6.39 +# 6.40 +# Functions 6.41 +# 6.42 + 6.43 +usage() { 6.44 + cat << EOT 6.45 + 6.46 +$(boldify "Usage:") $(basename $0) [command] [--option] 6.47 + 6.48 +SliTaz Raspberry Pi Tool 6.49 + 6.50 +$(boldify "Commands:") 6.51 + info Display paths and distro info 6.52 + install Install SliTaz RPi to sdcard 6.53 + gen Generate a new SliTaz RPi distro 6.54 + cook-linux Build the Raspberry Pi Linux kernel 6.55 + get-linux Get the SliTaz RPi linux package 6.56 + get-fw Download or update minimal RPi firmware 6.57 + clone-fw Clone the RPi firmware repository 6.58 + get-tools Download or update RPi Tools (mkimage) 6.59 + get-prebuilt Get a prebuilt SliTaz ARM toolchain 6.60 + clean Clean the current work directory 6.61 + 6.62 +$(boldify "Options:") 6.63 + --up Update for commands: firmware, tools, kernel 6.64 + --turbo Force the RPi to run at the highest arm_freq 6.65 + --oclock= Set the RPi overclocking mode in config.txt 6.66 + --vc Install the RPi VC libraries in /opt/vc 6.67 + --nosat Don't regenerate the distro with sat 6.68 + --git Remove RPi git files on clean up 6.69 + 6.70 +EOT 6.71 +} 6.72 + 6.73 +error() { 6.74 + echo "[ $(colorize 31 'ERROR') ] $@" 6.75 +} 6.76 + 6.77 +header() { 6.78 + newline 6.79 + boldify "$@" 6.80 + separator 6.81 +} 6.82 + 6.83 +# Get minimal RPi firmware 6.84 +get_fw() { 6.85 + mkdir -p $firmware/boot 6.86 + for fw in $fwlist 6.87 + do 6.88 + [ "$up" ] && rm -f $firmware/boot/$fw 6.89 + if [ ! -f "$firmware/boot/$fw" ]; then 6.90 + echo -n "Fetching: $fw" 6.91 + wget -q --no-check-certificate ${fw_url}${fw} \ 6.92 + -O $firmware/boot/${fw}; status 6.93 + fi 6.94 + done 6.95 +} 6.96 + 6.97 +# Get all RPi firmware 6.98 +clone_fw() { 6.99 + [ -d "${rpi_git}/firmware" ] && return 0 6.100 + mkdir -p ${rpi_git} && cd ${rpi_git} 6.101 + git clone --depth 1 ${rpi_git_url}firmware.git 6.102 +} 6.103 + 6.104 +# Get RPi tools 6.105 +get_tools() { 6.106 + mkdir -p $tools 6.107 + for t in $toolslist 6.108 + do 6.109 + [ "$up" ] && rm -f ${tools}/${t} 6.110 + if [ ! -f "$tools/$t" ]; then 6.111 + echo -n "Fetching: $t" 6.112 + wget -q --no-check-certificate ${tools_url}${t} \ 6.113 + -O ${tools}/${t}; status 6.114 + fi 6.115 + done 6.116 +} 6.117 + 6.118 +# --> will move to tazberry 6.119 +set_oclock() { 6.120 + case "$oclock" in 6.121 + none) 6.122 + arm_freq=700 6.123 + core_freq=250 6.124 + sdram_freq=400 6.125 + over_voltage=0 ;; 6.126 + modest) 6.127 + arm_freq=800 6.128 + core_freq=300 6.129 + sdram_freq=400 6.130 + over_voltage=0 ;; 6.131 + medium) 6.132 + arm_freq=900 6.133 + core_freq=333 6.134 + sdram_freq=450 6.135 + over_voltage=2 ;; 6.136 + hight) 6.137 + arm_freq=950 6.138 + core_freq=450 6.139 + sdram_freq=450 6.140 + over_voltage=6 ;; 6.141 + turbo) 6.142 + arm_freq=1000 6.143 + core_freq=500 6.144 + sdram_freq=500 6.145 + over_voltage=6 ;; 6.146 + esac 6.147 + cat >> ${boot}/config.txt << EOT 6.148 +arm_freq=$arm_freq 6.149 +core_freq=$core_freq 6.150 +sdram_freq=$sdram_freq 6.151 +over_voltage=$over_voltage 6.152 +EOT 6.153 +} 6.154 + 6.155 +# 6.156 +# Commands 6.157 +# 6.158 + 6.159 +case "$1" in 6.160 + info) 6.161 + header "SliTaz Raspberry Pi info" 6.162 + echo "Firmware : $fwlist" 6.163 + echo "RPi path : $rpi" 6.164 + colorize 36 "/boot/cmdline.txt:" 6.165 + cat ${boot}/cmdline.txt 6.166 + colorize 36 "/boot/config.txt:" 6.167 + cat ${boot}/config.txt 6.168 + separator && newline ;; 6.169 + 6.170 + install) 6.171 + rpiboot="/media/rpi/boot" 6.172 + rpiroot="/media/rpi/rootfs" 6.173 + header "SliTaz Raspberry Pi install" 6.174 + if [ ! "$dev" ]; then 6.175 + echo "Missing: --dev= cmdline option" 6.176 + newline && exit 1 6.177 + fi 6.178 + 6.179 + # Store sdcard partition(s) list 6.180 + fdisk -l /dev/${dev} | grep "^/dev/$dev" | awk '{print $1}' \ 6.181 + > ${data}/sdcard.part 6.182 + partnb=$(cat ${data}/sdcard.part | wc -l) 6.183 + if [ "$partnb" != 3 ]; then 6.184 + error "SliTaz RPi needs 3 partitions on the sdcard" 6.185 + newline && exit 1 6.186 + fi 6.187 + 6.188 + # Mount sdcard 6.189 + if mount | grep -q "^/dev/$dev[1-3]"; then 6.190 + debug "Unmounting: /dev/$dev" 6.191 + umount /dev/${dev}1 2>/dev/null || exit 1 6.192 + umount /dev/${dev}3 2>/dev/null || exit 1 6.193 + fi 6.194 + echo -n "Mounting: /dev/$dev partitions" 6.195 + mkdir -p ${rpiboot} ${rpiroot} 6.196 + mount /dev/${dev}1 ${rpiboot} 6.197 + mount /dev/${dev}3 ${rpiroot}; status 6.198 + echo -n "Cleaning: filesystem directories" 6.199 + for dir in bin dev etc lib media mnt proc sbin sys tmp usr var run 6.200 + do 6.201 + rm -rf ${rpiroot}/${dir} 6.202 + done; status 6.203 + echo -n "Installing: boot files" 6.204 + cp -rf ${boot}/* ${rpiboot}; status 6.205 + echo -n "Installing: rootfs files" 6.206 + cp -a ${rootfs}/* ${rpiroot}; status 6.207 + 6.208 + # Unmount 6.209 + echo -n "Unmounting: RPi sdcard" 6.210 + umount ${rpiboot} || exit 1 6.211 + umount ${rpiroot} || exit 1 6.212 + status 6.213 + 6.214 + # Boot flag 6.215 + #echo -n "Setting boot flag on: /dev/${dev}1" 6.216 + #fdisk /dev/${dev} >/dev/null << EOF 6.217 +#a 6.218 +#1 6.219 +#w 6.220 +#EOF 6.221 + #status 6.222 + rm -f ${data}/sdcard.part 6.223 + separator && newline ;; 6.224 + 6.225 + ls-dev) 6.226 + newline 6.227 + fdisk -l | grep "^Disk /dev/sd*" 6.228 + newline ;; 6.229 + 6.230 + gen) 6.231 + # Separate boot files since the Raspberry Pi boots off a FAT32 /boot 6.232 + # partition on the sdcard. 6.233 + : ${flavor=rpi} 6.234 + : ${oclock=none} 6.235 + 6.236 + # Use the rootfs generated by sat 6.237 + if [ ! -x "/usr/bin/sat" ]; then 6.238 + error "Sat is not installed" && exit 1 6.239 + fi 6.240 + 6.241 + # We may want to simply regenerate the RPi distro 6.242 + if [ ! "$nosat" ]; then 6.243 + sat gen --work="$work" --flavor="$flavor" --kmap --noinit --rpi 6.244 + fi 6.245 + 6.246 + header "SliTaz Raspberry Pi distro" 6.247 + 6.248 + # Boot firmware 6.249 + echo -n "Copying: firmware files..." 6.250 + mkdir -p ${boot} && get_fw 6.251 + for fw in $fwlist 6.252 + do 6.253 + cp ${firmware}/boot/${fw} ${boot} 6.254 + done 6.255 + status 6.256 + 6.257 + # SliTaz Raspberry Pi custom rootfs files. Make sure all files 6.258 + # belong to root 6.259 + if [ -d "$rpi/rootfs" ]; then 6.260 + size=$(du -sh $rpi/rootfs | awk '{print $1}') 6.261 + echo -n "Copying: SliTaz RPi rootfs ($size)" 6.262 + tmp=${distro}/tmp-$$ 6.263 + mkdir -p ${tmp} 6.264 + cp -r ${rpi}/rootfs/* ${tmp} 6.265 + chown -R root.root ${tmp} 6.266 + cp -a ${tmp}/* ${rootfs} && rm -rf ${tmp} 6.267 + # Move files to $boot 6.268 + mv -f ${rootfs}/boot/* ${boot} 6.269 + status 6.270 + fi 6.271 + 6.272 + # TazBerry 6.273 + echo -n "Installing TazBerry..." 6.274 + cp -f ${rpi}/tazberry ${rootfs}/usr/bin 6.275 + status 6.276 + 6.277 + # Overclocking 6.278 + echo -n "Setting: Overclocking..." 6.279 + set_oclock; status 6.280 + 6.281 + # Force turbo 6.282 + if [ "$turbo" ]; then 6.283 + if ! fgrep 'force_turbo=1' ${boot}/config.txt; then 6.284 + echo -n "Config: force_turbo=1" 6.285 + echo "force_turbo=1" >> ${boot}/config.txt; status 6.286 + fi 6.287 + fi 6.288 + 6.289 + # RPi VC libraries 6.290 + if [ "$vc" ]; then 6.291 + vc="${rootfs}/opt/vc" 6.292 + if [ ! -d "$firmware/opt/vc" ]; then 6.293 + error "Missing firmware git repository" && exit 1 6.294 + fi 6.295 + echo -n "Copying: standard VC libraries" 6.296 + cp -a ${firmware}/opt ${rootfs} 6.297 + # --> armv6hf 6.298 + #cp -a ${firmware}/hardfp/opt ${rootfs} 6.299 + chown -R root.root ${rootfs}/opt 6.300 + status 6.301 + echo -n "Cleaning: VC libraries devel files" 6.302 + cross_tools="/cross/${arch}/tools/bin" 6.303 + rm -rf ${vc}/include ${vc}/src ${vc}/lib/*.a 6.304 + ${cross_tools}/${arch}-slitaz-linux-gnueabi-strip -s ${vc}/lib/*.so 6.305 + status 6.306 + fi 6.307 + 6.308 + # Kernel at last 6.309 + . $data/linux-*/receipt 6.310 + kvers="$VERSION" 6.311 + kpkg="$rootfs/var/lib/tazpkg/installed/linux" 6.312 + fs="$data/linux-$kvers/fs" 6.313 + ksize=$(du -sh $fs | awk '{print $1}') 6.314 + if [ -d "$fs" ]; then 6.315 + echo -n "Copying: kernel $kvers ($ksize)" 6.316 + rm -rf ${rootfs}/lib/modules 6.317 + cp -rf ${fs}/lib/* ${rootfs}/lib 6.318 + cp -f ${fs}/boot/* ${boot} 6.319 + mkdir -p ${kpkg} 6.320 + cd ${data}/linux-${kvers} 6.321 + cp -f files.list md5sum receipt ${kpkg} 6.322 + status 6.323 + else 6.324 + echo "RPi Kernel: not used" 6.325 + fi 6.326 + 6.327 + separator 6.328 + echo -n "Boot: $(du -sh $boot | awk '{print $1}') " 6.329 + echo "- Rootfs: $(du -sh $rootfs | awk '{print $1}')" 6.330 + newline ;; 6.331 + 6.332 + cook-linux) 6.333 + # Native SliTaz Toolchain and cross toolchain must be installed 6.334 + check_root 6.335 + install="$data/linux-install" 6.336 + if [ ! -d "/cross/$arch" ]; then 6.337 + error "Missing cross toolchain in: /cross/$arch" 6.338 + exit 1 6.339 + fi 6.340 + 6.341 + # Kernel source 6.342 + cd ${rpi_git} 6.343 + [ -d "$kernel" ] || git clone --depth 1 ${rpi_git_url}linux.git 6.344 + 6.345 + # Compile 6.346 + if [ ! -d "$install" ]; then 6.347 + cd ${kernel} 6.348 + export PATH=$PATH:/cross/${arch}/tools/bin 6.349 + export HOST_SYSTEM=${arch}-slitaz-linux-gnueabi 6.350 + make mrproper && 6.351 + make ARCH=arm bcmrpi_defconfig 6.352 + echo "Patching SliTaz RPi Linux .config" 6.353 + patch -p1 -i ${rpi}/linux-rpi.config || exit 1 6.354 + make ARCH=arm CROSS_COMPILE=${HOST_SYSTEM}- zImage && 6.355 + make ARCH=arm CROSS_COMPILE=${HOST_SYSTEM}- modules && 6.356 + make ARCH=arm CROSS_COMPILE=${HOST_SYSTEM}- \ 6.357 + INSTALL_MOD_PATH=${install} modules_install || exit 1 6.358 + mkdir -p ${install}/boot 6.359 + cp -a arch/arm/boot/zImage ${install}/boot 6.360 + fi 6.361 + 6.362 + # Kernel version 6.363 + kvers=$(ls ${install}/lib/modules) 6.364 + kvers=${kvers%-slitaz-rpi+}+ 6.365 + 6.366 + # Compress modules 6.367 + cd ${install}/lib/modules/${kvers%+}-slitaz-rpi+/ || exit 1 6.368 + mods=$(find . -name "*.ko$" | wc -l) 6.369 + newline 6.370 + echo "Compressing kernel modules: $mods" 6.371 + find . -name "*.ko$" -exec gzip '{}' \; #2> /dev/null 6.372 + #find . -name "*.ko" -exec rm '{}' \; 6.373 + # Rebuild modules.dep 6.374 + cd ${install} 6.375 + depmod -b . ${kvers%+}-slitaz-rpi+ 6.376 + 6.377 + # Pack 6.378 + fs="$data/linux-$kvers/fs" 6.379 + echo "Kernel version: $kvers" 6.380 + if [ -d "$install" ]; then 6.381 + rm -rf ${data}/linux-${kvers} 6.382 + mkdir -p ${data}/linux-${kvers} 6.383 + cp -a ${install} ${fs} 6.384 + rm -f ${fs}/lib/modules/*/build ${fs}/lib/modules/*/source 6.385 + fi 6.386 + get_tools 6.387 + echo "Compressing: zImage to kernel.img" 6.388 + cd ${tools} 6.389 + python imagetool-uncompressed.py ${fs}/boot/zImage 6.390 + mv -f kernel.img ${fs}/boot && rm ${fs}/boot/zImage 6.391 + cd ${data} 6.392 + echo "Creating package: receipt" 6.393 + cat > linux-$kvers/receipt << EOT 6.394 +# SliTaz package receipt 6.395 + 6.396 +PACKAGE="linux" 6.397 +VERSION="$kvers" 6.398 +SHORT_DESC="SliTaz Linux Kernel for the Raspberry Pi." 6.399 +WEB_SITE="http://www.kernel.org" 6.400 + 6.401 +EOT 6.402 + tazpkg pack linux-$kvers ;; 6.403 + 6.404 + get-fw) 6.405 + get_fw ;; 6.406 + 6.407 + get-tools) 6.408 + get_tools ;; 6.409 + 6.410 + get-linux) 6.411 + # Precook RPi kernel 6.412 + mkdir -p ${data} 6.413 + 6.414 + # Last version 6.415 + rm -f ${data}/linux-version.txt 6.416 + if busybox wget -q -s ${rpi_mirror}/last-linux.txt; then 6.417 + echo -n "Fetching latest Kernel string..." 6.418 + wget -q ${rpi_mirror}/last-linux.txt \ 6.419 + -O ${data}/linux-version.txt || exit 1 6.420 + status 6.421 + else 6.422 + echo "Mirror is unreachable" && exit 1 6.423 + fi 6.424 + kvers=$(cat $data/linux-version.txt) 6.425 + [ "$up" ] && rm -rf ${data}/linux-${kvers}* 6.426 + echo "Kernel version: $kvers" 6.427 + 6.428 + # Download 6.429 + if [ ! -f "$data/linux-$kvers.tazpkg" ]; then 6.430 + echo -n "Fetching latest Linux package..." 6.431 + wget -q ${rpi_mirror}/linux-${kvers}.tazpkg \ 6.432 + -O ${data}/linux-${kvers}.tazpkg; status 6.433 + fi 6.434 + 6.435 + # Extract 6.436 + if [ ! -d "$data/linux-$kvers" ]; then 6.437 + cd ${data} && tazpkg extract linux-${kvers}.tazpkg 6.438 + fi 6.439 + rm -f ${data}/linux-version.txt ;; 6.440 + 6.441 + get-prebuilt) 6.442 + # --> in cross ?? 6.443 + : ${arch=arm} 6.444 + name="slitaz-$arch-toolchain" 6.445 + vers="20140304" 6.446 + tarball="$name-$vers.tar.bz2" 6.447 + url="http://mirror.slitaz.org/packages/cross/" 6.448 + mkdir -p /cross 6.449 + cd /cross 6.450 + if [ ! -f "$tarball" ]; then 6.451 + if busybox wget -qs ${url%/}/${tarball}; then 6.452 + busybox wget ${url%/}/${tarball} 6.453 + else 6.454 + echo "Toolchain URL is unreachable" && exit 1 6.455 + fi 6.456 + fi 6.457 + if [ ! -d "${name}-${vers}" ]; then 6.458 + echo "Extracting: $tarball" 6.459 + tar xjf ${tarball} 6.460 + fi 6.461 + echo "Copying: ${name}-${vers}/${arch}" 6.462 + mkdir -p ${arch} 6.463 + cp -a ${name}-${vers}/${arch}/* ${arch} 6.464 + echo "Tools path: /cross/${arch}/tools/bin" ;; 6.465 + 6.466 + clone-fw) 6.467 + clone_fw ;; 6.468 + 6.469 + release) 6.470 + # Used to release official SliTaz RPi images 6.471 + cd ${distro} || exit 1 6.472 + if [ ! "$flavor" ]; then 6.473 + . $distro/rootfs/etc/slitaz/flavor.conf || exit 1 6.474 + flavor="$FLAVOR" 6.475 + fi 6.476 + dirname="slitaz-$flavor-$(date +%Y%m%d)" 6.477 + dsize=$(du -sh $distro | awk '{print $1}' | cut -d "." -f 1) 6.478 + mkdir ${dirname} 6.479 + # To be continued... 6.480 + ;; 6.481 + 6.482 + clean) 6.483 + echo "Cleaning: $rpi" 6.484 + rm -rf ${data} 6.485 + [ "$git" ] && rm -rf ${rpi_git} ;; 6.486 + *) usage ;; 6.487 +esac 6.488 +exit 0
7.1 --- a/spi Sun Mar 09 20:24:03 2014 +0100 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,485 +0,0 @@ 7.4 -#!/bin/sh 7.5 -# 7.6 -# Spi - SliTaz Raspberry Pi Build Tool 7.7 -# 7.8 -# Copyright (C) 2012-2014 SliTaz ARM - BSD License 7.9 -# Author: Christophe Lincoln <pankso@slitaz.org> 7.10 -# 7.11 -. /lib/libtaz.sh 7.12 - 7.13 -#: ${arch=armv6hf} 7.14 -: ${arch=arm} 7.15 - 7.16 -# Paths 7.17 -[ "$work" ] || work="$(pwd)" 7.18 -distro="$work/distro" 7.19 -rpi="$work/rpi" 7.20 -data="$rpi/data" 7.21 -boot="$distro/boot" 7.22 -rootfs="$distro/rootfs" 7.23 -rpi_git="$rpi/git" 7.24 -kernel="$rpi_git/linux" 7.25 -firmware="$rpi_git/firmware" 7.26 -tools="$rpi_git/tools" 7.27 - 7.28 -# URLs 7.29 -rpi_mirror="http://mirror.slitaz.org/arm/rpi/" 7.30 -fw_url="https://github.com/raspberrypi/firmware/raw/master/boot/" 7.31 -tools_url="https://raw.github.com/raspberrypi/tools/master/mkimage/" 7.32 -rpi_git_url="git://github.com/raspberrypi/" 7.33 - 7.34 -# Lists 7.35 -fwlist="bootcode.bin fixup.dat start.elf" 7.36 -toolslist="imagetool-uncompressed.py args-uncompressed.txt \ 7.37 -boot-uncompressed.txt" 7.38 - 7.39 -# 7.40 -# Functions 7.41 -# 7.42 - 7.43 -usage() { 7.44 - cat << EOT 7.45 - 7.46 -$(boldify "Usage:") $(basename $0) [command] [--option] 7.47 - 7.48 -SliTaz Raspberry Pi Tool 7.49 - 7.50 -$(boldify "Commands:") 7.51 - info Display paths and distro info 7.52 - install Install SliTaz RPi to sdcard 7.53 - gen Generate a new SliTaz RPi distro 7.54 - cook-linux Build the Raspberry Pi Linux kernel 7.55 - get-linux Get the SliTaz RPi linux package 7.56 - get-fw Download or update minimal RPi firmware 7.57 - clone-fw Clone the RPi firmware repository 7.58 - get-tools Download or update RPi Tools (mkimage) 7.59 - get-prebuilt Get a prebuilt SliTaz ARM toolchain 7.60 - clean Clean the current work directory 7.61 - 7.62 -$(boldify "Options:") 7.63 - --up Update for commands: firmware, tools, kernel 7.64 - --turbo Force the RPi to run at the highest arm_freq 7.65 - --oclock= Set the RPi overclocking mode in config.txt 7.66 - --vc Install the RPi VC libraries in /opt/vc 7.67 - --nosat Don't regenerate the distro with sat 7.68 - --git Remove RPi git files on clean up 7.69 - 7.70 -EOT 7.71 -} 7.72 - 7.73 -error() { 7.74 - echo "[ $(colorize 31 'ERROR') ] $@" 7.75 -} 7.76 - 7.77 -header() { 7.78 - newline 7.79 - boldify "$@" 7.80 - separator 7.81 -} 7.82 - 7.83 -# Get minimal RPi firmware 7.84 -get_fw() { 7.85 - mkdir -p $firmware/boot 7.86 - for fw in $fwlist 7.87 - do 7.88 - [ "$up" ] && rm -f $firmware/boot/$fw 7.89 - if [ ! -f "$firmware/boot/$fw" ]; then 7.90 - echo -n "Fetching: $fw" 7.91 - wget -q --no-check-certificate ${fw_url}${fw} \ 7.92 - -O $firmware/boot/${fw}; status 7.93 - fi 7.94 - done 7.95 -} 7.96 - 7.97 -# Get all RPi firmware 7.98 -clone_fw() { 7.99 - [ -d "${rpi_git}/firmware" ] && return 0 7.100 - mkdir -p ${rpi_git} && cd ${rpi_git} 7.101 - git clone --depth 1 ${rpi_git_url}firmware.git 7.102 -} 7.103 - 7.104 -# Get RPi tools 7.105 -get_tools() { 7.106 - mkdir -p $tools 7.107 - for t in $toolslist 7.108 - do 7.109 - [ "$up" ] && rm -f ${tools}/${t} 7.110 - if [ ! -f "$tools/$t" ]; then 7.111 - echo -n "Fetching: $t" 7.112 - wget -q --no-check-certificate ${tools_url}${t} \ 7.113 - -O ${tools}/${t}; status 7.114 - fi 7.115 - done 7.116 -} 7.117 - 7.118 -# --> will move to tazberry 7.119 -set_oclock() { 7.120 - case "$oclock" in 7.121 - none) 7.122 - arm_freq=700 7.123 - core_freq=250 7.124 - sdram_freq=400 7.125 - over_voltage=0 ;; 7.126 - modest) 7.127 - arm_freq=800 7.128 - core_freq=300 7.129 - sdram_freq=400 7.130 - over_voltage=0 ;; 7.131 - medium) 7.132 - arm_freq=900 7.133 - core_freq=333 7.134 - sdram_freq=450 7.135 - over_voltage=2 ;; 7.136 - hight) 7.137 - arm_freq=950 7.138 - core_freq=450 7.139 - sdram_freq=450 7.140 - over_voltage=6 ;; 7.141 - turbo) 7.142 - arm_freq=1000 7.143 - core_freq=500 7.144 - sdram_freq=500 7.145 - over_voltage=6 ;; 7.146 - esac 7.147 - cat >> ${boot}/config.txt << EOT 7.148 -arm_freq=$arm_freq 7.149 -core_freq=$core_freq 7.150 -sdram_freq=$sdram_freq 7.151 -over_voltage=$over_voltage 7.152 -EOT 7.153 -} 7.154 - 7.155 -# 7.156 -# Commands 7.157 -# 7.158 - 7.159 -case "$1" in 7.160 - info) 7.161 - header "SliTaz Raspberry Pi info" 7.162 - echo "Firmware : $fwlist" 7.163 - echo "RPi path : $rpi" 7.164 - colorize 36 "/boot/cmdline.txt:" 7.165 - cat ${boot}/cmdline.txt 7.166 - colorize 36 "/boot/config.txt:" 7.167 - cat ${boot}/config.txt 7.168 - separator && newline ;; 7.169 - 7.170 - install) 7.171 - rpiboot="/media/rpi/boot" 7.172 - rpiroot="/media/rpi/rootfs" 7.173 - header "SliTaz Raspberry Pi install" 7.174 - if [ ! "$dev" ]; then 7.175 - echo "Missing: --dev= cmdline option" 7.176 - newline && exit 1 7.177 - fi 7.178 - 7.179 - # Store sdcard partition(s) list 7.180 - fdisk -l /dev/${dev} | grep "^/dev/$dev" | awk '{print $1}' \ 7.181 - > ${data}/sdcard.part 7.182 - partnb=$(cat ${data}/sdcard.part | wc -l) 7.183 - if [ "$partnb" != 3 ]; then 7.184 - error "SliTaz RPi needs 3 partitions on the sdcard" 7.185 - newline && exit 1 7.186 - fi 7.187 - 7.188 - # Mount sdcard 7.189 - if mount | grep -q "^/dev/$dev[1-3]"; then 7.190 - debug "Unmounting: /dev/$dev" 7.191 - umount /dev/${dev}1 2>/dev/null || exit 1 7.192 - umount /dev/${dev}3 2>/dev/null || exit 1 7.193 - fi 7.194 - echo -n "Mounting: /dev/$dev partitions" 7.195 - mkdir -p ${rpiboot} ${rpiroot} 7.196 - mount /dev/${dev}1 ${rpiboot} 7.197 - mount /dev/${dev}3 ${rpiroot}; status 7.198 - echo -n "Cleaning: filesystem directories" 7.199 - for dir in bin dev etc lib media mnt proc sbin sys tmp usr var run 7.200 - do 7.201 - rm -rf ${rpiroot}/${dir} 7.202 - done; status 7.203 - echo -n "Installing: boot files" 7.204 - cp -rf ${boot}/* ${rpiboot}; status 7.205 - echo -n "Installing: rootfs files" 7.206 - cp -a ${rootfs}/* ${rpiroot}; status 7.207 - 7.208 - # Unmount 7.209 - echo -n "Unmounting: RPi sdcard" 7.210 - umount ${rpiboot} || exit 1 7.211 - umount ${rpiroot} || exit 1 7.212 - status 7.213 - 7.214 - # Boot flag 7.215 - #echo -n "Setting boot flag on: /dev/${dev}1" 7.216 - #fdisk /dev/${dev} >/dev/null << EOF 7.217 -#a 7.218 -#1 7.219 -#w 7.220 -#EOF 7.221 - #status 7.222 - rm -f ${data}/sdcard.part 7.223 - separator && newline ;; 7.224 - 7.225 - ls-dev) 7.226 - newline 7.227 - fdisk -l | grep "^Disk /dev/sd*" 7.228 - newline ;; 7.229 - 7.230 - gen) 7.231 - # Separate boot files since the Raspberry Pi boots off a FAT32 /boot 7.232 - # partition on the sdcard. 7.233 - : ${flavor=rpi} 7.234 - : ${oclock=none} 7.235 - 7.236 - # Use the rootfs generated by sat 7.237 - if [ ! -x "/usr/bin/sat" ]; then 7.238 - error "Sat is not installed" && exit 1 7.239 - fi 7.240 - 7.241 - # We may want to simply regenerate the RPi distro 7.242 - if [ ! "$nosat" ]; then 7.243 - sat gen --work="$work" --flavor="$flavor" --kmap --noinit --rpi 7.244 - fi 7.245 - 7.246 - header "SliTaz Raspberry Pi distro" 7.247 - 7.248 - # Boot firmware 7.249 - echo -n "Copying: firmware files..." 7.250 - mkdir -p ${boot} && get_fw 7.251 - for fw in $fwlist 7.252 - do 7.253 - cp ${firmware}/boot/${fw} ${boot} 7.254 - done 7.255 - status 7.256 - 7.257 - # SliTaz Raspberry Pi custom rootfs files. Make sure all files 7.258 - # belong to root 7.259 - if [ -d "$rpi/rootfs" ]; then 7.260 - size=$(du -sh $rpi/rootfs | awk '{print $1}') 7.261 - echo -n "Copying: SliTaz RPi rootfs ($size)" 7.262 - tmp=${distro}/tmp-$$ 7.263 - mkdir -p ${tmp} 7.264 - cp -r ${rpi}/rootfs/* ${tmp} 7.265 - chown -R root.root ${tmp} 7.266 - cp -a ${tmp}/* ${rootfs} && rm -rf ${tmp} 7.267 - # Move files to $boot 7.268 - mv -f ${rootfs}/boot/* ${boot} 7.269 - status 7.270 - fi 7.271 - 7.272 - # TazBerry 7.273 - echo -n "Installing TazBerry..." 7.274 - cp -f ${rpi}/tazberry ${rootfs}/usr/bin 7.275 - status 7.276 - 7.277 - # Overclocking 7.278 - echo -n "Setting: Overclocking..." 7.279 - set_oclock; status 7.280 - 7.281 - # Force turbo 7.282 - if [ "$turbo" ]; then 7.283 - if ! fgrep 'force_turbo=1' ${boot}/config.txt; then 7.284 - echo -n "Config: force_turbo=1" 7.285 - echo "force_turbo=1" >> ${boot}/config.txt; status 7.286 - fi 7.287 - fi 7.288 - 7.289 - # RPi VC libraries 7.290 - if [ "$vc" ]; then 7.291 - vc="${rootfs}/opt/vc" 7.292 - if [ ! -d "$firmware/opt/vc" ]; then 7.293 - error "Missing firmware git repository" && exit 1 7.294 - fi 7.295 - echo -n "Copying: standard VC libraries" 7.296 - cp -a ${firmware}/opt ${rootfs} 7.297 - # --> armv6hf 7.298 - #cp -a ${firmware}/hardfp/opt ${rootfs} 7.299 - chown -R root.root ${rootfs}/opt 7.300 - status 7.301 - echo -n "Cleaning: VC libraries devel files" 7.302 - cross_tools="/cross/${arch}/tools/bin" 7.303 - rm -rf ${vc}/include ${vc}/src ${vc}/lib/*.a 7.304 - ${cross_tools}/${arch}-slitaz-linux-gnueabi-strip -s ${vc}/lib/*.so 7.305 - status 7.306 - fi 7.307 - 7.308 - # Kernel at last 7.309 - . $data/linux-*/receipt 7.310 - kvers="$VERSION" 7.311 - kpkg="$rootfs/var/lib/tazpkg/installed/linux" 7.312 - fs="$data/linux-$kvers/fs" 7.313 - ksize=$(du -sh $fs | awk '{print $1}') 7.314 - if [ -d "$fs" ]; then 7.315 - echo -n "Copying: kernel $kvers ($ksize)" 7.316 - rm -rf ${rootfs}/lib/modules 7.317 - cp -rf ${fs}/lib/* ${rootfs}/lib 7.318 - cp -f ${fs}/boot/* ${boot} 7.319 - mkdir -p ${kpkg} 7.320 - cd ${data}/linux-${kvers} 7.321 - cp -f files.list md5sum receipt ${kpkg} 7.322 - status 7.323 - else 7.324 - echo "RPi Kernel: not used" 7.325 - fi 7.326 - 7.327 - separator 7.328 - echo -n "Boot: $(du -sh $boot | awk '{print $1}') " 7.329 - echo "- Rootfs: $(du -sh $rootfs | awk '{print $1}')" 7.330 - newline ;; 7.331 - 7.332 - cook-linux) 7.333 - # Native SliTaz Toolchain and cross toolchain must be installed 7.334 - check_root 7.335 - install="$data/linux-install" 7.336 - if [ ! -d "/cross/$arch" ]; then 7.337 - error "Missing cross toolchain in: /cross/$arch" 7.338 - exit 1 7.339 - fi 7.340 - 7.341 - # Kernel source 7.342 - cd ${rpi_git} 7.343 - [ -d "$kernel" ] || git clone --depth 1 ${rpi_git_url}linux.git 7.344 - 7.345 - # Compile 7.346 - if [ ! -d "$install" ]; then 7.347 - cd ${kernel} 7.348 - export PATH=$PATH:/cross/${arch}/tools/bin 7.349 - export HOST_SYSTEM=${arch}-slitaz-linux-gnueabi 7.350 - make mrproper && 7.351 - make ARCH=arm bcmrpi_defconfig 7.352 - echo "Patching SliTaz RPi Linux .config" 7.353 - patch -p1 -i ${rpi}/linux-rpi.config || exit 1 7.354 - make ARCH=arm CROSS_COMPILE=${HOST_SYSTEM}- zImage && 7.355 - make ARCH=arm CROSS_COMPILE=${HOST_SYSTEM}- modules && 7.356 - make ARCH=arm CROSS_COMPILE=${HOST_SYSTEM}- \ 7.357 - INSTALL_MOD_PATH=${install} modules_install || exit 1 7.358 - mkdir -p ${install}/boot 7.359 - cp -a arch/arm/boot/zImage ${install}/boot 7.360 - fi 7.361 - 7.362 - # Kernel version 7.363 - kvers=$(ls ${install}/lib/modules) 7.364 - kvers=${kvers%-slitaz-rpi+}+ 7.365 - 7.366 - # Compress modules 7.367 - cd ${install}/lib/modules/${kvers%+}-slitaz-rpi+/ || exit 1 7.368 - mods=$(find . -name "*.ko$" | wc -l) 7.369 - newline 7.370 - echo "Compressing kernel modules: $mods" 7.371 - find . -name "*.ko$" -exec gzip '{}' \; #2> /dev/null 7.372 - #find . -name "*.ko" -exec rm '{}' \; 7.373 - # Rebuild modules.dep 7.374 - cd ${install} 7.375 - depmod -b . ${kvers%+}-slitaz-rpi+ 7.376 - 7.377 - # Pack 7.378 - fs="$data/linux-$kvers/fs" 7.379 - echo "Kernel version: $kvers" 7.380 - if [ -d "$install" ]; then 7.381 - rm -rf ${data}/linux-${kvers} 7.382 - mkdir -p ${data}/linux-${kvers} 7.383 - cp -a ${install} ${fs} 7.384 - rm -f ${fs}/lib/modules/*/build ${fs}/lib/modules/*/source 7.385 - fi 7.386 - get_tools 7.387 - echo "Compressing: zImage to kernel.img" 7.388 - cd ${tools} 7.389 - python imagetool-uncompressed.py ${fs}/boot/zImage 7.390 - mv -f kernel.img ${fs}/boot && rm ${fs}/boot/zImage 7.391 - cd ${data} 7.392 - echo "Creating package: receipt" 7.393 - cat > linux-$kvers/receipt << EOT 7.394 -# SliTaz package receipt 7.395 - 7.396 -PACKAGE="linux" 7.397 -VERSION="$kvers" 7.398 -SHORT_DESC="SliTaz Linux Kernel for the Raspberry Pi." 7.399 -WEB_SITE="http://www.kernel.org" 7.400 - 7.401 -EOT 7.402 - tazpkg pack linux-$kvers ;; 7.403 - 7.404 - get-fw) 7.405 - get_fw ;; 7.406 - 7.407 - get-tools) 7.408 - get_tools ;; 7.409 - 7.410 - get-linux) 7.411 - # Precook RPi kernel 7.412 - mkdir -p ${data} 7.413 - 7.414 - # Last version 7.415 - rm -f ${data}/linux-version.txt 7.416 - if busybox wget -q -s ${rpi_mirror}/last-linux.txt; then 7.417 - echo -n "Fetching latest Kernel string..." 7.418 - wget -q ${rpi_mirror}/last-linux.txt \ 7.419 - -O ${data}/linux-version.txt || exit 1 7.420 - status 7.421 - else 7.422 - echo "Mirror is unreachable" && exit 1 7.423 - fi 7.424 - kvers=$(cat $data/linux-version.txt) 7.425 - [ "$up" ] && rm -rf ${data}/linux-${kvers}* 7.426 - echo "Kernel version: $kvers" 7.427 - 7.428 - # Download 7.429 - if [ ! -f "$data/linux-$kvers.tazpkg" ]; then 7.430 - echo -n "Fetching latest Linux package..." 7.431 - wget -q ${rpi_mirror}/linux-${kvers}.tazpkg \ 7.432 - -O ${data}/linux-${kvers}.tazpkg; status 7.433 - fi 7.434 - 7.435 - # Extract 7.436 - if [ ! -d "$data/linux-$kvers" ]; then 7.437 - cd ${data} && tazpkg extract linux-${kvers}.tazpkg 7.438 - fi 7.439 - rm -f ${data}/linux-version.txt ;; 7.440 - 7.441 - get-prebuilt) 7.442 - # --> in cross ?? 7.443 - : ${arch=arm} 7.444 - name="slitaz-$arch-toolchain" 7.445 - vers="20140304" 7.446 - tarball="$name-$vers.tar.bz2" 7.447 - url="http://mirror.slitaz.org/packages/cross/" 7.448 - mkdir -p /cross 7.449 - cd /cross 7.450 - if [ ! -f "$tarball" ]; then 7.451 - if busybox wget -qs ${url%/}/${tarball}; then 7.452 - busybox wget ${url%/}/${tarball} 7.453 - else 7.454 - echo "Toolchain URL is unreachable" && exit 1 7.455 - fi 7.456 - fi 7.457 - if [ ! -d "${name}-${vers}" ]; then 7.458 - echo "Extracting: $tarball" 7.459 - tar xjf ${tarball} 7.460 - fi 7.461 - echo "Copying: ${name}-${vers}/${arch}" 7.462 - mkdir -p ${arch} 7.463 - cp -a ${name}-${vers}/${arch}/* ${arch} 7.464 - echo "Tools path: /cross/${arch}/tools/bin" ;; 7.465 - 7.466 - clone-fw) 7.467 - clone_fw ;; 7.468 - 7.469 - release) 7.470 - # Used to release official SliTaz RPi images 7.471 - cd ${distro} || exit 1 7.472 - if [ ! "$flavor" ]; then 7.473 - . $distro/rootfs/etc/slitaz/flavor.conf || exit 1 7.474 - flavor="$FLAVOR" 7.475 - fi 7.476 - dirname="slitaz-$flavor-$(date +%Y%m%d)" 7.477 - dsize=$(du -sh $distro | awk '{print $1}' | cut -d "." -f 1) 7.478 - mkdir ${dirname} 7.479 - # To be continued... 7.480 - ;; 7.481 - 7.482 - clean) 7.483 - echo "Cleaning: $rpi" 7.484 - rm -rf ${data} 7.485 - [ "$git" ] && rm -rf ${rpi_git} ;; 7.486 - *) usage ;; 7.487 -esac 7.488 -exit 0