Imported using git-ubuntu import.
Changelog parent: 80fddc56a2
New changelog entries:
[ Michael Terry ]
* Change real name for phablet user to "Ubuntu" in ubuntu-touch.
[ Steve Langasek ]
* Drop BuildLiveCD from the examples; we now use launchpad-buildd to drive
livefs builds, so BuildLiveCD is obsolete and misleading.
* Add hooks to ubuntu-cpc to divert /bin/sync in the chroot and undivert it
at the end. This is a general-purpose change that should be applied to
all flavors and archs, but at the moment it's only needed on armhf+raspi2
to work around the raspberrypi2-firmware postinst calling sync, which is
actually warranted in the normal case.
* If a subarch is specified for a cloud image build, don't build rootfs
artifacts; these should come from the 'generic' build.
* Fix architecture handling in hooks. We know we're always being invoked
from a launchpad-buildd-like setup, which passes ARCH and SUBARCH in the
environment, because auto/config and auto/build both rely on this. So
don't scatter dpkg --print-architecture calls throughout, especially
when many of these are not cross-build-aware.
* Refactor ubuntu-cpc hooks to allow us to handle images where the root
partition should not be partition 1.
[ Ben Howard ]
* ubuntu-cpc: fix hooks/032-disk-image.binary call to
create_empty_partition, which requires five args due to "-u"
* ubuntu-cpc: in hooks/030-root-tarball.binary create /lib/modules to fix
(LP: 1543204).
[ Dimitri John Ledkov ]
* Do not remove linux-base, when purging all the linux-*, in the tarball
build. Otherwise ubuntu-minimal is removed, and things get crazy.
* Correct initrd.img symlink, kernel/hooks should actually produce the
right thing here, but meh.
* Chroot to execute zipl, because it's nice.
* Use the right loop device to install zipl onto.
[ Steve Langasek ]
* Refactor ubuntu-cpc hooks to always produce a 'plain' rootfs via
live-build and reuse this for the tarball, instead of lb_binary_rootfs
creating some artifact that we ignore / throw away.
* Initial support for raspi2 subarch.
* Import live-build/ubuntu-cpc/hooks/raspi2/mkknlimg from
https://github.com/raspberrypi/linux/blob/rpi-4.1.y/scripts/mkknlimg
and use it to install a bootable uboot.bin.
impish
parent
80fddc56a2
commit
0ae1111c55
@ -1,177 +0,0 @@
|
||||
#!/bin/bash
|
||||
BUILD_LOG=~/public_html/BuildLive.out
|
||||
ALWAYS_SEND_LOG=yes
|
||||
LANG=C
|
||||
|
||||
finish() {
|
||||
[ $? != "0" ] && STATUS="Failed" || STATUS="Successful"
|
||||
if [ "$STATUS" = "Failed" ] || [ "$ALWAYS_SEND_LOG" = "yes" ]; then
|
||||
SEND_LOG=yes
|
||||
fi
|
||||
if [ -e "$LOG" ]; then
|
||||
echo "======================= Log of livefs.sh output follows ======================="
|
||||
cat $LOG
|
||||
fi
|
||||
if [ "$SEND_LOG" = "yes" ]; then
|
||||
exec >/dev/null 2>&1
|
||||
mailx -s "LiveCD: $STATUS $STE:$FS${SUBPROJECT:+-$SUBPROJECT}${SUBARCH:+-$SUBARCH}${UBUNTU_DEFAULTS_LOCALE:+-$UBUNTU_DEFAULTS_LOCALE} build on ${ARCH}" buildd+porters < "$BUILD_LOG"
|
||||
fi
|
||||
rm -f ~/buildLiveCD.lock
|
||||
nohup ~/bin/pruneLiveCD >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
if [ -n "$SSH_ORIGINAL_COMMAND" ]; then
|
||||
set -- $SSH_ORIGINAL_COMMAND
|
||||
[ ${1##*/} != 'BuildLiveCD' ] && echo bad command >&2 && exit 2
|
||||
shift
|
||||
fi
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
SUBARCH=""
|
||||
NEWSUITE="precise"
|
||||
SUITES=""
|
||||
PROPOSED=""
|
||||
IMAGEFORMAT=""
|
||||
LIVE_BUILD=false
|
||||
UBUNTU_DEFAULTS_LOCALE=""
|
||||
|
||||
while getopts :A:s:r:d:f:plu:t: name; do case $name in
|
||||
A) ARCH="$OPTARG";;
|
||||
s) SUBARCH="$OPTARG";;
|
||||
r) SUBPROJECT="$OPTARG";;
|
||||
d) NEWSUITE="$OPTARG";;
|
||||
f) IMAGEFORMAT="$OPTARG";;
|
||||
p) PROPOSED="-p";;
|
||||
l) LIVE_BUILD=:;;
|
||||
u) UBUNTU_DEFAULTS_LOCALE="$OPTARG";;
|
||||
t) UBUNTU_TOUCH_ANDROID="$OPTARG";;
|
||||
esac; done;
|
||||
shift $((OPTIND-1))
|
||||
|
||||
for s in $NEWSUITE; do
|
||||
if [ -d build-${s}-live/chroot-${s} ]; then SUITES="$SUITES $s"; fi
|
||||
done
|
||||
if [ -z "$SUITES" ]; then
|
||||
echo "No valid suites to build for" >&2 && exit 1
|
||||
fi
|
||||
for s in $SUITES; do
|
||||
case $s in
|
||||
dapper|edgy|feisty|gutsy|hardy)
|
||||
old_suite="yes"
|
||||
;;
|
||||
*)
|
||||
new_suite="yes"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ "$new_suite" = "yes" ] && [ "$old_suite" = "yes" ]; then
|
||||
echo "Can't build images for suites older than intrepid and suites" >&2
|
||||
echo "greater than hardy at the same time, please use two invocations" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ([ $# = 0 ] || [ "X$1" = "Xall" ]) && ! $LIVE_BUILD; then
|
||||
set -- ubuntu kubuntu kubuntu-active edubuntu xubuntu mythbuntu base
|
||||
if [ "$ARCH" = "i386" ]; then
|
||||
set -- ubuntu ubuntu-dvd ubuntu-lpia ubuntu-netbook kubuntu kubuntu-dvd kubuntu-active edubuntu edubuntu-dvd xubuntu mythbuntu base
|
||||
fi
|
||||
fi
|
||||
|
||||
case ${ARCH} in
|
||||
hppa|sparc|powerpc) LINUX32=linux32;;
|
||||
*) LINUX32="";;
|
||||
esac
|
||||
|
||||
if [ "`echo $@ | wc -w`" -gt "1" ]; then
|
||||
for arg in "$@"; do
|
||||
$0 $arg
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
FS="$1"
|
||||
shift
|
||||
|
||||
# 12 hours should be enough for even the longest build queue to clear.
|
||||
lockfile -8 -r$((12 * 60 * 60 / 8)) ~/buildLiveCD.lock || exit 1
|
||||
trap "finish" 0
|
||||
trap "rm -f ~/buildLiveCD.lock; exit 1" 1 2 3 15
|
||||
exec > $BUILD_LOG 2>&1
|
||||
set -e
|
||||
|
||||
for STE in $SUITES; do
|
||||
if [ -d ~/build-${STE}-live/chroot-${STE} ]; then
|
||||
sudo chroot ~/build-${STE}-live/chroot-${STE} apt-get -qq update || true
|
||||
sudo chroot ~/build-${STE}-live/chroot-${STE} apt-get -y dist-upgrade || true
|
||||
sudo chroot ~/build-${STE}-live/chroot-${STE} apt-get -y install livecd-rootfs eatmydata || true
|
||||
sudo chroot ~/build-${STE}-live/chroot-${STE} apt-get -y --install-recommends install ubuntu-defaults-builder || true
|
||||
fi
|
||||
done
|
||||
for STE in $SUITES; do
|
||||
if cd ~/build-${STE}-live 2>/dev/null; then
|
||||
DIR=~/build-${STE}-live/chroot-${STE}/./build/
|
||||
else
|
||||
cd ~/build.live
|
||||
DIR=~/build.live/chroot-${STE}/./build/
|
||||
fi
|
||||
|
||||
PUBDIR=~/public_html/LiveCD/${STE}/${FS}${SUBPROJECT:+-$SUBPROJECT}${SUBARCH:+-$SUBARCH}${UBUNTU_DEFAULTS_LOCALE:+-$UBUNTU_DEFAULTS_LOCALE}/
|
||||
mkdir -p ${PUBDIR}
|
||||
|
||||
NOW=$(date +%Y%m%d)
|
||||
if [ -d ${PUBDIR}${NOW} ]; then
|
||||
typeset -i n=1; while [ -d ${PUBDIR}${NOW}.$n ]; do n=n+1; done
|
||||
NOW=${NOW}.$n
|
||||
fi
|
||||
LOG=${PUBDIR}${NOW}/livecd-${NOW}-${ARCH}.out
|
||||
|
||||
rm -f ${PUBDIR}latest
|
||||
ln -sf ${PUBDIR}${NOW} ${PUBDIR}latest
|
||||
mkdir -p ${PUBDIR}${NOW}
|
||||
> ${LOG}
|
||||
ln -sf livecd-${NOW}-${ARCH}.out ${PUBDIR}${NOW}/livecd-${ARCH}.out
|
||||
if $LIVE_BUILD; then
|
||||
$LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && rm -rf auto && mkdir -p auto && for f in config build clean; do ln -s /usr/share/livecd-rootfs/live-build/auto/\$f auto/; done" >> ${LOG} 2>&1 || true
|
||||
$LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && lb clean --purge" >> ${LOG} 2>&1 || true
|
||||
if ! $LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && NOW=${NOW} SUITE=${STE} PROJECT=${FS} SUBPROJECT=${SUBPROJECT} ARCH=${ARCH} SUBARCH=${SUBARCH} IMAGEFORMAT=${IMAGEFORMAT} PROPOSED=${PROPOSED:+1} lb config" >> ${LOG} 2>&1; then
|
||||
exit 1
|
||||
fi
|
||||
COMMAND="PROJECT=${FS} SUBPROJECT=${SUBPROJECT} ARCH=${ARCH} SUBARCH=${SUBARCH} lb build"
|
||||
elif [ "$UBUNTU_DEFAULTS_LOCALE" ]; then
|
||||
COMMAND="ubuntu-defaults-image --locale ${UBUNTU_DEFAULTS_LOCALE} --arch ${ARCH} --release ${STE}"
|
||||
else
|
||||
echo "Must pass either -l or -u."
|
||||
exit 1
|
||||
fi
|
||||
if $LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && eatmydata -- $COMMAND" >> ${LOG} 2>&1; then
|
||||
rm -f ${PUBDIR}current
|
||||
ln -sf ${NOW} ${PUBDIR}current
|
||||
|
||||
for file in ${DIR}livecd.*; do
|
||||
if [ -f ${file} ]; then
|
||||
ext=${file##*.}
|
||||
base=${file%.*}; base=${base##*/}
|
||||
sudo chown buildd ${file}
|
||||
sudo mv ${file} ${PUBDIR}${NOW}/${base}-${NOW}-${ARCH}.${ext}
|
||||
ln -sf ${base}-${NOW}-${ARCH}.${ext} ${PUBDIR}${NOW}/${base}.${ext}
|
||||
fi
|
||||
done
|
||||
|
||||
for f in ${PUBDIR}${NOW}/livecd.*.cloop-*; do
|
||||
if [ -f ${f} ]; then
|
||||
target=${f%-*}
|
||||
if [ ! -f ${target} ]; then
|
||||
for fsbs in 4096:4096 1024:65536; do
|
||||
if [ -f ${target}-${fsbs} ]; then
|
||||
ln -sf ${target##*/}-${fsbs} ${target}
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ ! -f ${target} ]; then
|
||||
best=$(ls -ld ${target}-* | sort -k5,5n| awk '{print $NF; quit}')
|
||||
ln -sf ${best##*/} ${target}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
done
|
@ -1 +0,0 @@
|
||||
BuildLiveCD
|
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
dpkg-divert --quiet --add --divert /bin/sync.REAL --rename /bin/sync
|
||||
cat > /bin/sync <<'EOF'
|
||||
#! /bin/sh
|
||||
echo "$0: diverted by livecd-rootfs" >&2
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
chmod +x /bin/sync
|
@ -0,0 +1,5 @@
|
||||
#! /bin/sh
|
||||
set -e
|
||||
|
||||
rm -f /bin/sync
|
||||
dpkg-divert --quiet --remove --rename /bin/sync
|
@ -0,0 +1,244 @@
|
||||
#!/usr/bin/env perl
|
||||
# ----------------------------------------------------------------------
|
||||
# mkknlimg by Phil Elwell for Raspberry Pi
|
||||
# based on extract-ikconfig by Dick Streefland
|
||||
#
|
||||
# (c) 2009,2010 Dick Streefland <dick@streefland.net>
|
||||
# (c) 2014,2015 Raspberry Pi (Trading) Limited <info@raspberrypi.org>
|
||||
#
|
||||
# Licensed under the terms of the GNU General Public License.
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use integer;
|
||||
|
||||
my $trailer_magic = 'RPTL';
|
||||
|
||||
my $tmpfile1 = "/tmp/mkknlimg_$$.1";
|
||||
my $tmpfile2 = "/tmp/mkknlimg_$$.2";
|
||||
|
||||
my $dtok = 0;
|
||||
my $is_283x = 0;
|
||||
|
||||
while (@ARGV && ($ARGV[0] =~ /^-/))
|
||||
{
|
||||
my $arg = shift(@ARGV);
|
||||
if ($arg eq '--dtok')
|
||||
{
|
||||
$dtok = 1;
|
||||
}
|
||||
elsif ($arg eq '--283x')
|
||||
{
|
||||
$is_283x = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print ("* Unknown option '$arg'\n");
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
usage() if (@ARGV != 2);
|
||||
|
||||
my $kernel_file = $ARGV[0];
|
||||
my $out_file = $ARGV[1];
|
||||
|
||||
if (! -r $kernel_file)
|
||||
{
|
||||
print ("* File '$kernel_file' not found\n");
|
||||
usage();
|
||||
}
|
||||
|
||||
my @wanted_strings =
|
||||
(
|
||||
'bcm2708_fb',
|
||||
'brcm,bcm2835-mmc',
|
||||
'brcm,bcm2835-sdhost',
|
||||
'brcm,bcm2708-pinctrl',
|
||||
'brcm,bcm2835-gpio',
|
||||
'brcm,bcm2835',
|
||||
'brcm,bcm2836'
|
||||
);
|
||||
|
||||
my $res = try_extract($kernel_file, $tmpfile1);
|
||||
$res = try_decompress('\037\213\010', 'xy', 'gunzip', 0,
|
||||
$kernel_file, $tmpfile1, $tmpfile2) if (!$res);
|
||||
$res = try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1,
|
||||
$kernel_file, $tmpfile1, $tmpfile2) if (!$res);
|
||||
$res = try_decompress('BZh', 'xy', 'bunzip2', 0,
|
||||
$kernel_file, $tmpfile1, $tmpfile2) if (!$res);
|
||||
$res = try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0,
|
||||
$kernel_file, $tmpfile1, $tmpfile2) if (!$res);
|
||||
$res = try_decompress('\211\114\132', 'xy', 'lzop -d', 0,
|
||||
$kernel_file, $tmpfile1, $tmpfile2) if (!$res);
|
||||
$res = try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1,
|
||||
$kernel_file, $tmpfile1, $tmpfile2) if (!$res);
|
||||
|
||||
my $append_trailer;
|
||||
my $trailer;
|
||||
my $kver = '?';
|
||||
|
||||
$append_trailer = $dtok;
|
||||
|
||||
if ($res)
|
||||
{
|
||||
$kver = $res->{''} || '?';
|
||||
print("Version: $kver\n");
|
||||
|
||||
$append_trailer = $dtok;
|
||||
if (!$dtok)
|
||||
{
|
||||
if (config_bool($res, 'bcm2708_fb') ||
|
||||
config_bool($res, 'brcm,bcm2835-mmc') ||
|
||||
config_bool($res, 'brcm,bcm2835-sdhost'))
|
||||
{
|
||||
$dtok ||= config_bool($res, 'brcm,bcm2708-pinctrl');
|
||||
$dtok ||= config_bool($res, 'brcm,bcm2835-gpio');
|
||||
$is_283x ||= config_bool($res, 'brcm,bcm2835');
|
||||
$is_283x ||= config_bool($res, 'brcm,bcm2836');
|
||||
$dtok ||= $is_283x;
|
||||
$append_trailer = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print ("* This doesn't look like a Raspberry Pi kernel. In pass-through mode.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif (!$dtok)
|
||||
{
|
||||
print ("* Is this a valid kernel? In pass-through mode.\n");
|
||||
}
|
||||
|
||||
if ($append_trailer)
|
||||
{
|
||||
printf("DT: %s\n", $dtok ? "y" : "n");
|
||||
printf("283x: %s\n", $is_283x ? "y" : "n");
|
||||
|
||||
my @atoms;
|
||||
|
||||
push @atoms, [ $trailer_magic, pack('V', 0) ];
|
||||
push @atoms, [ 'KVer', $kver ];
|
||||
push @atoms, [ 'DTOK', pack('V', $dtok) ];
|
||||
push @atoms, [ '283x', pack('V', $is_283x) ];
|
||||
|
||||
$trailer = pack_trailer(\@atoms);
|
||||
$atoms[0]->[1] = pack('V', length($trailer));
|
||||
|
||||
$trailer = pack_trailer(\@atoms);
|
||||
}
|
||||
|
||||
my $ofh;
|
||||
my $total_len = 0;
|
||||
|
||||
if ($out_file eq $kernel_file)
|
||||
{
|
||||
die "* Failed to open '$out_file' for append\n"
|
||||
if (!open($ofh, '>>', $out_file));
|
||||
$total_len = tell($ofh);
|
||||
}
|
||||
else
|
||||
{
|
||||
die "* Failed to open '$kernel_file'\n"
|
||||
if (!open(my $ifh, '<', $kernel_file));
|
||||
die "* Failed to create '$out_file'\n"
|
||||
if (!open($ofh, '>', $out_file));
|
||||
|
||||
my $copybuf;
|
||||
while (1)
|
||||
{
|
||||
my $bytes = sysread($ifh, $copybuf, 64*1024);
|
||||
last if (!$bytes);
|
||||
syswrite($ofh, $copybuf, $bytes);
|
||||
$total_len += $bytes;
|
||||
}
|
||||
close($ifh);
|
||||
}
|
||||
|
||||
if ($trailer)
|
||||
{
|
||||
# Pad to word-alignment
|
||||
syswrite($ofh, "\x000\x000\x000", (-$total_len & 0x3));
|
||||
syswrite($ofh, $trailer);
|
||||
}
|
||||
|
||||
close($ofh);
|
||||
|
||||
exit($trailer ? 0 : 1);
|
||||
|
||||
END {
|
||||
unlink($tmpfile1) if ($tmpfile1);
|
||||
unlink($tmpfile2) if ($tmpfile2);
|
||||
}
|
||||
|
||||
|
||||
sub usage
|
||||
{
|
||||
print ("Usage: mkknlimg [--dtok] [--283x] <vmlinux|zImage|bzImage> <outfile>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sub try_extract
|
||||
{
|
||||
my ($knl, $tmp) = @_;
|
||||
|
||||
my $ver = `strings "$knl" | grep -a -E "^Linux version [1-9]"`;
|
||||
|
||||
return undef if (!$ver);
|
||||
|
||||
chomp($ver);
|
||||
|
||||
my $res = { ''=>$ver };
|
||||
my $string_pattern = '^('.join('|', @wanted_strings).')$';
|
||||
|
||||
my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`;
|
||||
foreach my $match (@matches)
|
||||
{
|
||||
chomp($match);
|
||||
$res->{$match} = 1;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
sub try_decompress
|
||||
{
|
||||
my ($magic, $subst, $zcat, $idx, $knl, $tmp1, $tmp2) = @_;
|
||||
|
||||
my $pos = `tr "$magic\n$subst" "\n$subst=" < "$knl" | grep -abo "^$subst"`;
|
||||
if ($pos)
|
||||
{
|
||||
chomp($pos);
|
||||
$pos = (split(/[\r\n]+/, $pos))[$idx];
|
||||
return undef if (!defined($pos));
|
||||
$pos =~ s/:.*[\r\n]*$//s;
|
||||
my $cmd = "tail -c+$pos \"$knl\" | $zcat > $tmp2 2> /dev/null";
|
||||
my $err = (system($cmd) >> 8);
|
||||
return undef if (($err != 0) && ($err != 2));
|
||||
|
||||
return try_extract($tmp2, $tmp1);
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub pack_trailer
|
||||
{
|
||||
my ($atoms) = @_;
|
||||
my $trailer = pack('VV', 0, 0);
|
||||
for (my $i = $#$atoms; $i>=0; $i--)
|
||||
{
|
||||
my $atom = $atoms->[$i];
|
||||
$trailer .= pack('a*x!4Va4', $atom->[1], length($atom->[1]), $atom->[0]);
|
||||
}
|
||||
return $trailer;
|
||||
}
|
||||
|
||||
sub config_bool
|
||||
{
|
||||
my ($configs, $wanted) = @_;
|
||||
my $val = $configs->{$wanted} || 'n';
|
||||
return (($val eq 'y') || ($val eq '1'));
|
||||
}
|
Loading…
Reference in new issue