Skip to content

Commit

Permalink
Initial release. Added a minimal Virtual Core box based on Tiny Core …
Browse files Browse the repository at this point in the history
…Linux.
  • Loading branch information
hyamamoto committed Nov 9, 2013
1 parent f947d5f commit 3e04e13
Show file tree
Hide file tree
Showing 22 changed files with 661 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.DS_Store
.bundle
Gemfile.lock
gems/*
iso/*
iso
cookbooks/*
manifests/*
*.ova
tmp/*
boxes/*
*.box
.vagrant
*.swp
.ruby-version
.rbenv-gemsets
.project
.ruby-version
50 changes: 48 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,48 @@
virtual-core
===========
Virtual Core Project
====================

Virtual Core Linux project aims to build a compact
platform for 'Single purpose operation systems' for
virtualized environments. They're based on cutomized
Tiny/Micro Core Linux. Current disk images are packed
for Vagrant/Virtualbox pair, and the smallest image
size is about 13Mb.


Download
========

* **Core** ( build on 2013/11/09 )
- Arch: [i686]() / [amd64]()
- Based on: Tiny Core Linux 5.0.2
- Environment: Vagrant with Virtualbox 4.3.2
- VM Spec : 1 cpu / 256M mem / 512M disk (default)
- User/pass : tc/vagrant
- Image size : 12.9M


Installation
------------

on _TODO_ list...




Build
-----

This project is currently in development. Current build system is
Veewee but will be replaced soon. So for now ,pull the definitions
and build the image on Veewee.


Planned
-------

* Core + minimum Ruby or Python set : for Rails, Gerrit
* Core + httpd + php : for testers

--
Hiroshi Yamamoto ([email protected])
~
5 changes: 5 additions & 0 deletions additions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Virtual Core Project - Additions
====================

This directory includes precompiled modules for guest OS.

379 changes: 379 additions & 0 deletions additions/virtualbox/LICENSE

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file added additions/virtualbox/target/amd64/base64
Binary file not shown.
Binary file added additions/virtualbox/target/amd64/mount.vboxsf
Binary file not shown.
4 changes: 4 additions & 0 deletions additions/virtualbox/target/amd64/vbox-ga_tar_gz.sh

Large diffs are not rendered by default.

Binary file added additions/virtualbox/target/amd64/vboxguest.ko
Binary file not shown.
Binary file added additions/virtualbox/target/amd64/vboxsf.ko
Binary file not shown.
Binary file added additions/virtualbox/target/amd64/vboxvideo.ko
Binary file not shown.
17 changes: 17 additions & 0 deletions additions/virtualbox/target/pack
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
# vbox-ga shell packager (2013/11/07 Hiroshi Yamamoto)
if [ $# -eq 0 ]
then
echo "No arguments supplied. Needs one of [x86, amd64]."
exit 1
fi
P=`pwd`
cd $P/$1
tar cvfz ../vbox-ga.tar.gz . && cat > ../vbox-ga_tar_gz.sh << end
#!/bin/sh
./base64 -d -i - > vbox-ga.tar.gz << EOF
end
cd $P
base64 -o - vbox-ga.tar.gz >> vbox-ga_tar_gz.sh
echo EOF >> vbox-ga_tar_gz.sh
rm vbox-ga.tar.gz
Binary file added additions/virtualbox/target/x86/base64
Binary file not shown.
Binary file added additions/virtualbox/target/x86/mount.vboxsf
Binary file not shown.
Binary file added additions/virtualbox/target/x86/vboxguest.ko
Binary file not shown.
Binary file added additions/virtualbox/target/x86/vboxsf.ko
Binary file not shown.
Binary file added additions/virtualbox/target/x86/vboxvideo.ko
Binary file not shown.
99 changes: 99 additions & 0 deletions definitions/vcore-tc.5.0.2-core-i386/definition.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
Veewee::Session.declare({
:cpu_count => '1',
:memory_size=> '256',
:disk_size => '512',
:disk_format => 'VDI',
:hostiocache => 'off',
:os_type_id => 'Linux',
:iso_file => "CorePlus-5.0.2.iso",
:iso_src => "http://distro.ibiblio.org/tinycorelinux/5.x/x86/release/CorePlus-5.0.2.iso",
:iso_md5 => '406bf68601aed0a6e29114d4eb280d1d',
#:iso_src => "http://distro.ibiblio.org/tinycorelinux/5.x/x86/release/Core-5.0.2.iso",
#:iso_md5 => 'e67e0932baea447fcd54fdbe13f3a9b5',
:iso_download_timeout => "1000",
:boot_wait => "3",
:boot_cmd_sequence => [
'<Wait><Esc><Wait>core<Enter>',
'<Wait>' * 5,
'fdisk -l<Enter>',
'sudo fdisk /dev/sda<Enter>',
'n<Enter>p<Enter>1<Enter><Enter><Enter>',
't<Enter>83<Enter>w<Enter><Wait><Wait>',
'sudo mkfs.ext3 /dev/sda1<Enter>',
'<Wait>'*3,'fdisk -l<Enter>',
'sudo mkdir /mnt/sda1<Enter>',
'sudo mount /dev/sda1 /mnt/sda1<Enter>',
'sudo mkdir -p /mnt/sda1/boot/grub<Enter>',
'sudo mount /dev/sr0 /mnt/sr0<Enter>',
'cd /mnt/sr0/boot<Enter>sudo cp core.gz vmlinuz /mnt/sda1/boot/<Enter>',
'sudo echo http://kambing.ui.ac.id/tinycorelinux/ > /opt/tcemirror<Enter>',
'tce-load -wi grub2<Enter>', '<Wait>'*35,
'sudo grub-install --boot-directory=/mnt/sda1/boot /dev/sda<Enter>',
'sudo sh -c "cat > /mnt/sda1/boot/grub/grub.cfg" << EOF<Enter>',
'set timeout=0<Enter>',
'insmod ext2<Enter>',
'menuentry \'Core Linux\' {<Enter>',
' set root=(hd0,1)<Enter>',
' linux (hd0,1)/boot/vmlinuz waitusb=0 noswap root=/dev/sda1 tce=sda1<Enter>',
' initrd (hd0,1)/boot/core.gz<Enter>',
'}<Enter>',
'EOF<Enter>',
'sudo mkdir /mnt/sda1/tce<Enter>',
'sudo touch /mnt/sda1/tce/mydata.tgz<Enter>',
'tce-load -wi coreutils<Enter>', '<Wait>'*45,
'sudo cp /usr/local/bin/base64 /mnt/sda1/tce/<Enter><Wait>',
'tce-load -wi curl<Enter>', '<Wait>'*50,
'sudo curl -o /mnt/sda1/tce/vagrant_keys https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub<Enter>',
'<Wait>'*12,
'sudo reboot<Enter>', '<Wait>'*22,
'mv /mnt/sda1/tce/base64 /home/tc/<Enter>',
'tce-load -wi openssh<Enter>', '<Wait>'*55,
#'tce-ab<Enter>s', '<Wait>'*6,'openssh<Enter>', '<Wait>'*10,'q<Wait>I', '<Wait>'*55,'q<Wait>',
'sudo cp /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config<Enter>',
'sudo sh -c "cat >> /opt/.filetool.lst" << EOF<Enter>',
'/etc/sudoers<Enter>',
'/etc/passwd<Enter>',
'/etc/shadow<Enter>',
'/usr/local/etc/ssh<Enter>',
'/lib/modules/3.8.10-tinycore/misc<Enter>',
'EOF<Enter>',
'sudo sed -i s/box/core/g /opt/bootsync.sh<Enter>',
'sudo sh -c "cat >> /opt/bootsync.sh" << EOF<Enter>',
'/bin/mkdir -p /vagrant<Enter>',
'/bin/chown -R tc:staff /vagrant<Enter>',
'/bin/chmod -R 777 /vagrant<Enter><Enter>',
'/usr/local/etc/init.d/openssh start<Enter><Enter>',
'/sbin/depmod -a<Enter>',
'/sbin/modprobe vboxguest<Enter>',
'/sbin/modprobe vboxsf<Enter><Enter>',
'/bin/ln -s /home/tc/bin/mount.vboxsf /sbin/mount.vboxsf<Enter>',
'/bin/ln -s /home/tc/bin/shutdown /sbin/shutdown<Enter>',
'EOF<Enter>',
'sudo passwd tc<Enter><Wait>',
'vagrant<Enter><Wait>',
'vagrant<Enter>',
'ifconfig eth0 | grep inet<Enter>',
'mkdir -p /home/tc/bin<Enter>',
'cat > /home/tc/bin/shutdown << EOF<Enter>',
'#/bin/sh<Enter>',
'poweroff -d 4<Enter>',
'EOF<Enter>',
'chmod 755 /home/tc/bin/shutdown<Enter><Wait>',
#'sudo filetool.sh -b<Enter>',
'sudo /usr/local/etc/init.d/openssh start<Enter>',
'exit<Enter>'
],
#:kickstart_port => "7122",
#:kickstart_timeout => "10000",
#:kickstart_file => "preseed.cfg",
:ssh_login_timeout => "10000",
:ssh_user => "tc",
:ssh_password => "vagrant",
:ssh_key => "",
:ssh_host_port => "7222",
:ssh_guest_port => "22",
:sudo_cmd => "echo '%p'|sudo -S sh '%f'",
:shutdown_cmd => "/home/tc/bin/shutdown",
:postinstall_files => [ "vbox-ga_tar_gz.sh", "postinstall.sh"],
:postinstall_timeout => "10000"
})
50 changes: 50 additions & 0 deletions definitions/vcore-tc.5.0.2-core-i386/postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# postinstall.sh

VBOX_VERSION=$(cat /home/tc/.vbox_version)
MODULES_DIR=/lib/modules/3.8.10-tinycore/misc

mkdir -p bin && chown tc bin && chgrp staff bin
date > /opt/vagrant_box_build_time
/bin/ln -s /home/tc/bin/shutdown /sbin/shutdown

# Virtualbox additions
rm -f ./base64
mkdir -p $MODULES_DIR
tar xvfz vbox-ga.tar.gz
chown root:root *.ko; chmod 644 *.ko
mv ./vboxguest.ko ./vboxsf.ko ./vboxvideo.ko $MODULES_DIR
mv ./mount.vboxsf bin/
rm -f ./vbox-ga.tar.gz

# Setup sudo to allow no-password sudo for "admin"
#groupadd -r admin
#usermod -a -G admin vagrant
#cp /etc/sudoers /etc/sudoers.orig
#sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers
#sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=NOPASSWD:ALL/g' /etc/sudoers

# Installing vagrant keys
mkdir -p /home/tc/.ssh
chmod 700 /home/tc/.ssh
cat /mnt/sda1/tce/vagrant_keys >> /home/tc/.ssh/authorized_keys
rm /mnt/sda1/tce/vagrant_keys
chmod 600 /home/tc/.ssh/authorized_keys
chown -R tc:staff /home/tc/.ssh

# Hints for Dev
#tce-load -iw compiletc
#tce-load -iw advcomp
#tce-load -iw mkisofs-tools
#tce-load -iw linux-3.8.10-sources-env
#/usr/local/bin/linux-3.8.10-sources-env.sh

# Cleaning up
rm -f VBoxGuestAdditions_$VBOX_VERSION.iso
rm -f /home/tc/.veewee_params
rm -f /home/tc/.veewee_version
rm -f /home/tc/vbox-ga_tar_gz.sh
rm -f /home/tc/postinstall.sh
cat /dev/null > /home/tc/.ash_history

filetool.sh -b
exit 0
4 changes: 4 additions & 0 deletions definitions/vcore-tc.5.0.2-core-i386/vbox-ga_tar_gz.sh

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions vagrantfiles/vcore-tc.5.0.2-core-i386/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
config.vm.box = "vcore-tc.5.0.2-core-i386"

config.vagrant.host = :detect
config.package.name = 'vcore-tc.5.0.2-core-i386.box'

#config.vm.box_url = "https://github.com/hyamamoto/virtual-core/releases/download/untagged-45966bbcf425f3fca0b1/vcore-tc.5.0.2-core-i386.box"
config.vm.boot_timeout = 40
config.vm.graceful_halt_timeout = 90
config.vm.host_name = 'core'
config.vm.guest = :linux



config.vm.network :forwarded_port,
auto_correct: true,
guest: 22, host: 2222,
host_ip: "127.0.0.1", id: "ssh"

config.vm.synced_folder ".", "/vagrant"

config.vm.provider :virtualbox do |vb|
#vb.gui = true
#vb.customize ["modifyvm", :id, "--memory", "512"]
end

config.ssh.default.username = "tc"
config.ssh.shell = "sh"
config.ssh.guest_port = 22
config.ssh.forward_agent = false
config.ssh.forward_x11 = false
config.ssh.keep_alive = true

end

0 comments on commit 3e04e13

Please sign in to comment.