slitaz-arm rev 37
Bunch of improvments, add /opt/vc support
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri Mar 07 23:06:51 2014 +0100 (2014-03-07) |
parents | 5445fd3856ad |
children | 7a9f08753b34 |
files | .hgignore rpi/rootfs/boot/config.txt rpi/rootfs/etc/fstab sat spi |
line diff
1.1 --- a/.hgignore Fri Mar 07 19:13:20 2014 +0000 1.2 +++ b/.hgignore Fri Mar 07 23:06:51 2014 +0100 1.3 @@ -3,4 +3,4 @@ 1.4 packages/ 1.5 spk/ 1.6 rpi/git 1.7 -rpi/distro 1.8 +rpi/data
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/rpi/rootfs/boot/config.txt Fri Mar 07 23:06:51 2014 +0100 2.3 @@ -0,0 +1,1 @@ 2.4 +kernel=kernel.img
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/rpi/rootfs/etc/fstab Fri Mar 07 23:06:51 2014 +0100 3.3 @@ -0,0 +1,7 @@ 3.4 +# /etc/fstab: Slitaz ARM static filesystems. 3.5 +# 3.6 +proc /proc proc defaults 0 0 3.7 +sysfs /sys sysfs defaults 0 0 3.8 +/dev/mmcblk0p1 /boot auto noauto,noatime 1 2 3.9 +/dev/mmcblk0p2 none swap sw 0 0 3.10 +/dev/mmcblk0p3 / ext4 noatime 0 1
4.1 --- a/sat Fri Mar 07 19:13:20 2014 +0000 4.2 +++ b/sat Fri Mar 07 23:06:51 2014 +0100 4.3 @@ -17,7 +17,7 @@ 4.4 distro="$work/distro" 4.5 flavors="$work/flavors" 4.6 rootfs="$distro/rootfs" 4.7 -data="$distro/data" 4.8 +cache="$distro/cache" 4.9 4.10 # http://mirror.slitaz.org/packages/cooking/arm/ 4.11 mirror="http://cook.slitaz.org/cross/arm/packages/" 4.12 @@ -50,6 +50,7 @@ 4.13 --init= Specify the initramfs compression: gz bz2 xz 4.14 --flavor= Generate specific SliTaz ARM flavor 4.15 --append= SliTaz and Kernel bootime arguments for Qemu 4.16 + --debug Keep cache dir and display debugging info 4.17 4.18 EOT 4.19 } 4.20 @@ -63,11 +64,11 @@ 4.21 if busybox wget -qs ${mirror%/}/ID 2>/dev/null; then 4.22 busybox wget -q ${mirror%/}/ID 4.23 else 4.24 - gettext "Mirror is unreachable"; newline 4.25 + echo "Mirror is unreachable"; newline 4.26 return 1 4.27 fi 4.28 if [ "$(cat ID)" == "$(cat ID.bak)" ]; then 4.29 - gettext "Mirror is up-to-date"; newline 4.30 + echo "Mirror is up-to-date"; newline 4.31 return 1 4.32 fi 4.33 } 4.34 @@ -82,26 +83,26 @@ 4.35 check_root 4.36 newline && boldify "Generating SliTaz ARM distro" 4.37 separator 4.38 - rm -rf $distro && mkdir -p ${rootfs} ${data} 4.39 + rm -rf ${distro} && mkdir -p ${rootfs} ${cache} 4.40 4.41 # Get --flavor= packages lists 4.42 if [ "$flavor" ]; then 4.43 echo -n "Getting $flavor packages.list..." 4.44 - cp -f $flavors/$flavor/packages.list ${data} 2>/dev/null && 4.45 - cp -f $flavors/$flavor/flavor.conf ${data} 2>/dev/null 4.46 + cp -f $flavors/$flavor/packages.list ${cache} 2>/dev/null && 4.47 + cp -f $flavors/$flavor/flavor.conf ${cache} 2>/dev/null 4.48 status 4.49 fi 4.50 4.51 # Packages 4.52 - rm -f ${data}/packages.full 4.53 - if [ -f "${data}/packages.list" ]; then 4.54 - for pkg in $(cat ${data}/packages.list) 4.55 + rm -f ${cache}/packages.full 4.56 + if [ -f "${cache}/packages.list" ]; then 4.57 + for pkg in $(cat ${cache}/packages.list) 4.58 do 4.59 IFS="|" 4.60 grep "^$pkg |" $work/mirror/packages.desc | while read pkg version desc 4.61 do 4.62 echo ${pkg}-${version}-arm.tazpkg | sed s'/ //'g \ 4.63 - >> ${data}/packages.full 4.64 + >> ${cache}/packages.full 4.65 done 4.66 unset IFS 4.67 done 4.68 @@ -112,13 +113,13 @@ 4.69 echo "" && exit 1 4.70 fi 4.71 echo -n "Using packages directory..." 4.72 - cd $packages && ls -1 >${data}/packages.full 4.73 + cd $packages && ls -1 >${cache}/packages.full 4.74 status 4.75 fi 4.76 4.77 # Deps install is not well handled by tazpkg/spk actually. 4.78 # So simply install all packages and don't resolve deps. 4.79 - for pkg in $(cat ${data}/packages.full) 4.80 + for pkg in $(cat ${cache}/packages.full) 4.81 do 4.82 pkgdir=$(basename $pkg .tazpkg) 4.83 db=${rootfs}/var/lib/tazpkg 4.84 @@ -195,8 +196,8 @@ 4.85 fi 4.86 4.87 # Custom flavor rootfs 4.88 - if [ -f "${data}/flavor.conf" ]; then 4.89 - . ${data}/flavor.conf 4.90 + if [ -f "${cache}/flavor.conf" ]; then 4.91 + . ${cache}/flavor.conf 4.92 fi 4.93 if [ -d "$flavors/${FLAVOR}/rootfs" ]; then 4.94 size=$(du -sh $flavors/${FLAVOR}/rootfs | awk '{print $1}') 4.95 @@ -217,10 +218,10 @@ 4.96 fi 4.97 4.98 # Distro: /etc/slitaz/flavor.conf 4.99 - if [ -f "${data}/flavor.conf" ]; then 4.100 + if [ -f "${cache}/flavor.conf" ]; then 4.101 echo -n "Including $FLAVOR: flavor.conf" 4.102 - echo "BUILD_DATE=\"$(date '+%Y%m%d')\"" >> ${data}/flavor.conf 4.103 - cp -f ${data}/flavor.conf ${rootfs}/etc/slitaz 4.104 + echo "BUILD_DATE=\"$(date '+%Y%m%d')\"" >> ${cache}/flavor.conf 4.105 + cp -f ${cache}/flavor.conf ${rootfs}/etc/slitaz 4.106 status 4.107 fi 4.108 4.109 @@ -235,6 +236,9 @@ 4.110 status 4.111 fi 4.112 4.113 + # Clean if no debug mode 4.114 + [ "$debug" ] || rm -rf ${cache} 4.115 + 4.116 # Summary 4.117 separator && newline 4.118 boldify "SliTaz ARM distro summary" 4.119 @@ -250,7 +254,8 @@ 4.120 [ "$noinit" ] || echo "Initramfs size : $initramfs_size" 4.121 echo "Rootfs size : $rootfs_size" 4.122 echo "Packages : $pkgs_count" 4.123 - separator && newline ;; 4.124 + separator 4.125 + [ "$rpi" ] || newline ;; 4.126 4.127 flavors) 4.128 newline
5.1 --- a/spi Fri Mar 07 19:13:20 2014 +0000 5.2 +++ b/spi Fri Mar 07 23:06:51 2014 +0100 5.3 @@ -11,9 +11,9 @@ 5.4 [ "$work" ] || work="$(pwd)" 5.5 distro="$work/distro" 5.6 rpi="$work/rpi" 5.7 -data="$rpi/distro/data" 5.8 -boot="$rpi/distro/boot" 5.9 -rootfs="$rpi/distro/rootfs" 5.10 +data="$rpi/data" 5.11 +boot="$distro/boot" 5.12 +rootfs="$distro/rootfs" 5.13 rpi_git="$rpi/git" 5.14 kernel="$rpi_git/linux" 5.15 firmware="$rpi_git/firmware" 5.16 @@ -52,10 +52,11 @@ 5.17 oclock Display overclocking information 5.18 5.19 $(boldify "Options:") 5.20 - --up Update firmware, tools or kernel 5.21 - --clean Clean the distro tree (Sat can also be used) 5.22 + --up Update for commands: firmware, tools, kernel 5.23 --turbo Force the RPi to run at the highest arm_freq 5.24 - --oclock= Set the RPi overclocking mode 5.25 + --oclock= Set the RPi overclocking mode in config.txt 5.26 + --vc Install the RPi VC libraries in /opt/vc 5.27 + --nosat Dont regenerate the distro with sat 5.28 5.29 EOT 5.30 } 5.31 @@ -216,75 +217,63 @@ 5.32 # partition on the sdcard. 5.33 : ${flavor=rpi} 5.34 : ${oclock=none} 5.35 - check_root 5.36 - rm -rf ${rootfs} ${boot} 5.37 - mkdir -p ${boot} 5.38 5.39 # Use the rootfs generated by sat 5.40 if [ ! -x "/usr/bin/sat" ]; then 5.41 error "Sat is not installed" && exit 1 5.42 fi 5.43 - [ "$clean" ] && sat clean --work="$work" 5.44 - if [ ! -d "$distro/rootfs/etc" ]; then 5.45 - sat gen --work="$work" --flavor="$flavor" \ 5.46 - --kmap --spk --noinit --rpi 5.47 + 5.48 + # We may want to simply regenerate the RPi distro 5.49 + if [ ! "$nosat" ]; then 5.50 + sat gen --work="$work" --flavor="$flavor" --kmap --noinit --rpi 5.51 fi 5.52 + 5.53 header "SliTaz Raspberry Pi distro" 5.54 - dsize="$(du -sh ${distro}/rootfs | awk '{print $1}')" 5.55 - echo -n "Copying: rootfs ($dsize)" 5.56 - cp -a ${distro}/rootfs ${rootfs}; status 5.57 5.58 # Boot firmware 5.59 echo -n "Copying: firmware files..." 5.60 - get_fw 5.61 + mkdir -p ${boot} && get_fw 5.62 for fw in $fwlist 5.63 do 5.64 - cp $firmware/boot/${fw} ${boot} 5.65 + cp ${firmware}/boot/${fw} ${boot} 5.66 done 5.67 status 5.68 5.69 # SliTaz Raspberry Pi custom rootfs files. Make sure all files 5.70 # belong to root 5.71 - if [ -d "$work/rootfs" ]; then 5.72 - size=$(du -sh $work/rootfs | awk '{print $1}') 5.73 + if [ -d "$rpi/rootfs" ]; then 5.74 + size=$(du -sh $rpi/rootfs | awk '{print $1}') 5.75 echo -n "Copying: SliTaz RPi rootfs ($size)" 5.76 - tmp=$distro/tmp-$$ 5.77 - mkdir -p $tmp 5.78 - cp -r $work/rootfs/* $tmp 5.79 - chown -R root.root $tmp 5.80 - cp -a $tmp/* ${rootfs} && rm -rf $tmp 5.81 + tmp=${distro}/tmp-$$ 5.82 + mkdir -p ${tmp} 5.83 + cp -r ${rpi}/rootfs/* ${tmp} 5.84 + chown -R root.root ${tmp} 5.85 + cp -a ${tmp}/* ${rootfs} && rm -rf ${tmp} 5.86 + # Move files to $boot 5.87 + mv -f ${rootfs}/boot/* ${boot} 5.88 status 5.89 fi 5.90 5.91 - # /boot/config.txt 5.92 - echo -n "Creating: /boot/config.txt" 5.93 - echo 'kernel=kernel.img' > ${boot}/config.txt 5.94 + # Overcloking 5.95 + echo -n "Setting: Overcloking" 5.96 set_oclock; status 5.97 + 5.98 + # Force turbo 5.99 if [ "$turbo" ]; then 5.100 - echo "force_turbo=1" >> ${boot}/config.txt 5.101 + echo -n "Config: force_turbo=1" 5.102 + echo "force_turbo=1" >> ${boot}/config.txt; status 5.103 fi 5.104 5.105 - # /etc/fstab 5.106 - echo -n "Creating: /etc/fstab" 5.107 - cat > ${rootfs}/etc/fstab << EOT 5.108 -# /etc/fstab: Slitaz ARM static filesystems. 5.109 -# 5.110 -proc /proc proc defaults 0 0 5.111 -sysfs /sys sysfs defaults 0 0 5.112 -/dev/mmcblk0p1 /boot auto noauto,noatime 1 2 5.113 -/dev/mmcblk0p2 none swap sw 0 0 5.114 -/dev/mmcblk0p3 / ext4 noatime 0 1 5.115 -EOT 5.116 - status 5.117 - 5.118 # Kernel 5.119 kvers=$(ls $data/linux-*/fs/lib/modules) 5.120 kpkg="$rootfs/var/lib/tazpkg/installed/linux" 5.121 - if [ -d "$data/linux-$kvers/fs" ]; then 5.122 - echo -n "Copying: Linux Kernel $kvers" 5.123 + fs="$data/linux-$kvers/fs" 5.124 + ksize=$(du -sh $fs | awk '{print $1}') 5.125 + if [ -d "$fs" ]; then 5.126 + echo -n "Copying: kernel $kvers ($ksize)" 5.127 rm -rf ${rootfs}/lib/modules 5.128 - cp -rf ${data}/linux-${kvers}/fs/lib/* ${rootfs}/lib 5.129 - cp -f ${data}/linux-${kvers}/fs/boot/* ${boot} 5.130 + cp -rf ${fs}/lib/* ${rootfs}/lib 5.131 + cp -f ${fs}/boot/* ${boot} 5.132 mkdir -p ${kpkg} 5.133 cd ${data}/linux-${kvers} 5.134 cp -f files.list md5sum receipt ${kpkg} 5.135 @@ -292,12 +281,20 @@ 5.136 else 5.137 echo "RPi Kernel: not used" 5.138 fi 5.139 - mkdir -p ${rootfs}/boot 5.140 5.141 # RPi VC libraries 5.142 if [ "$vc" ]; then 5.143 - echo "Installing: VC libraries" 5.144 - echo "TODO" 5.145 + if [ ! -d "$firmware/opt/vc" ]; then 5.146 + error "Missing firmware git repository" && exit 1 5.147 + fi 5.148 + # --hardfp 5.149 + if [ "$hardfp" ]; then 5.150 + echo -n "Not yet supported: SliTaz ARMv6hf"; false 5.151 + else 5.152 + echo -n "Installing standard: VC libraries" 5.153 + cp -a ${firmware}/opt ${rootfs} 5.154 + fi 5.155 + status 5.156 fi 5.157 5.158 separator 5.159 @@ -315,9 +312,12 @@ 5.160 error "Missing cross toolchain in: /cross/$arch" 5.161 exit 1 5.162 fi 5.163 + 5.164 # Kernel source 5.165 + cd ${rpi_git} 5.166 [ -d "$kernel" ] || git clone --depth 1 ${rpi_git_url}linux.git 5.167 5.168 + # Compile 5.169 if [ ! -d "$install" ]; then 5.170 cd ${kernel} 5.171 export PATH=$PATH:/cross/${arch}/tools/bin 5.172 @@ -331,9 +331,12 @@ 5.173 cp -a arch/arm/boot/zImage ${install}/boot 5.174 fi 5.175 5.176 - # Compress all modules 5.177 - #echo -n "Searching all modules to compress them... " 5.178 - #find . -name "*.ko" -exec xz '{}' \; 2> /dev/null 5.179 + # Compress modules 5.180 + mods=$(find . -name "*.ko" | wc -l) 5.181 + newline 5.182 + echo "Kernel modules: $mods" 5.183 + #echo -n "Compressing modules: $mods" 5.184 + #find . -name "*.ko" -exec gz '{}' \; 2> /dev/null 5.185 5.186 # Pack 5.187 fs="$data/linux-$kvers/fs" 5.188 @@ -374,6 +377,8 @@ 5.189 # Precook RPi kernel 5.190 mkdir -p ${data} 5.191 rm -f ${data}/linux-version.txt 5.192 + 5.193 + # Last version 5.194 if busybox wget -q -s ${rpi_mirror}/last-linux.txt; then 5.195 echo -n "Fetching latest Kernel string..." 5.196 wget -q ${rpi_mirror}/last-linux.txt \ 5.197 @@ -385,16 +390,19 @@ 5.198 kvers=$(cat $data/linux-version.txt) 5.199 [ "$up" ] && rm -rf ${data}/linux-${kvers}* 5.200 echo "Kernel version: $kvers" 5.201 + 5.202 # Download 5.203 if [ ! -f "$data/linux-$kvers.tazpkg" ]; then 5.204 echo -n "Fetching latest Linux package..." 5.205 wget -q ${rpi_mirror}/linux-${kvers}.tazpkg \ 5.206 -O ${data}/linux-${kvers}.tazpkg; status 5.207 fi 5.208 + 5.209 # Extract 5.210 if [ ! -d "$data/linux-$kvers" ]; then 5.211 cd ${data} && tazpkg extract linux-${kvers}.tazpkg 5.212 - fi ;; 5.213 + fi 5.214 + rm -f ${data}/linux-version.txt ;; 5.215 5.216 get-prebuilt) 5.217 # --> in cross ??