about summary refs log tree commit diff stats
path: root/tools/iso/linux
blob: ac0f720bda10d862c151c321e2e5211a9e0b5ebe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
# Build one or more .subx files into an ELF binary, and package it up into a
# bootable ISO image with a Linux kernel.
#
# Must be run on Linux, and from the top-level mu/ directory.
#
# Dependencies:
#   apt install build-essential flex bison wget libelf-dev libssl-dev xorriso
#
# Based on http://minimal.linux-bg.org (GPLv3)

set -e

if [ $# -eq 0 ]
then
  echo "Usage: `basename $0` file.subx ..."
  exit 1
fi

echo "=== building SubX binary"
./translate_subx $*
mv a.elf init

echo "=== constructing initramfs out of SubX binary"
rm -rf tmp_linux/isoimage
mkdir -p tmp_linux/isoimage/boot
echo init | cpio -R root:root -H newc -o | xz -9 --check=none > tmp_linux/isoimage/boot/rootfs.xz

if [ ! -d kernel.linux ]
then
  echo "=== cloning linux kernel"
  git clone https://github.com/akkartik/kernel kernel.linux
fi

echo "=== building linux kernel"
( cd kernel.linux
  make bzImage -j $(grep ^processor /proc/cpuinfo | wc -l)
)
cp *.linux/arch/x86/boot/bzImage tmp_linux/isoimage/boot/kernel.xz

echo "=== downloading syslinux"
test -f tmp_linux/syslinux-6.03.tar.xz  ||  wget https://kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.xz -P tmp_linux
echo "=== unpacking syslinux"
tar xf tmp_linux/syslinux-*.tar.xz -C tmp_linux

mkdir -p tmp_linux/isoimage/boot/syslinux
cp tools/iso/syslinux.cfg \
   tmp_linux/syslinux-*/bios/core/isolinux.bin \
   tmp_linux/syslinux-*/bios/com32/elflink/ldlinux/ldlinux.c32 \
   tmp_linux/isoimage/boot/syslinux

echo "=== generating mu_linux.iso"
# 'hybrid' ISO can also be used on non-optical media such as a disk or USB stick
xorriso -as mkisofs \
  -isohybrid-mbr tmp_linux/syslinux-*/bios/mbr/isohdpfx.bin \
  -c boot/syslinux/boot.cat \
  -b boot/syslinux/isolinux.bin \
    -no-emul-boot \
    -boot-load-size 4 \
    -boot-info-table \
  tmp_linux/isoimage -o mu_linux.iso
=\"set\"><enable xmlns=\"urn:xmpp:carbons:2\"/></iq>" )); } void connect_with_carbons_enabled(void **state) { prof_input("/carbons on"); prof_connect(); assert_true(stbbr_received( "<iq id=\"*\" type=\"set\"><enable xmlns=\"urn:xmpp:carbons:2\"/></iq>" )); } void send_disable_carbons(void **state) { prof_input("/carbons on"); prof_connect(); prof_input("/carbons off"); assert_true(stbbr_received( "<iq id=\"*\" type=\"set\"><disable xmlns=\"urn:xmpp:carbons:2\"/></iq>" )); } void receive_carbon(void **state) { prof_input("/carbons on"); prof_connect(); assert_true(stbbr_received( "<iq id=\"*\" type=\"set\"><enable xmlns=\"urn:xmpp:carbons:2\"/></iq>" )); stbbr_send( "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">" "<priority>10</priority>" "<status>On my mobile</status>" "</presence>" ); assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\"")); prof_input("/msg Buddy1"); prof_output_exact("unencrypted"); stbbr_send( "<message type=\"chat\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost\">" "<received xmlns=\"urn:xmpp:carbons:2\">" "<forwarded xmlns=\"urn:xmpp:forward:0\">" "<message id=\"prof_msg_7\" xmlns=\"jabber:client\" type=\"chat\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost/mobile\">" "<body>test carbon from recipient</body>" "</message>" "</forwarded>" "</received>" "</message>" ); assert_true(prof_output_regex("Buddy1/mobile: .+test carbon from recipient")); } void receive_self_carbon(void **state) { prof_input("/carbons on"); prof_connect(); assert_true(stbbr_received( "<iq id=\"*\" type=\"set\"><enable xmlns=\"urn:xmpp:carbons:2\"/></iq>" )); stbbr_send( "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">" "<priority>10</priority>" "<status>On my mobile</status>" "</presence>" ); assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\"")); prof_input("/msg Buddy1"); prof_output_exact("unencrypted"); stbbr_send( "<message type=\"chat\" to=\"stabber@localhost/profanity\" from=\"stabber@localhost\">" "<sent xmlns=\"urn:xmpp:carbons:2\">" "<forwarded xmlns=\"urn:xmpp:forward:0\">" "<message id=\"59\" xmlns=\"jabber:client\" type=\"chat\" to=\"buddy1@localhost/mobile\" lang=\"en\" from=\"stabber@localhost/profanity\">" "<body>self sent carbon</body>" "</message>" "</forwarded>" "</sent>" "</message>" ); assert_true(prof_output_regex("me: .+self sent carbon")); }