Hello again,
I've also hacked together a script that creates an iso-image which eases up the installation process in two ways.
Either your installing TCL in an NTFS partition: for this case the ISO an initramfs with ntfs-3g integrated. GRUB4DOS is used as the bootloader of the CD and can also be used for booting TCL from the Windows bootloader just by copying it to harddisk, if you're using Windows XP. If you're using Windows Vista or later, all files needed for integration in the Windows bootloader are also integrated, but you'll need to do a bit more than just copying.
If you're installing TCL in a native partition also everything you need is included and you can setup your new system in just four steps:
- partition harddisk
- format Linux partition
- copy the whole contents of the CD to the newly created partition
- run bootlace.com (yes, even though it's a .com it also runs on Linux) to write the bootloader loading GRUB4DOS
That's all. No more downloading of grub-0.97-splash, no need to edit boot/grub/menu.lst.
A PXE loader is also included in case you want to boot via network but your machine lacks the support.
At the time of writing the script looks like this:
#!/bin/sh
TCMIRROR="http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/3.x"
GPXE_VERSION="1.0.1"
RELEASES="release release_candidates"
INITRDS="tinycore.gz microcore.gz microcore64.gz"
KERNELS="bzImage bzImage64"
TCZLIST="kmaps setproxy"
TCZOPT=""
ISONAME="thefullcore.iso"
OPTIONS="quiet"
MYDATA="mydata"
#CONFIGURATION#END#
if [ $(id -u) -ne 0 ]; then
echo "this script requires root priviliges. retrying with fakeroot."
exec fakeroot $0 $@
exit 1
fi
for addon; do
echo loading ${addon}
. ./${addon}
done
# clean up stuff that might be left over
rm -rf isoroot
# create working directories
mkdir -p tcz release release_candidates
mkdir -p isoroot/tce/extra isoroot/tce/doc isoroot/tce/optional
starbanner()
{
s="$(echo $*|sed 's/./*/g')"
echo "**${s}**"
echo "* ${*} *"
echo "**${s}**"
}
tczdep1()
{
echo ${1}
rm -f "tcz/${1}.tcz.dep"
(cd tcz ; wget "${TCMIRROR}/tcz/${1}.tcz.dep" 2>/dev/null; cd ..)
if [ -s "tcz/${1}.tcz.dep" ]; then
cat "tcz/${1}.tcz.dep" | while read tcz ; do
if [ -n "${tcz}" ]; then
tczdep1 ${tcz%.tcz}
fi
done
fi
}
tczdep()
{
for pkg; do
tczdep1 ${pkg}
done | sort -u | tr '\n' ' '
echo
}
addproxy()
{
cat <<EOF >initrd/etc/profile.d/proxy.sh
for i in \$(cat /proc/cmdline); do
case \$i in
*_proxy=*) eval export \$i;;
proxy=*) [ -z "\${http_proxy}" ] && export http_proxy=\${i#*=}
[ -z "\${https_proxy}" ] && export https_proxy=\${i#*=}
[ -z "\${ftp_proxy}" ] && export ftp_proxy=\${i#*=} ;;
esac
done
EOF
}
adddoc()
{
(cat <<EOF
@echo off
Setlocal
::Set path to bcdedit.exe (e.g. C:\\Windows\\System32\\bcdedit.exe)
Set BCDEDIT=C:\Windows\System32\bcdedit.exe
::Set path to BCD Store (e.g. C:\\boot\\BCD)
Set STORE=C:\\boot\\BCD
if exist %BCDEDIT% goto foundbcdedit
echo %BCDEDIT% not found, please edit this script
pause
exit
:foundbcdedit
if exist %STORE% goto foundstore
echo %STORE% not found, please edit this script
pause
exit
:foundstore
for /f "tokens=3" %%A in ('%BCDEDIT% /store %STORE% /create /d "GRUB4DOS" /application bootsector') do set guid=%%A
%BCDEDIT% /store %STORE% /set %guid% device boot
%BCDEDIT% /store %STORE% /set %guid% path \grldr.mbr
%BCDEDIT% /store %STORE% /displayorder %guid% /addlast
endlocal
pause
exit
EOF
) | sed 's/$/\r/' >isoroot/tce/doc/bcdsetup.cmd
}
getversion()
{
tr '_' ' ' <initrd/usr/share/doc/tc/release.txt | sed -e s@tinycore@TinyCore@ -e s@microcore@MicroCore@
}
download_core()
{
for r in ${RELEASES}; do
(cd "${r}"
for i in ${KERNELS} ${INITRDS}; do
rm -f "${i}.md5.txt"
wget "${TCMIRROR}/${r}/distribution_files/${i}.md5.txt" 2>/dev/null
if [ -f "${i}.md5.txt" ]; then
if md5sum -c "${i}.md5.txt"; then
echo "${i} already downloaded and up to date"
else
rm -f "${i}"
wget "${TCMIRROR}/${r}/distribution_files/${i}"
fi
else
rm -f "${i}"
fi
done)
done
}
download_tcz()
{
for i; do
(cd "tcz"
rm -f "${i}.tcz.md5.txt"
wget "${TCMIRROR}/tcz/${i}.tcz.md5.txt" 2>/dev/null
if md5sum -c "${i}.tcz.md5.txt"; then
echo "${i} already downloaded and up to date"
else
rm -f "${i}.tcz"
wget "${TCMIRROR}/tcz/${i}.tcz"
fi)
done
}
copycore()
{
initrd="${1##*/}"
kernel="bzImage"
directory="${1%/*}"
rm -rf initrd
mkdir initrd
(cd initrd ; gzip -dc "../${directory}/${initrd}" | cpio -i)
version="$(getversion)"
if [ -n "$(echo ${initrd}|grep 64)" ]; then
version="${version} 64bit"
kernel="${kernel}64"
fi
mkdir -p "isoroot/tce/${directory}"
cp "${directory}/${initrd}" "isoroot/tce/${directory}/${initrd}"
[ -f "isoroot/tce/${directory}/${kernel}" ] || cp "${directory}/${kernel}" "isoroot/tce/${directory}"
cat >>isoroot/menu.lst <<EOF
title ${version}
find --set-root /tce/${directory}/${initrd}
kernel /tce/${directory}/${kernel} ${OPTIONS}
initrd /tce/${directory}/${initrd}
EOF
}
remaster()
{
initrd="${1##*/}"
newinitrd="${initrd%.*}plus.gz"
kernel="bzImage"
directory="${1%/*}"
shift
rm -rf initrd
mkdir initrd
(cd initrd ; gzip -dc "../${directory}/${initrd}" | cpio -i)
version="$(getversion)"
if [ -n "$(echo ${initrd}|grep 64)" ]; then
version="${version} 64bit"
kernel="${kernel}64"
fi
# addproxy
mkdir -p "initrd/usr/local/tce.installed"
for pkg in $@; do
unsquashfs -f -d initrd "tcz/${pkg}.tcz" >/dev/null
touch "initrd/usr/local/tce.installed/${pkg}"
done
sed -i 's/\$(blkid \$1)/$(blkid $1|sed s@TYPE=\\"ntfs\\"@TYPE=\\"ntfs-3g\\"@g)/' initrd/usr/sbin/fstype
ldconfig -r initrd
mkdir -p "isoroot/tce/${directory}"
(cd initrd ; find . | cpio -H newc -o | gzip > "../isoroot/tce/${directory}/${newinitrd}")
advdef -z4 "isoroot/tce/${directory}/${newinitrd}" || true
[ -f "isoroot/tce/${directory}/${kernel}" ] || cp "${directory}/${kernel}" "isoroot/tce/${directory}"
cat >>isoroot/menu.lst <<EOF
title ${version} with ntfs-3g
find --set-root /tce/${directory}/${newinitrd}
kernel /tce/${directory}/${kernel} ${OPTIONS}
initrd /tce/${directory}/${newinitrd}
EOF
}
rom_o_matic()
{
url="http://www.rom-o-matic.net/gpxe/gpxe-${GPXE_VERSION}/contrib/rom-o-matic/"
vers="$(echo ${GPXE_VERSION}|tr -d .)"
if [ ! -f "gpxe${vers}.krn" ]; then
wget -O "gpxe${vers}.krn" ${url}build.php --referer=${url} \
--post-data="version=${GPXE_VERSION}&ofmt=Linux+kernel+%28SYSLINUX%2FGRUB%2FLILO%29+loadable+image+%28.lkrn%29&nic=all-drivers&pci_vendor_code=&pci_device_code=&A=Get+Image"
fi
mkdir -p "isoroot/tce/extra"
cp "gpxe${vers}.krn" "isoroot/tce/extra"
cat >>isoroot/menu.lst <<EOF
title gPXE ${GPXE_VERSION}
find --set-root /tce/extra/gpxe${vers}.krn
kernel /tce/extra/gpxe${vers}.krn
EOF
}
helppage()
{
cat >>isoroot/menu.lst <<EOF
title Display boot options help
configfile /tce/extra/help.lst
EOF
(cat <<EOF
[select any item to go back] created: $(date "+%Y-%m-%d %H:%M")
The following options can be appended as boot parameters. Instead of
pressing enter to boot, press 'e' twice and then add the parameters
separated by spaces.
Color 640x480 800x600 1024x768 1280x1024
256 8 bit 769 771 773 775
32768 15 bit 784 787 790 793
65536 16 bit 785 788 791 794
16.7M 24 bit 786 789 792 795
vga=7xx 7xx from table above
xsetup Prompt user for Xvesa setup
tce={hda1|sda1} Specify Restore TCE apps directory
base Skip TCE load only the base system
norestore Turn off the automatic restore
restore={hda1|sda1|floppy} Specify saved configuration location
{cron|syslog} Start various daemons at boot
lang=en Choose Language (currently english only)
kmap=us others like de-latin1 need kmaps.tcz
host=xxxx Set hostname to xxxx
noswap Do not use swap partition
swapfile{=hda1} Scan or Specify for a swap file
nodhcp Skip the dhcp request for eth0 at boot
superuser Textmode as user root
text Textmode
waitusb=X Wait X seconds for slow USB devices.
home={hda1|sda1} Specify peristent home directory.
opt={hda1|sda1} Specify peristent opt directory.
local={hda1|sda1} Specify PPI directory or loopback file.
showapps Display application names while booting.
secure Set password.
noautologin Use in conjunction with secure.
protect Password Encrypted Backup.
checkfs Check Ext2/Ext3 filesystems.
pause Pause at completion of boot messages.
noutc BIOS is using localtime.
tz=GMT+8 Timezone tz=PST+8PDT,M4.2.0/2,M11.1.0/2
settime Set UTC time at boot, internet required.
user=abc Specify alternate user.
desktop=yyy Specify alternate desktop.
noicons Do not use icons.
laptop Force load of laptop related modules.
xvesa=800x600x32 Set Xvesa default screen resolution.
bkg=image.{jpg|png|gif} Set background from /opt/backgrounds.
lst=yyy.lst Load alternate static yyy.lst on boot.
blacklist=ssb Blacklist a single module.
These options are used to configure bundled tcz packages:
proxy=http://proxy:port/ set a proxy server
EOF
) | while read line;do echo -e "title ${line}\nconfigfile /menu.lst\n"; done >isoroot/tce/extra/help.lst
}
buildiso()
{
unsquashfs -f -d grub4dos tcz/grub4dos.tcz >/dev/null
cp grub4dos/usr/local/share/grub4dos/grldr isoroot
cp grub4dos/usr/local/share/grub4dos/grldr.mbr isoroot/tce/extra
cp grub4dos/usr/local/share/grub4dos/bootlace.com isoroot/tce/extra
cp grub4dos/usr/local/share/grub4dos/HOWTO isoroot/tce/doc
mkisofs -V TinyCoreCD -J -R -b grldr -no-emul-boot -boot-load-size 4 \
-input-charset utf-8 -hide boot.catalog -o "${ISONAME}" isoroot
}
cat <<EOF >isoroot/menu.lst
color cyan/blue white/cyan white/black white/black
timeout=10
default=1
EOF
starbanner "downloading tinycore and microcore components"
download_core
starbanner "dissolving extension dependencies"
alltcz="$(tczdep ${TCZLIST} ${TCZOPT})"
starbanner "downloading tinycore extensions"
download_tcz grub4dos ntfs-3g ${alltcz}
for r in ${RELEASES}; do
for i in ${INITRDS}; do
if [ -f "${r}/${i}" ]; then
starbanner "copying ${i}"
copycore "${r}/${i}"
starbanner "remastering ${i}"
remaster "${r}/${i}" ntfs-3g #kmaps
fi
done
done
starbanner "copying extensions"
touch isoroot/tce/copy2fs.flg
for i in ${alltcz}; do
cp -v tcz/${i}* isoroot/tce/optional
done
starbanner "creating onboot.lst"
for i in ${TCZLIST}; do
echo "${i}.tcz"
done > isoroot/tce/onboot.lst
if [ -d "${MYDATA}" ]; then
starbanner "integrating mydata.tgz"
tar -C "${MYDATA}" -zcvf "isoroot/tce/mydata.tgz" $(cd "${MYDATA}";echo *)
fi
starbanner "copying gpxe ${GPXE_VERSION}"
rom_o_matic
starbanner "copying documentation"
helppage
adddoc
starbanner "building ${ISONAME}"
buildiso