Skip to content

Commit

Permalink
sync with vmware build tree
Browse files Browse the repository at this point in the history
  • Loading branch information
davilla@4pi.com committed Jun 15, 2008
1 parent ba90faa commit 8cf7df8
Show file tree
Hide file tree
Showing 17 changed files with 226 additions and 104 deletions.
28 changes: 16 additions & 12 deletions boot_loader.c
Expand Up @@ -29,7 +29,7 @@
// PCI: Failed to allocate mem resource #6:20000@20000000 for 0000:01:00.0

// RAM top 0x10000000
// mach_kernel loads at 0x0B000000
// mach_kernel loads at 0x02000000
// linux kernel loads at 0x00100000
// linux kernel reserve to 0x00400000
// linux initrd loads at 0x00F43800
Expand Down Expand Up @@ -57,16 +57,16 @@ mach_boot_parms *mach_bp;
void
load_linux(unsigned int args)
{
int i;
char *ptr;
kdesc_t kd;
unsigned char szBootSect[BOOT_PARAM_MEMSIZE];
boot_params_t *bp = (boot_params_t*)szBootSect;
char *cmdline = (char*)&szBootSect[BOOT_PARAM_MEMSIZE - 2048];
unsigned long kernel_len = 0;
unsigned char *kernel_ptr = NULL;
unsigned long initrd_len = 0;
unsigned char *initrd_ptr = NULL;
int i;
char *ptr;
kdesc_t kd;
unsigned char szBootSect[BOOT_PARAM_MEMSIZE];
boot_params_t *bp = (boot_params_t*)szBootSect;
char *cmdline = (char*)&szBootSect[BOOT_PARAM_MEMSIZE - 2048];
unsigned long kernel_len = 0;
unsigned char *kernel_ptr = NULL;
unsigned long initrd_len = 0;
unsigned char *initrd_ptr = NULL;

mach_bp = (mach_boot_parms*)args;

Expand All @@ -81,7 +81,7 @@ load_linux(unsigned int args)
VIDEO_CURSOR_POSY = 0;
VIDEO_ATTR = 0xffc8c8c8;
//
printk("ATV: ATV_BootLoader v0.7 (http://code.google.com/p/atv-bootloader)\n");
printk("ATV: ATV_BootLoader v0.8 (http://atv-bootloader.googlecode.com/)\n");
printk("ATV: Copyright (C) 2008 ATV Bootloader Team - Licensed under the GPL v2\n");
printk("ATV: FB Start 0x%08X, with %d height %d rowb %d depth %d\n",
mach_bp->video.addr,
Expand All @@ -90,6 +90,10 @@ load_linux(unsigned int args)
mach_bp->video.rowb,
mach_bp->video.depth);

//printk("mach_bp->devtree_len=0x%08X, mach_bp->devtree_ptr=0x%08X",
// mach_bp->devtree_len, mach_bp->devtree_ptr);
//sleep(10);

// find the kernel and load it in the proper location
kernel_ptr = (unsigned char*)getsectdatafromheader(&_mh_execute_header, "__TEXT", "__vmlinuz", &kernel_len);
//printk("ATV: kernel_ptr = 0x%08X, kernel_len = 0x%08X\n", kernel_ptr, kernel_len);
Expand Down
6 changes: 3 additions & 3 deletions darwin_code.h
Expand Up @@ -3,7 +3,7 @@

#include "types.h"

#define DARWIN_IMAGE_BASE 0x00B000000
#define DARWIN_IMAGE_BASE 0x002000000
// xnu pexpert/pexpert/i386/boot.h
/* Values for v_display */
#define VGA_TEXT_MODE 0
Expand Down Expand Up @@ -31,7 +31,7 @@ typedef struct _mach_video_parms {
typedef struct _mach_boot_parms {
uint16_t rev;
uint16_t ver;
char cmdline[CMDLINE];
char cmdline[CMDLINE];
uint32_t efi_mem_map;
uint32_t efi_mem_map_size;
uint32_t efi_mem_desc_size;
Expand Down Expand Up @@ -78,7 +78,7 @@ struct mach_header {
/* Constant for the magic field of the mach_header (32-bit architectures) */
#define MH_MAGIC 0xfeedface /* the mach magic number */
#define MH_CIGAM 0xcefaedfe /* NXSwapInt(MH_MAGIC) */
#define MH_OBJECT 0x1 /* relocatable object file */
#define MH_OBJECT 0x1 /* relocatable object file */
//
//
#define LC_SEGMENT 0x1 /* segment of this file to be mapped */
Expand Down
22 changes: 11 additions & 11 deletions elilo_code.c
Expand Up @@ -106,7 +106,7 @@ create_boot_params(boot_params_t *bp, char *cmdline)
*/
bp->s.loader_flags = LDRFLAG_LOADED_HIGH;
//kernel_setup->heap_end_ptr = 0xffff; /* 64K heap */
//kernel_setup->flags = 0x81; /* loaded high, heap existant */
//kernel_setup->flags = 0x81; /* loaded high, heap existant */

// Setup command line information.
bp->s.cmdline_magik = CMDLINE_MAGIK;
Expand Down Expand Up @@ -147,15 +147,15 @@ create_boot_params(boot_params_t *bp, char *cmdline)
/*
// Find out the kernel's restriction on how high the initrd can be placed
(this is from etherboot -> linux_load.c -> load_initrd
if (hdr->protocol_version >= 0x203)
max = hdr->initrd_addr_max;
else
max = 0x38000000; // Hardcoded value for older kernels
if (hdr->protocol_version >= 0x203) {
max = hdr->initrd_addr_max;
} else {
max = 0x38000000; // Hardcoded value for older kernels
}
end = max;
start = end - size;
start &= ~0xfff; // page align
end = start + size;
start = end - size;
start &= ~0xfff; // page align
end = start + size;
*/

Expand Down Expand Up @@ -233,7 +233,7 @@ create_boot_params(boot_params_t *bp, char *cmdline)
//bp->s.lfb_pages = 1;
bp->s.lfb_red_size = 8;
bp->s.lfb_red_pos = 16;
bp->s.lfb_green_size = 8;
bp->s.lfb_green_size = 8;
bp->s.lfb_green_pos = 8;
bp->s.lfb_blue_size = 8;
bp->s.lfb_blue_pos = 0;
Expand All @@ -257,7 +257,7 @@ create_boot_params(boot_params_t *bp, char *cmdline)
fill_e820map(bp);
//
//print_e820_memory_map(bp);
//sleep(20);
//sleep(60);
//
//

Expand Down
6 changes: 4 additions & 2 deletions initramfs/apps/boot_linux.sh
Expand Up @@ -74,11 +74,13 @@ for x in $SEARCH_PARTITIONS; do
if /tmp/kexec_load.sh; then
echo "kexec jump to new kernel"
# umount all filesystem
cd /
umount -a
cd /
umount -a
kexec -e
# if we get here, kexec failed
umount $ROOT
# mount everything again
mount -a
exit 1
fi
fi
Expand Down
18 changes: 9 additions & 9 deletions initramfs/apps/boot_parser/boot_parser.c
@@ -1,23 +1,23 @@
/* parse_config.c - Main source
/* boot_parser.c - Main source
* Copyright (C) 2008 Scott D. Davilla <davilla@4pi.com>
* All rights reserved.
* parse_config is free software; you can redistribute it and/or modify
* boot_parser is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation
This parse_config inputs grub, kboot, syslinux, isolinux and mb_boot_tv
This boot_parser inputs grub, kboot, syslinux, isolinux and mb_boot_tv
boot configuration files and outputs a kexec load string.
For example;
parse_config --root=/mnt/rootfs --file=/mnt/rootfs/boot/grub/menu.lst
parse_config --root=/mnt/rootfs --file=/mnt/rootfs/boot/kboot.conf
parse_config --root=/mnt/rootfs --file=/mnt/rootfs/syslinux.cfg
parse_config --root=/mnt/rootfs --file=/mnt/rootfs/isolinux.cfg
parse_config --root=/mnt/rootfs --file=/mnt/rootfs/mb_boot_tv.cfg
boot_parser --root=/mnt/rootfs --config=/mnt/rootfs/boot/grub/menu.lst
boot_parser --root=/mnt/rootfs --config=/mnt/rootfs/boot/kboot.conf
boot_parser --root=/mnt/rootfs --config=/mnt/rootfs/syslinux.cfg
boot_parser --root=/mnt/rootfs --config=/mnt/rootfs/isolinux.cfg
boot_parser --root=/mnt/rootfs --config=/mnt/rootfs/mb_boot_tv.cfg
where;
--root is the mount point for the kexec booted filesystem (where vmlinux/initrd live)
--file is the path to the bootloader conf file.
--config is the path to the bootloader conf file.
*/
//
//
Expand Down
2 changes: 1 addition & 1 deletion initramfs/apps/busybox/busybox.config
Expand Up @@ -410,7 +410,7 @@ CONFIG_VLOCK=y
# Linux Ext2 FS Progs
#
CONFIG_CHATTR=y
CONFIG_FSCK=y
CONFIG_FSCK=n
CONFIG_LSATTR=y

#
Expand Down
3 changes: 2 additions & 1 deletion initramfs/apps/busybox/mk_busybox.sh
Expand Up @@ -13,7 +13,8 @@ make
make install

cd ..
cp -arp busybox-1.9.1/_install/* build
rm -rf build/*
cp -arp busybox-1.9.1/_install/* build/

rm -rf busybox-1.9.1

46 changes: 46 additions & 0 deletions initramfs/apps/parted/Makefile
@@ -0,0 +1,46 @@
# Version 2.0 (May 18, 2008)
#
# This script builds a patched parted to support apple recovery GUID
# disk partitions. Using the flag "atvrcv" will make selected partions
# into one with an Apple "Recovery" GUID of
# "5265636F-7665-11AA-AA11-00306543ECAC"
#
# The atv-bootloader must be installed into an Apple "Recovery"
# partition in order for boot.efi to find and load it. In addition,
# there are several "support" files required". This script only
# creates a patched parted so that Apple "Recovery" partitons
# can be created.
#
# See the following link for gpt and GUID info
# http://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
#
#

PACKAGE = parted-1.8.8
DOWNLOAD = parted-1.8.8.tar.bz2

.PHONY: parted

parted: build/parted build/partprobe
sudo apt-get install uuid-dev
sudo apt-get install libreadline5-dev
@if [ ! -e $(DOWNLOAD) ]; then \
wget ftp.gnu.org/gnu/parted/$(DOWNLOAD); \
fi
@if [ ! -d $(PACKAGE) ]; then \
tar -xjf $(DOWNLOAD); \
cd $(PACKAGE); \
patch -p1 < ../appletv_parted-1.8.8.patch; \
./configure CFLAGS="-fgnu89-inline" --enable-static=yes; \
cd .. ; \
fi
cd $(PACKAGE) && $(MAKE)
cp $(PACKAGE)/parted/.libs/parted build/
cp $(PACKAGE)/partprobe/.libs/partprobe build/
cp parted-1.8.8/libparted/.libs/libparted-1.8.so.8 build/

clean:
rm -rf build/*
rm -rf $(PACKAGE)
rm $(DOWNLOAD)

5 changes: 3 additions & 2 deletions initramfs/apps/parted/mk_parted.sh
Expand Up @@ -35,7 +35,8 @@ patch -p1 < ../appletv_parted-1.8.8.patch
echo "Building parted"
./configure --enable-static
make
cp parted/parted ../build
cp partprobe/partprobe ../build
cp parted/.libs/parted ../build
cp partprobe/.libs/partprobe ../build
cp libparted/.libs/libparted-1.8.so.8 ../build
cd ..
sudo rm -rf parted-1.8.8
10 changes: 5 additions & 5 deletions initramfs/cpy_libs.mk
Expand Up @@ -15,10 +15,10 @@ all:
LIB_PATH=$$( echo $$LIB | sed -e 's/[^/]*$$//' ) ; \
mkdir -p rootfs/$$LIB_PATH ; \
cp -aH $$LIB rootfs/$$LIB_PATH
mkdir -p rootfs/usr/share/terminfo
cp -aL /usr/share/terminfo/a rootfs/usr/share/terminfo
cp -aL /usr/share/terminfo/l rootfs/usr/share/terminfo
cp -aL /usr/share/terminfo/v rootfs/usr/share/terminfo
cp -aL /usr/share/terminfo/x rootfs/usr/share/terminfo
#mkdir -p rootfs/usr/share/terminfo
#cp -aL /usr/share/terminfo/a rootfs/usr/share/terminfo
#cp -aL /usr/share/terminfo/l rootfs/usr/share/terminfo
#cp -aL /usr/share/terminfo/v rootfs/usr/share/terminfo
#cp -aL /usr/share/terminfo/x rootfs/usr/share/terminfo
touch rootfs/etc/ld.so.conf

0 comments on commit 8cf7df8

Please sign in to comment.