* This patch renames remainders the arch i386 to x86.
* fix arch/io.h to use consistent types * add compression code and start integration into Kconfig * update to newer version of Kconfig, and rename some occurences of "Linux" to "LinuxBIOS" * set up Make framework to create linuxbios.rom Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Ronald G Minnich <rminnich@lanl.gov> git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@55 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
1fa5d301a6
commit
f2000cd4ad
43 changed files with 1747 additions and 401 deletions
21
Kconfig
21
Kconfig
|
|
@ -9,25 +9,6 @@ source mainboard/Kconfig
|
|||
|
||||
source arch/Kconfig
|
||||
|
||||
config BOOTFLASH
|
||||
bool
|
||||
default y
|
||||
help
|
||||
Build the BOOTFLASH area. This includes all the reset vector,
|
||||
Cache-As-Ram (CAR) code, early device setup, and the code that
|
||||
parses the "file system" in the non-BOOTFLASH area.
|
||||
source lib/Kconfig
|
||||
|
||||
config BIOS
|
||||
bool
|
||||
default y
|
||||
help
|
||||
Build the rest of the BIOS. This includes memory init, device
|
||||
init, PCI init, and so on.
|
||||
|
||||
config UNCOMPRESSORS
|
||||
bool
|
||||
default y
|
||||
help
|
||||
Build the various uncompressors found in the uncompressors
|
||||
directory.
|
||||
|
||||
|
|
|
|||
|
|
@ -20,5 +20,4 @@
|
|||
|
||||
config ARCH_POWERPC
|
||||
boolean
|
||||
default n
|
||||
|
||||
|
|
|
|||
|
|
@ -20,5 +20,4 @@
|
|||
|
||||
config ARCH_X86
|
||||
boolean
|
||||
default n
|
||||
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@
|
|||
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
##
|
||||
|
||||
obj-y += init/
|
||||
#obj-y += init/
|
||||
|
||||
|
|
|
|||
110
arch/x86/Makefile.target
Normal file
110
arch/x86/Makefile.target
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
##
|
||||
## This file is part of the LinuxBIOS project.
|
||||
##
|
||||
## Copyright (C) 2006 coresystems GmbH
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
##
|
||||
|
||||
#
|
||||
# This part builds the last 16 byte containing the jmp to the code
|
||||
# and a date or stamp or pointer to a data structure that flashrom
|
||||
# might want to read
|
||||
#
|
||||
|
||||
linuxbios.jump: FORCE
|
||||
$(Q)echo "Building jump vector"
|
||||
$(Q)dd if=/dev/zero of=$(objtree)/linuxbios.jump bs=16 count=1 # 0x10
|
||||
touch $(objtree)/linuxbios.jump
|
||||
|
||||
|
||||
#
|
||||
# This part takes care of compression. It should build the compression modules
|
||||
# in a way that they can be put in the lar. FIXME it belongs in lib/
|
||||
#
|
||||
|
||||
lzma:
|
||||
$(Q)echo "building lzma"
|
||||
|
||||
|
||||
#
|
||||
# initram is always uncompressed. It belongs into the mainboard directory
|
||||
# and is build from what was auto.c in v2
|
||||
#
|
||||
|
||||
initram:
|
||||
$(Q)echo "building initram"
|
||||
|
||||
#
|
||||
# this is the rest of linuxbios (v2: linuxbios_ram.rom)
|
||||
# Is this maybe platform independent, except for the "drivers"?
|
||||
# Where should it be built?
|
||||
#
|
||||
# This needs to be compressed with the default compressor
|
||||
#
|
||||
|
||||
linuxbios_ram:
|
||||
$(Q)echo "building linuxbios_ram"
|
||||
|
||||
#
|
||||
# The payload as we love it. Get it from somewhere.
|
||||
# Is this a place to incorporate buildrom?
|
||||
#
|
||||
# This needs to be compressed with the default compressor
|
||||
#
|
||||
|
||||
payload:
|
||||
$(Q)echo "building payload"
|
||||
|
||||
#
|
||||
# build the lar archive
|
||||
#
|
||||
|
||||
|
||||
linuxbios.lar: lzma initram linuxbios_ram payload
|
||||
$(Q)echo lar c $(objdir)/linuxbios.lar $^
|
||||
$(Q)dd if=/dev/zero of=$(objtree)/linuxbios.lar bs=57088 count=1
|
||||
|
||||
|
||||
#
|
||||
# this is going to be the enable car code, lar parser and such:
|
||||
#
|
||||
|
||||
|
||||
linuxbios.init:
|
||||
$(Q)echo Building init from $^
|
||||
$(Q)dd if=/dev/zero of=$(objtree)/linuxbios.init bs=8192 count=1
|
||||
|
||||
#
|
||||
# VPD or SIP ROM or ... how does nvidia call it?
|
||||
# Some space to cope with dirty southbridge tricks.
|
||||
# Do we want to put our own stuff there, too?
|
||||
#
|
||||
|
||||
linuxbios.vpd:
|
||||
$(Q)printf "Building dummy VPD ..."
|
||||
$(Q)dd if=/dev/zero of=$(objtree)/linuxbios.vpd bs=240 count=1 # 0xf0
|
||||
$(Q)printf "ok.\n"
|
||||
|
||||
#
|
||||
# Compose the image:
|
||||
#
|
||||
|
||||
linuxbios.rom: linuxbios.lar linuxbios.init linuxbios.vpd linuxbios.jump
|
||||
$(Q)cat $(objtree)/linuxbios.lar $(objtree)/linuxbios.init \
|
||||
$(objtree)/linuxbios.vpd $(objtree)/linuxbios.jump > \
|
||||
$(objtree)/linuxbios.rom
|
||||
|
||||
.PHONY: linuxbios.rom
|
||||
|
|
@ -18,5 +18,5 @@
|
|||
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
##
|
||||
|
||||
obj-y += init.o
|
||||
head-y += init.o
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#ifndef _ARCH_IO_H
|
||||
#define _ARCH_IO_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <arch/types.h>
|
||||
|
||||
/*
|
||||
* This file contains the definitions for the x86 IO instructions
|
||||
|
|
@ -26,43 +26,43 @@
|
|||
* versions of the single-IO instructions (inb_p/inw_p/..).
|
||||
*/
|
||||
|
||||
static inline void outb(uint8_t value, uint16_t port)
|
||||
static inline void outb(u8 value, u16 port)
|
||||
{
|
||||
__asm__ __volatile__ ("outb %b0, %w1" : : "a" (value), "Nd" (port));
|
||||
}
|
||||
|
||||
static inline void outw(uint16_t value, uint16_t port)
|
||||
static inline void outw(u16 value, u16 port)
|
||||
{
|
||||
__asm__ __volatile__ ("outw %w0, %w1" : : "a" (value), "Nd" (port));
|
||||
}
|
||||
|
||||
static inline void outl(uint32_t value, uint16_t port)
|
||||
static inline void outl(u32 value, u16 port)
|
||||
{
|
||||
__asm__ __volatile__ ("outl %0, %w1" : : "a" (value), "Nd" (port));
|
||||
}
|
||||
|
||||
static inline uint8_t inb(uint16_t port)
|
||||
static inline u8 inb(u16 port)
|
||||
{
|
||||
uint8_t value;
|
||||
u8 value;
|
||||
__asm__ __volatile__ ("inb %w1, %b0" : "=a"(value) : "Nd" (port));
|
||||
return value;
|
||||
}
|
||||
|
||||
static inline uint16_t inw(uint16_t port)
|
||||
static inline u16 inw(u16 port)
|
||||
{
|
||||
uint16_t value;
|
||||
u16 value;
|
||||
__asm__ __volatile__ ("inw %w1, %w0" : "=a"(value) : "Nd" (port));
|
||||
return value;
|
||||
}
|
||||
|
||||
static inline uint32_t inl(uint16_t port)
|
||||
static inline u32 inl(u16 port)
|
||||
{
|
||||
uint32_t value;
|
||||
u32 value;
|
||||
__asm__ __volatile__ ("inl %w1, %0" : "=a"(value) : "Nd" (port));
|
||||
return value;
|
||||
}
|
||||
|
||||
static inline void outsb(uint16_t port, const void *addr, unsigned long count)
|
||||
static inline void outsb(u16 port, const void *addr, unsigned long count)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"cld ; rep ; outsb "
|
||||
|
|
@ -71,7 +71,7 @@ static inline void outsb(uint16_t port, const void *addr, unsigned long count)
|
|||
);
|
||||
}
|
||||
|
||||
static inline void outsw(uint16_t port, const void *addr, unsigned long count)
|
||||
static inline void outsw(u16 port, const void *addr, unsigned long count)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"cld ; rep ; outsw "
|
||||
|
|
@ -80,7 +80,7 @@ static inline void outsw(uint16_t port, const void *addr, unsigned long count)
|
|||
);
|
||||
}
|
||||
|
||||
static inline void outsl(uint16_t port, const void *addr, unsigned long count)
|
||||
static inline void outsl(u16 port, const void *addr, unsigned long count)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"cld ; rep ; outsl "
|
||||
|
|
@ -90,7 +90,7 @@ static inline void outsl(uint16_t port, const void *addr, unsigned long count)
|
|||
}
|
||||
|
||||
|
||||
static inline void insb(uint16_t port, void *addr, unsigned long count)
|
||||
static inline void insb(u16 port, void *addr, unsigned long count)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"cld ; rep ; insb "
|
||||
|
|
@ -99,7 +99,7 @@ static inline void insb(uint16_t port, void *addr, unsigned long count)
|
|||
);
|
||||
}
|
||||
|
||||
static inline void insw(uint16_t port, void *addr, unsigned long count)
|
||||
static inline void insw(u16 port, void *addr, unsigned long count)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"cld ; rep ; insw "
|
||||
|
|
@ -108,7 +108,7 @@ static inline void insw(uint16_t port, void *addr, unsigned long count)
|
|||
);
|
||||
}
|
||||
|
||||
static inline void insl(uint16_t port, void *addr, unsigned long count)
|
||||
static inline void insl(u16 port, void *addr, unsigned long count)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"cld ; rep ; insl "
|
||||
|
|
@ -117,34 +117,34 @@ static inline void insl(uint16_t port, void *addr, unsigned long count)
|
|||
);
|
||||
}
|
||||
|
||||
static inline void writeb(uint8_t b, volatile void *addr)
|
||||
static inline void writeb(u8 b, volatile void *addr)
|
||||
{
|
||||
*(volatile uint8_t *) addr = b;
|
||||
*(volatile u8 *) addr = b;
|
||||
}
|
||||
|
||||
static inline void writew(uint16_t b, volatile void *addr)
|
||||
static inline void writew(u16 b, volatile void *addr)
|
||||
{
|
||||
*(volatile uint16_t *) addr = b;
|
||||
*(volatile u16 *) addr = b;
|
||||
}
|
||||
|
||||
static inline void writel(uint32_t b, volatile void *addr)
|
||||
static inline void writel(u32 b, volatile void *addr)
|
||||
{
|
||||
*(volatile uint32_t *) addr = b;
|
||||
*(volatile u32 *) addr = b;
|
||||
}
|
||||
|
||||
static inline uint8_t readb(const volatile void *addr)
|
||||
static inline u8 readb(const volatile void *addr)
|
||||
{
|
||||
return *(volatile uint8_t *) addr;
|
||||
return *(volatile u8 *) addr;
|
||||
}
|
||||
|
||||
static inline uint16_t readw(const volatile void *addr)
|
||||
static inline u16 readw(const volatile void *addr)
|
||||
{
|
||||
return *(volatile uint16_t *) addr;
|
||||
return *(volatile u16 *) addr;
|
||||
}
|
||||
|
||||
static inline uint32_t readl(const volatile void *addr)
|
||||
static inline u32 readl(const volatile void *addr)
|
||||
{
|
||||
return *(volatile uint32_t *) addr;
|
||||
return *(volatile u32 *) addr;
|
||||
}
|
||||
|
||||
#endif
|
||||
49
lib/Kconfig
Normal file
49
lib/Kconfig
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#
|
||||
#
|
||||
#
|
||||
|
||||
menu "Compression methods"
|
||||
|
||||
config COMPRESSION_LZMA
|
||||
boolean "Support LZMA compression"
|
||||
default y
|
||||
---help---
|
||||
This is the preferred compression method, as LZMA
|
||||
reaches very good compression rates with a small footprint
|
||||
|
||||
config COMPRESSION_NRV2B
|
||||
boolean "Support NRV2B compression"
|
||||
---help---
|
||||
This compression method has a smaller memory footprint than
|
||||
LZMA but also significantly worse results.
|
||||
|
||||
choice
|
||||
prompt "Default compression method"
|
||||
default DEFAULT_COMPRESSION_LZMA
|
||||
|
||||
config DEFAULT_COMPRESSION_LZMA
|
||||
bool "LZMA compression"
|
||||
depends COMPRESSION_LZMA
|
||||
---help---
|
||||
Choose this option as a default
|
||||
|
||||
config DEFAULT_COMPRESSION_NRV2B
|
||||
bool "NRV2B compression"
|
||||
depends COMPRESSION_NRV2B
|
||||
---help---
|
||||
Choose this option if you have a too large flash chip
|
||||
|
||||
config DEFAULT_COMPRESSION_NONE
|
||||
bool "no compression"
|
||||
---help---
|
||||
Do not compress any LinuxBIOS modules per default
|
||||
|
||||
endchoice
|
||||
|
||||
|
||||
endmenu
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
23
lib/Makefile
Normal file
23
lib/Makefile
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
##
|
||||
## This file is part of the LinuxBIOS project.
|
||||
##
|
||||
## Copyright (C) 2006 coresystems GmbH
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
##
|
||||
|
||||
compressors-$(CONFIG_COMPRESSION_LZMA) += lzma.o
|
||||
compressors-$(CONFIG_COMPRESSION_NRV2B) += nrv2b.o
|
||||
|
||||
39
lib/lzma.c
Normal file
39
lib/lzma.c
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
|
||||
LinuxBIOS interface to memory-saving variant of LZMA decoder
|
||||
(C)opyright 2006 Carl-Daniel Hailfinger
|
||||
Released under the GNU GPL
|
||||
|
||||
*/
|
||||
|
||||
#include "lzmadecode.c"
|
||||
|
||||
|
||||
static unsigned long ulzma(unsigned char * src, unsigned char * dst)
|
||||
{
|
||||
unsigned char properties[LZMA_PROPERTIES_SIZE];
|
||||
UInt32 outSize;
|
||||
SizeT inProcessed;
|
||||
SizeT outProcessed;
|
||||
int res;
|
||||
CLzmaDecoderState state;
|
||||
SizeT mallocneeds;
|
||||
unsigned char scratchpad[15980];
|
||||
|
||||
memcpy(properties, src, LZMA_PROPERTIES_SIZE);
|
||||
outSize = *(UInt32 *)(src + LZMA_PROPERTIES_SIZE);
|
||||
if (LzmaDecodeProperties(&state.Properties, properties, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK) {
|
||||
printk_warning("Incorrect stream properties\n");
|
||||
}
|
||||
mallocneeds = (LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
|
||||
if (mallocneeds > 15980) {
|
||||
printk_warning("Decoder scratchpad too small!\n");
|
||||
}
|
||||
state.Probs = (CProb *)scratchpad;
|
||||
res = LzmaDecode(&state, src + LZMA_PROPERTIES_SIZE + 8, (SizeT)0xffffffff, &inProcessed,
|
||||
dst, outSize, &outProcessed);
|
||||
if (res != 0) {
|
||||
printk_warning("Decoding error = %d\n", res);
|
||||
}
|
||||
return outSize;
|
||||
}
|
||||
398
lib/lzmadecode.c
Normal file
398
lib/lzmadecode.c
Normal file
|
|
@ -0,0 +1,398 @@
|
|||
/*
|
||||
LzmaDecode.c
|
||||
LZMA Decoder (optimized for Speed version)
|
||||
|
||||
LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
|
||||
http://www.7-zip.org/
|
||||
|
||||
LZMA SDK is licensed under two licenses:
|
||||
1) GNU Lesser General Public License (GNU LGPL)
|
||||
2) Common Public License (CPL)
|
||||
It means that you can select one of these two licenses and
|
||||
follow rules of that license.
|
||||
|
||||
SPECIAL EXCEPTION:
|
||||
Igor Pavlov, as the author of this Code, expressly permits you to
|
||||
statically or dynamically link your Code (or bind by name) to the
|
||||
interfaces of this file without subjecting your linked Code to the
|
||||
terms of the CPL or GNU LGPL. Any modifications or additions
|
||||
to this file, however, are subject to the LGPL or CPL terms.
|
||||
*/
|
||||
|
||||
#include "lzmadecode.h"
|
||||
|
||||
#define kNumTopBits 24
|
||||
#define kTopValue ((UInt32)1 << kNumTopBits)
|
||||
|
||||
#define kNumBitModelTotalBits 11
|
||||
#define kBitModelTotal (1 << kNumBitModelTotalBits)
|
||||
#define kNumMoveBits 5
|
||||
|
||||
#define RC_READ_BYTE (*Buffer++)
|
||||
|
||||
#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
|
||||
{ int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }}
|
||||
|
||||
|
||||
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
|
||||
|
||||
#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
|
||||
|
||||
|
||||
#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
|
||||
|
||||
#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound)
|
||||
#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits;
|
||||
#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits;
|
||||
|
||||
#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
|
||||
{ UpdateBit0(p); mi <<= 1; A0; } else \
|
||||
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
|
||||
|
||||
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
|
||||
|
||||
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
|
||||
{ int i = numLevels; res = 1; \
|
||||
do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \
|
||||
res -= (1 << numLevels); }
|
||||
|
||||
|
||||
#define kNumPosBitsMax 4
|
||||
#define kNumPosStatesMax (1 << kNumPosBitsMax)
|
||||
|
||||
#define kLenNumLowBits 3
|
||||
#define kLenNumLowSymbols (1 << kLenNumLowBits)
|
||||
#define kLenNumMidBits 3
|
||||
#define kLenNumMidSymbols (1 << kLenNumMidBits)
|
||||
#define kLenNumHighBits 8
|
||||
#define kLenNumHighSymbols (1 << kLenNumHighBits)
|
||||
|
||||
#define LenChoice 0
|
||||
#define LenChoice2 (LenChoice + 1)
|
||||
#define LenLow (LenChoice2 + 1)
|
||||
#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
|
||||
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
|
||||
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
|
||||
|
||||
|
||||
#define kNumStates 12
|
||||
#define kNumLitStates 7
|
||||
|
||||
#define kStartPosModelIndex 4
|
||||
#define kEndPosModelIndex 14
|
||||
#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
|
||||
|
||||
#define kNumPosSlotBits 6
|
||||
#define kNumLenToPosStates 4
|
||||
|
||||
#define kNumAlignBits 4
|
||||
#define kAlignTableSize (1 << kNumAlignBits)
|
||||
|
||||
#define kMatchMinLen 2
|
||||
|
||||
#define IsMatch 0
|
||||
#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
|
||||
#define IsRepG0 (IsRep + kNumStates)
|
||||
#define IsRepG1 (IsRepG0 + kNumStates)
|
||||
#define IsRepG2 (IsRepG1 + kNumStates)
|
||||
#define IsRep0Long (IsRepG2 + kNumStates)
|
||||
#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
|
||||
#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
|
||||
#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
|
||||
#define LenCoder (Align + kAlignTableSize)
|
||||
#define RepLenCoder (LenCoder + kNumLenProbs)
|
||||
#define Literal (RepLenCoder + kNumLenProbs)
|
||||
|
||||
#if Literal != LZMA_BASE_SIZE
|
||||
StopCompilingDueBUG
|
||||
#endif
|
||||
|
||||
int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size)
|
||||
{
|
||||
unsigned char prop0;
|
||||
if (size < LZMA_PROPERTIES_SIZE)
|
||||
return LZMA_RESULT_DATA_ERROR;
|
||||
prop0 = propsData[0];
|
||||
if (prop0 >= (9 * 5 * 5))
|
||||
return LZMA_RESULT_DATA_ERROR;
|
||||
{
|
||||
for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5));
|
||||
for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9);
|
||||
propsRes->lc = prop0;
|
||||
/*
|
||||
unsigned char remainder = (unsigned char)(prop0 / 9);
|
||||
propsRes->lc = prop0 % 9;
|
||||
propsRes->pb = remainder / 5;
|
||||
propsRes->lp = remainder % 5;
|
||||
*/
|
||||
}
|
||||
|
||||
return LZMA_RESULT_OK;
|
||||
}
|
||||
|
||||
#define kLzmaStreamWasFinishedId (-1)
|
||||
|
||||
int LzmaDecode(CLzmaDecoderState *vs,
|
||||
const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
|
||||
unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed)
|
||||
{
|
||||
CProb *p = vs->Probs;
|
||||
SizeT nowPos = 0;
|
||||
Byte previousByte = 0;
|
||||
UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1;
|
||||
UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1;
|
||||
int lc = vs->Properties.lc;
|
||||
|
||||
|
||||
int state = 0;
|
||||
UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
|
||||
int len = 0;
|
||||
const Byte *Buffer;
|
||||
const Byte *BufferLim;
|
||||
UInt32 Range;
|
||||
UInt32 Code;
|
||||
|
||||
*inSizeProcessed = 0;
|
||||
*outSizeProcessed = 0;
|
||||
|
||||
{
|
||||
UInt32 i;
|
||||
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
|
||||
for (i = 0; i < numProbs; i++)
|
||||
p[i] = kBitModelTotal >> 1;
|
||||
}
|
||||
|
||||
RC_INIT(inStream, inSize);
|
||||
|
||||
|
||||
while(nowPos < outSize)
|
||||
{
|
||||
CProb *prob;
|
||||
UInt32 bound;
|
||||
int posState = (int)(
|
||||
(nowPos
|
||||
)
|
||||
& posStateMask);
|
||||
|
||||
prob = p + IsMatch + (state << kNumPosBitsMax) + posState;
|
||||
IfBit0(prob)
|
||||
{
|
||||
int symbol = 1;
|
||||
UpdateBit0(prob)
|
||||
prob = p + Literal + (LZMA_LIT_SIZE *
|
||||
(((
|
||||
(nowPos
|
||||
)
|
||||
& literalPosMask) << lc) + (previousByte >> (8 - lc))));
|
||||
|
||||
if (state >= kNumLitStates)
|
||||
{
|
||||
int matchByte;
|
||||
matchByte = outStream[nowPos - rep0];
|
||||
do
|
||||
{
|
||||
int bit;
|
||||
CProb *probLit;
|
||||
matchByte <<= 1;
|
||||
bit = (matchByte & 0x100);
|
||||
probLit = prob + 0x100 + bit + symbol;
|
||||
RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break)
|
||||
}
|
||||
while (symbol < 0x100);
|
||||
}
|
||||
while (symbol < 0x100)
|
||||
{
|
||||
CProb *probLit = prob + symbol;
|
||||
RC_GET_BIT(probLit, symbol)
|
||||
}
|
||||
previousByte = (Byte)symbol;
|
||||
|
||||
outStream[nowPos++] = previousByte;
|
||||
if (state < 4) state = 0;
|
||||
else if (state < 10) state -= 3;
|
||||
else state -= 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBit1(prob);
|
||||
prob = p + IsRep + state;
|
||||
IfBit0(prob)
|
||||
{
|
||||
UpdateBit0(prob);
|
||||
rep3 = rep2;
|
||||
rep2 = rep1;
|
||||
rep1 = rep0;
|
||||
state = state < kNumLitStates ? 0 : 3;
|
||||
prob = p + LenCoder;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBit1(prob);
|
||||
prob = p + IsRepG0 + state;
|
||||
IfBit0(prob)
|
||||
{
|
||||
UpdateBit0(prob);
|
||||
prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState;
|
||||
IfBit0(prob)
|
||||
{
|
||||
UpdateBit0(prob);
|
||||
|
||||
if (nowPos == 0)
|
||||
return LZMA_RESULT_DATA_ERROR;
|
||||
|
||||
state = state < kNumLitStates ? 9 : 11;
|
||||
previousByte = outStream[nowPos - rep0];
|
||||
outStream[nowPos++] = previousByte;
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBit1(prob);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32 distance;
|
||||
UpdateBit1(prob);
|
||||
prob = p + IsRepG1 + state;
|
||||
IfBit0(prob)
|
||||
{
|
||||
UpdateBit0(prob);
|
||||
distance = rep1;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBit1(prob);
|
||||
prob = p + IsRepG2 + state;
|
||||
IfBit0(prob)
|
||||
{
|
||||
UpdateBit0(prob);
|
||||
distance = rep2;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBit1(prob);
|
||||
distance = rep3;
|
||||
rep3 = rep2;
|
||||
}
|
||||
rep2 = rep1;
|
||||
}
|
||||
rep1 = rep0;
|
||||
rep0 = distance;
|
||||
}
|
||||
state = state < kNumLitStates ? 8 : 11;
|
||||
prob = p + RepLenCoder;
|
||||
}
|
||||
{
|
||||
int numBits, offset;
|
||||
CProb *probLen = prob + LenChoice;
|
||||
IfBit0(probLen)
|
||||
{
|
||||
UpdateBit0(probLen);
|
||||
probLen = prob + LenLow + (posState << kLenNumLowBits);
|
||||
offset = 0;
|
||||
numBits = kLenNumLowBits;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBit1(probLen);
|
||||
probLen = prob + LenChoice2;
|
||||
IfBit0(probLen)
|
||||
{
|
||||
UpdateBit0(probLen);
|
||||
probLen = prob + LenMid + (posState << kLenNumMidBits);
|
||||
offset = kLenNumLowSymbols;
|
||||
numBits = kLenNumMidBits;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBit1(probLen);
|
||||
probLen = prob + LenHigh;
|
||||
offset = kLenNumLowSymbols + kLenNumMidSymbols;
|
||||
numBits = kLenNumHighBits;
|
||||
}
|
||||
}
|
||||
RangeDecoderBitTreeDecode(probLen, numBits, len);
|
||||
len += offset;
|
||||
}
|
||||
|
||||
if (state < 4)
|
||||
{
|
||||
int posSlot;
|
||||
state += kNumLitStates;
|
||||
prob = p + PosSlot +
|
||||
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
|
||||
kNumPosSlotBits);
|
||||
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
|
||||
if (posSlot >= kStartPosModelIndex)
|
||||
{
|
||||
int numDirectBits = ((posSlot >> 1) - 1);
|
||||
rep0 = (2 | ((UInt32)posSlot & 1));
|
||||
if (posSlot < kEndPosModelIndex)
|
||||
{
|
||||
rep0 <<= numDirectBits;
|
||||
prob = p + SpecPos + rep0 - posSlot - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
numDirectBits -= kNumAlignBits;
|
||||
do
|
||||
{
|
||||
RC_NORMALIZE
|
||||
Range >>= 1;
|
||||
rep0 <<= 1;
|
||||
if (Code >= Range)
|
||||
{
|
||||
Code -= Range;
|
||||
rep0 |= 1;
|
||||
}
|
||||
}
|
||||
while (--numDirectBits != 0);
|
||||
prob = p + Align;
|
||||
rep0 <<= kNumAlignBits;
|
||||
numDirectBits = kNumAlignBits;
|
||||
}
|
||||
{
|
||||
int i = 1;
|
||||
int mi = 1;
|
||||
do
|
||||
{
|
||||
CProb *prob3 = prob + mi;
|
||||
RC_GET_BIT2(prob3, mi, ; , rep0 |= i);
|
||||
i <<= 1;
|
||||
}
|
||||
while(--numDirectBits != 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
rep0 = posSlot;
|
||||
if (++rep0 == (UInt32)(0))
|
||||
{
|
||||
/* it's for stream version */
|
||||
len = kLzmaStreamWasFinishedId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
len += kMatchMinLen;
|
||||
if (rep0 > nowPos)
|
||||
return LZMA_RESULT_DATA_ERROR;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
previousByte = outStream[nowPos - rep0];
|
||||
len--;
|
||||
outStream[nowPos++] = previousByte;
|
||||
}
|
||||
while(len != 0 && nowPos < outSize);
|
||||
}
|
||||
}
|
||||
RC_NORMALIZE;
|
||||
|
||||
|
||||
*inSizeProcessed = (SizeT)(Buffer - inStream);
|
||||
*outSizeProcessed = nowPos;
|
||||
return LZMA_RESULT_OK;
|
||||
}
|
||||
67
lib/lzmadecode.h
Normal file
67
lib/lzmadecode.h
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
LzmaDecode.h
|
||||
LZMA Decoder interface
|
||||
|
||||
LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
|
||||
http://www.7-zip.org/
|
||||
|
||||
LZMA SDK is licensed under two licenses:
|
||||
1) GNU Lesser General Public License (GNU LGPL)
|
||||
2) Common Public License (CPL)
|
||||
It means that you can select one of these two licenses and
|
||||
follow rules of that license.
|
||||
|
||||
SPECIAL EXCEPTION:
|
||||
Igor Pavlov, as the author of this code, expressly permits you to
|
||||
statically or dynamically link your code (or bind by name) to the
|
||||
interfaces of this file without subjecting your linked code to the
|
||||
terms of the CPL or GNU LGPL. Any modifications or additions
|
||||
to this file, however, are subject to the LGPL or CPL terms.
|
||||
*/
|
||||
|
||||
#ifndef __LZMADECODE_H
|
||||
#define __LZMADECODE_H
|
||||
|
||||
typedef unsigned char Byte;
|
||||
typedef unsigned short UInt16;
|
||||
typedef unsigned int UInt32;
|
||||
typedef UInt32 SizeT;
|
||||
|
||||
#define CProb UInt16
|
||||
|
||||
#define LZMA_RESULT_OK 0
|
||||
#define LZMA_RESULT_DATA_ERROR 1
|
||||
|
||||
|
||||
#define LZMA_BASE_SIZE 1846
|
||||
#define LZMA_LIT_SIZE 768
|
||||
|
||||
#define LZMA_PROPERTIES_SIZE 5
|
||||
|
||||
typedef struct _CLzmaProperties
|
||||
{
|
||||
int lc;
|
||||
int lp;
|
||||
int pb;
|
||||
}CLzmaProperties;
|
||||
|
||||
int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
|
||||
|
||||
#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp)))
|
||||
|
||||
#define kLzmaNeedInitId (-2)
|
||||
|
||||
typedef struct _CLzmaDecoderState
|
||||
{
|
||||
CLzmaProperties Properties;
|
||||
CProb *Probs;
|
||||
|
||||
|
||||
} CLzmaDecoderState;
|
||||
|
||||
|
||||
int LzmaDecode(CLzmaDecoderState *vs,
|
||||
const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
|
||||
unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed);
|
||||
|
||||
#endif
|
||||
84
lib/nrv2b.c
Normal file
84
lib/nrv2b.c
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
// This GETBIT is supposed to work on little endian
|
||||
// 32bit systems. The algorithm will definitely need
|
||||
// some fixing on other systems, but it might not be
|
||||
// a problem since the nrv2b binary behaves the same..
|
||||
|
||||
#ifndef ENDIAN
|
||||
#define ENDIAN 0
|
||||
#endif
|
||||
#ifndef BITSIZE
|
||||
#define BITSIZE 32
|
||||
#endif
|
||||
|
||||
#define GETBIT_8(bb, src, ilen) \
|
||||
(((bb = bb & 0x7f ? bb*2 : ((unsigned)src[ilen++]*2+1)) >> 8) & 1)
|
||||
|
||||
#define GETBIT_LE16(bb, src, ilen) \
|
||||
(bb*=2,bb&0xffff ? (bb>>16)&1 : (ilen+=2,((bb=(src[ilen-2]+src[ilen-1]*256u)*2+1)>>16)&1))
|
||||
#define GETBIT_LE32(bb, src, ilen) \
|
||||
(bc > 0 ? ((bb>>--bc)&1) : (bc=31,\
|
||||
bb=*(const uint32_t *)((src)+ilen),ilen+=4,(bb>>31)&1))
|
||||
|
||||
#if ENDIAN == 0 && BITSIZE == 8
|
||||
#define GETBIT(bb, src, ilen) GETBIT_8(bb, src, ilen)
|
||||
#endif
|
||||
#if ENDIAN == 0 && BITSIZE == 16
|
||||
#define GETBIT(bb, src, ilen) GETBIT_LE16(bb, src, ilen)
|
||||
#endif
|
||||
#if ENDIAN == 0 && BITSIZE == 32
|
||||
#define GETBIT(bb, src, ilen) GETBIT_LE32(bb, src, ilen)
|
||||
#endif
|
||||
static unsigned long unrv2b(uint8_t * src, uint8_t * dst, unsigned long *ilen_p)
|
||||
{
|
||||
unsigned long ilen = 0, olen = 0, last_m_off = 1;
|
||||
uint32_t bb = 0;
|
||||
unsigned bc = 0;
|
||||
const uint8_t *m_pos;
|
||||
|
||||
// skip length
|
||||
src += 4;
|
||||
/* FIXME: check olen with the length stored in first 4 bytes */
|
||||
|
||||
for (;;) {
|
||||
unsigned int m_off, m_len;
|
||||
while (GETBIT(bb, src, ilen)) {
|
||||
dst[olen++] = src[ilen++];
|
||||
}
|
||||
|
||||
m_off = 1;
|
||||
do {
|
||||
m_off = m_off * 2 + GETBIT(bb, src, ilen);
|
||||
} while (!GETBIT(bb, src, ilen));
|
||||
if (m_off == 2) {
|
||||
m_off = last_m_off;
|
||||
} else {
|
||||
m_off = (m_off - 3) * 256 + src[ilen++];
|
||||
if (m_off == 0xffffffffU)
|
||||
break;
|
||||
last_m_off = ++m_off;
|
||||
}
|
||||
|
||||
m_len = GETBIT(bb, src, ilen);
|
||||
m_len = m_len * 2 + GETBIT(bb, src, ilen);
|
||||
if (m_len == 0) {
|
||||
m_len++;
|
||||
do {
|
||||
m_len = m_len * 2 + GETBIT(bb, src, ilen);
|
||||
} while (!GETBIT(bb, src, ilen));
|
||||
m_len += 2;
|
||||
}
|
||||
m_len += (m_off > 0xd00);
|
||||
|
||||
m_pos = dst + olen - m_off;
|
||||
dst[olen++] = *m_pos++;
|
||||
do {
|
||||
dst[olen++] = *m_pos++;
|
||||
} while (--m_len > 0);
|
||||
}
|
||||
|
||||
*ilen_p = ilen;
|
||||
|
||||
return olen;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -19,3 +19,6 @@ config EMULATION_C64
|
|||
bla bla bla
|
||||
|
||||
endchoice
|
||||
|
||||
source "mainboard/emulation/qemu-i386/Kconfig"
|
||||
|
||||
|
|
|
|||
7
mainboard/emulation/qemu-i386/Kconfig
Normal file
7
mainboard/emulation/qemu-i386/Kconfig
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
config CONFIG_MAINBOARD_NAME
|
||||
string
|
||||
default 'emulation/qemu-i386'
|
||||
depends BOARD_EMULATION_QEMU_X86
|
||||
help
|
||||
This is the default mainboard name.
|
||||
|
||||
|
|
@ -2,15 +2,29 @@
|
|||
# Makefile for this mainboard
|
||||
#
|
||||
|
||||
obj-y = mainboard.o setup_before_car.o
|
||||
|
||||
$(obj)/mainboard.o: $(obj)/dtc.h
|
||||
#obj-y = mainboard.o setup_before_car.o
|
||||
obj-y = setup_before_car.o
|
||||
#lib-y = linuxbios.vpd
|
||||
|
||||
$(obj)/dtc.h: $(src)/dts $(obj)/dtc
|
||||
$(obj)/dtc -O lb $(src)/dts >$(obj)/dtc.h
|
||||
#$(obj)/mainboard.o: $(obj)/dtc.h
|
||||
#
|
||||
#$(obj)/dtc.h: $(src)/dts $(obj)/dtc
|
||||
# $(obj)/dtc -O lb $(src)/dts >$(obj)/dtc.h
|
||||
|
||||
|
||||
## this does not belong in this file.
|
||||
#$(obj)/dtc:
|
||||
# $(MAKE) -C $(srctree)/util/dtc/
|
||||
# cp $(srctree)/util/dtc/dtc $(obj)
|
||||
|
||||
#
|
||||
# This is duplicate in arch/x86/ where it does not belong.
|
||||
# How can we cross reference?
|
||||
#
|
||||
linuxbios.vpd:
|
||||
$(Q)printf "Building dummy VPD ..."
|
||||
$(Q)dd if=/dev/zero of=$(objtree)/linuxbios.vpd bs=$(( 0xf0 )) count=1
|
||||
$(Q)printf "ok.\n"
|
||||
|
||||
|
||||
# this does not belong in this file.
|
||||
$(obj)/dtc:
|
||||
$(MAKE) -C $(srctree)/util/dtc/
|
||||
cp $(srctree)/util/dtc/dtc $(obj)/
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <arch/types.h>
|
||||
#include <device/pci_def.h>
|
||||
#include <device/pci_ids.h>
|
||||
#include <arch/io.h>
|
||||
|
|
@ -33,6 +33,6 @@ void setup_before_car(void)
|
|||
{
|
||||
outb(5, 0x80);
|
||||
|
||||
uart_init();
|
||||
console_init();
|
||||
//uart_init();
|
||||
//console_init();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ define filechk
|
|||
endef
|
||||
|
||||
######
|
||||
# gcc support functions
|
||||
# cc support functions to be used (only) in arch/$(ARCH)/Makefile
|
||||
# See documentation in Documentation/kbuild/makefiles.txt
|
||||
|
||||
# as-option
|
||||
|
|
@ -87,13 +87,9 @@ cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \
|
|||
# $(Q)$(MAKE) $(build)=dir
|
||||
build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
|
||||
|
||||
# Prefix -I with $(srctree) if it is not an absolute path
|
||||
addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)
|
||||
# Find all -I options and call addtree
|
||||
flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
|
||||
|
||||
# If quiet is set, only print short version of command
|
||||
cmd = @$(echo-cmd) $(cmd_$(1))
|
||||
cmd = @$(if $($(quiet)cmd_$(1)),\
|
||||
echo ' $(call escsq,$($(quiet)cmd_$(1)))' &&) $(cmd_$(1))
|
||||
|
||||
# Add $(obj)/ for paths that is not absolute
|
||||
objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
|
||||
|
|
@ -116,33 +112,30 @@ endif
|
|||
echo-cmd = $(if $($(quiet)cmd_$(1)), \
|
||||
echo ' $(call escsq,$($(quiet)cmd_$(1)))';)
|
||||
|
||||
make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))))
|
||||
|
||||
# function to only execute the passed command if necessary
|
||||
# >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file
|
||||
# note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars
|
||||
#
|
||||
if_changed = $(if $(strip $(filter-out $(PHONY),$?) \
|
||||
$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
|
||||
#
|
||||
if_changed = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
|
||||
@set -e; \
|
||||
$(echo-cmd) $(cmd_$(1)); \
|
||||
echo 'cmd_$@ := $(make-cmd)' > $(@D)/.$(@F).cmd)
|
||||
$(echo-cmd) \
|
||||
$(cmd_$(1)); \
|
||||
echo 'cmd_$@ := $(subst $$,$$$$,$(call escsq,$(cmd_$(1))))' > $(@D)/.$(@F).cmd)
|
||||
|
||||
# execute the command and also postprocess generated .d dependencies
|
||||
# file
|
||||
if_changed_dep = $(if $(strip $(filter-out $(PHONY),$?) \
|
||||
$(filter-out FORCE $(wildcard $^),$^) \
|
||||
$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
|
||||
if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
|
||||
$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
|
||||
@set -e; \
|
||||
$(echo-cmd) $(cmd_$(1)); \
|
||||
scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(@D)/.$(@F).tmp; \
|
||||
$(echo-cmd) \
|
||||
$(cmd_$(1)); \
|
||||
scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \
|
||||
rm -f $(depfile); \
|
||||
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
|
||||
|
||||
# Usage: $(call if_changed_rule,foo)
|
||||
# will check if $(cmd_foo) changed, or any of the prequisites changed,
|
||||
# and if so will execute $(rule_foo)
|
||||
if_changed_rule = $(if $(strip $(filter-out $(PHONY),$?) \
|
||||
$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\
|
||||
if_changed_rule = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\
|
||||
@set -e; \
|
||||
$(rule_$(1)))
|
||||
|
|
|
|||
7
scripts/Makefile
Normal file
7
scripts/Makefile
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
###
|
||||
# scripts contains sources for various helper programs used throughout
|
||||
# the kernel for the build process.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Let clean descend into subdirs
|
||||
subdir- += basic kconfig package
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
src := $(obj)
|
||||
|
||||
PHONY := __build
|
||||
.PHONY: __build
|
||||
__build:
|
||||
|
||||
# Read .config if it exist, otherwise ignore
|
||||
|
|
@ -30,7 +30,7 @@ ifneq ($(hostprogs-y)$(hostprogs-m),)
|
|||
include scripts/Makefile.host
|
||||
endif
|
||||
|
||||
ifneq ($(LBBUILD_SRC),)
|
||||
ifneq ($(KBUILD_SRC),)
|
||||
# Create output directory if not already present
|
||||
_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
|
||||
|
||||
|
|
@ -39,6 +39,7 @@ _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
|
|||
_dummy := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || mkdir -p $(d)))
|
||||
endif
|
||||
|
||||
|
||||
ifndef obj
|
||||
$(warning kbuild: Makefile.build is included improperly)
|
||||
endif
|
||||
|
|
@ -53,15 +54,16 @@ ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(lib-target)),)
|
|||
builtin-target := $(obj)/built-in.o
|
||||
endif
|
||||
|
||||
# We keep a list of all modules in $(MODVERDIR)
|
||||
|
||||
__build: $(builtin-target) $(lib-target) $(extra-y) \
|
||||
$(subdir-ym) $(always)
|
||||
@:
|
||||
|
||||
__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \
|
||||
$(if $(KBUILD_MODULES),$(obj-m)) \
|
||||
$(subdir-ym) $(always)
|
||||
@:
|
||||
|
||||
# Linus' kernel sanity checking tool
|
||||
ifneq ($(LBBUILD_CHECKSRC),0)
|
||||
ifeq ($(LBBUILD_CHECKSRC),2)
|
||||
ifneq ($(KBUILD_CHECKSRC),0)
|
||||
ifeq ($(KBUILD_CHECKSRC),2)
|
||||
quiet_cmd_force_checksrc = CHECK $<
|
||||
cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ;
|
||||
else
|
||||
|
|
@ -75,8 +77,35 @@ endif
|
|||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Default is built-in, unless we know otherwise
|
||||
modkern_cflags := $(CFLAGS_KERNEL)
|
||||
quiet_modtag := $(empty) $(empty)
|
||||
|
||||
cmd_cc_s_c = $(CC) $(c_flags) -fverbose-asm -S -o $@ $<
|
||||
$(real-objs-m) : modkern_cflags := $(CFLAGS_MODULE)
|
||||
$(real-objs-m:.o=.i) : modkern_cflags := $(CFLAGS_MODULE)
|
||||
$(real-objs-m:.o=.s) : modkern_cflags := $(CFLAGS_MODULE)
|
||||
$(real-objs-m:.o=.lst): modkern_cflags := $(CFLAGS_MODULE)
|
||||
|
||||
$(real-objs-m) : quiet_modtag := [M]
|
||||
$(real-objs-m:.o=.i) : quiet_modtag := [M]
|
||||
$(real-objs-m:.o=.s) : quiet_modtag := [M]
|
||||
$(real-objs-m:.o=.lst): quiet_modtag := [M]
|
||||
|
||||
$(obj-m) : quiet_modtag := [M]
|
||||
|
||||
# Default for not multi-part modules
|
||||
modname = $(*F)
|
||||
|
||||
$(multi-objs-m) : modname = $(modname-multi)
|
||||
$(multi-objs-m:.o=.i) : modname = $(modname-multi)
|
||||
$(multi-objs-m:.o=.s) : modname = $(modname-multi)
|
||||
$(multi-objs-m:.o=.lst) : modname = $(modname-multi)
|
||||
$(multi-objs-y) : modname = $(modname-multi)
|
||||
$(multi-objs-y:.o=.i) : modname = $(modname-multi)
|
||||
$(multi-objs-y:.o=.s) : modname = $(modname-multi)
|
||||
$(multi-objs-y:.o=.lst) : modname = $(modname-multi)
|
||||
|
||||
quiet_cmd_cc_s_c = CC $(quiet_modtag) $@
|
||||
cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $<
|
||||
|
||||
%.s: %.c FORCE
|
||||
$(call if_changed_dep,cc_s_c)
|
||||
|
|
@ -87,18 +116,60 @@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
|
|||
%.i: %.c FORCE
|
||||
$(call if_changed_dep,cc_i_c)
|
||||
|
||||
quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
|
||||
cmd_cc_symtypes_c = \
|
||||
$(CPP) -D__GENKSYMS__ $(c_flags) $< \
|
||||
| $(GENKSYMS) -T $@ >/dev/null; \
|
||||
test -s $@ || rm -f $@
|
||||
|
||||
%.symtypes : %.c FORCE
|
||||
$(call if_changed_dep,cc_symtypes_c)
|
||||
|
||||
# C (.c) files
|
||||
# The C file is compiled and updated dependency information is generated.
|
||||
# (See cmd_cc_o_c + relevant part of rule_cc_o_c)
|
||||
|
||||
quiet_cmd_cc_o_c = CC $(quiet_modtag) $@
|
||||
|
||||
ifndef CONFIG_MODVERSIONS
|
||||
cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
|
||||
|
||||
else
|
||||
# When module versioning is enabled the following steps are executed:
|
||||
# o compile a .tmp_<file>.o from <file>.c
|
||||
# o if .tmp_<file>.o doesn't contain a __ksymtab version, i.e. does
|
||||
# not export symbols, we just rename .tmp_<file>.o to <file>.o and
|
||||
# are done.
|
||||
# o otherwise, we calculate symbol versions using the good old
|
||||
# genksyms on the preprocessed source and postprocess them in a way
|
||||
# that they are usable as a linker script
|
||||
# o generate <file>.o from .tmp_<file>.o using the linker to
|
||||
# replace the unresolved symbols __crc_exported_symbol with
|
||||
# the actual value of the checksum generated by genksyms
|
||||
|
||||
cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $<
|
||||
cmd_modversions = \
|
||||
if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \
|
||||
$(CPP) -D__GENKSYMS__ $(c_flags) $< \
|
||||
| $(GENKSYMS) $(if $(KBUILD_SYMTYPES), \
|
||||
-T $(@D)/$(@F:.o=.symtypes)) \
|
||||
> $(@D)/.tmp_$(@F:.o=.ver); \
|
||||
\
|
||||
$(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
|
||||
-T $(@D)/.tmp_$(@F:.o=.ver); \
|
||||
rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
|
||||
else \
|
||||
mv -f $(@D)/.tmp_$(@F) $@; \
|
||||
fi;
|
||||
endif
|
||||
|
||||
define rule_cc_o_c
|
||||
$(call echo-cmd,checksrc) $(cmd_checksrc) \
|
||||
$(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \
|
||||
scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > $(@D)/.$(@F).tmp; \
|
||||
$(if $($(quiet)cmd_checksrc),echo ' $($(quiet)cmd_checksrc)';) \
|
||||
$(cmd_checksrc) \
|
||||
$(if $($(quiet)cmd_cc_o_c),echo ' $(call escsq,$($(quiet)cmd_cc_o_c))';) \
|
||||
$(cmd_cc_o_c); \
|
||||
$(cmd_modversions) \
|
||||
scripts/basic/fixdep $(depfile) $@ '$(call escsq,$(cmd_cc_o_c))' > $(@D)/.$(@F).tmp; \
|
||||
rm -f $(depfile); \
|
||||
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd
|
||||
endef
|
||||
|
|
@ -127,6 +198,11 @@ quiet_cmd_cc_lst_c = MKLST $@
|
|||
# Compile assembler sources (.S)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
modkern_aflags := $(AFLAGS_KERNEL)
|
||||
|
||||
$(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE)
|
||||
$(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE)
|
||||
|
||||
quiet_cmd_as_s_S = CPP $(quiet_modtag) $@
|
||||
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
|
||||
|
||||
|
|
@ -220,14 +296,14 @@ targets += $(multi-used-y) $(multi-used-m)
|
|||
# Descending
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
PHONY += $(subdir-ym)
|
||||
.PHONY: $(subdir-ym)
|
||||
$(subdir-ym):
|
||||
$(Q)$(MAKE) $(build)=$@
|
||||
|
||||
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
PHONY += FORCE
|
||||
.PHONY: FORCE
|
||||
|
||||
FORCE:
|
||||
|
||||
|
|
@ -242,9 +318,3 @@ cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
|
|||
ifneq ($(cmd_files),)
|
||||
include $(cmd_files)
|
||||
endif
|
||||
|
||||
|
||||
# Declare the contents of the .PHONY variable as phony. We keep that
|
||||
# information in a variable se we can use it in if_changed and friends.
|
||||
|
||||
.PHONY: $(PHONY)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
src := $(obj)
|
||||
|
||||
PHONY := __clean
|
||||
.PHONY: __clean
|
||||
__clean:
|
||||
|
||||
# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir
|
||||
|
|
@ -87,16 +87,10 @@ endif
|
|||
# Descending
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
PHONY += $(subdir-ymn)
|
||||
.PHONY: $(subdir-ymn)
|
||||
$(subdir-ymn):
|
||||
$(Q)$(MAKE) $(clean)=$@
|
||||
|
||||
# If quiet is set, only print short version of command
|
||||
|
||||
cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
|
||||
|
||||
|
||||
# Declare the contents of the .PHONY variable as phony. We keep that
|
||||
# information in a variable se we can use it in if_changed and friends.
|
||||
|
||||
.PHONY: $(PHONY)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
# Backward compatibility - to be removed...
|
||||
extra-y += $(EXTRA_TARGETS)
|
||||
# Figure out what we need to build from the various variables
|
||||
# ===========================================================================
|
||||
|
||||
|
|
@ -98,6 +99,11 @@ __a_flags = $(_a_flags)
|
|||
__cpp_flags = $(_cpp_flags)
|
||||
else
|
||||
|
||||
# Prefix -I with $(srctree) if it is not an absolute path
|
||||
addtree = $(1) $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)))
|
||||
# Find all -I options and call addtree
|
||||
flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
|
||||
|
||||
# -I$(obj) locates generated .h files
|
||||
# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files
|
||||
# and locates generated .h files
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* tells make when to remake a file.
|
||||
*
|
||||
* To use this list as-is however has the drawback that virtually
|
||||
* every file in the kernel includes <linux/config.h> which then again
|
||||
* every file in the kernel includes <linuxbios/config.h> which then again
|
||||
* includes <linuxbios/autoconf.h>
|
||||
*
|
||||
* If the user re-runs make *config, linuxbios/autoconf.h will be
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
* cmd_<target> = <cmdline>
|
||||
*
|
||||
* and then basically copies the .<target>.d file to stdout, in the
|
||||
* process filtering out the dependency on linuxbios/autoconf.h and adding
|
||||
* process filtering out the dependency on linux/autoconf.h and adding
|
||||
* dependencies on include/config/my/option.h for every
|
||||
* CONFIG_MY_OPTION encountered in any of the prequisites.
|
||||
*
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
* Note 2: if somebody writes HELLO_CONFIG_BOOM in a file, it will depend onto
|
||||
* CONFIG_BOOM. This could seem a bug (not too hard to fix), but please do not
|
||||
* fix it! Some UserModeLinux files (look at arch/um/) call CONFIG_BOOM as
|
||||
* UML_CONFIG_BOOM, to avoid conflicts with /usr/include/linuxbios/autoconf.h,
|
||||
* UML_CONFIG_BOOM, to avoid conflicts with /usr/include/linux/autoconf.h,
|
||||
* through arch/um/include/uml-config.h; this fixdep "bug" makes sure that
|
||||
* those files will have correct dependencies.
|
||||
*/
|
||||
|
|
@ -132,10 +132,20 @@ void usage(void)
|
|||
|
||||
/*
|
||||
* Print out the commandline prefixed with cmd_<target filename> :=
|
||||
*/
|
||||
* If commandline contains '#' escape with '\' so make to not see
|
||||
* the '#' as a start-of-comment symbol
|
||||
**/
|
||||
void print_cmdline(void)
|
||||
{
|
||||
printf("cmd_%s := %s\n\n", target, cmdline);
|
||||
char *p = cmdline;
|
||||
|
||||
printf("cmd_%s := ", target);
|
||||
for (; *p; p++) {
|
||||
if (*p == '#')
|
||||
printf("\\");
|
||||
printf("%c", *p);
|
||||
}
|
||||
printf("\n\n");
|
||||
}
|
||||
|
||||
char * str_config = NULL;
|
||||
|
|
@ -321,7 +331,6 @@ void parse_dep_file(void *map, size_t len)
|
|||
}
|
||||
memcpy(s, m, p-m); s[p-m] = 0;
|
||||
if (strrcmp(s, "include/linuxbios/autoconf.h") &&
|
||||
strrcmp(s, "arch/um/include/uml-config.h") &&
|
||||
strrcmp(s, ".ver")) {
|
||||
printf(" %s \\\n", s);
|
||||
do_config_file(s);
|
||||
|
|
|
|||
17
scripts/kconfig/.gitignore
vendored
17
scripts/kconfig/.gitignore
vendored
|
|
@ -1,17 +0,0 @@
|
|||
#
|
||||
# Generated files
|
||||
#
|
||||
config*
|
||||
lex.*.c
|
||||
*.tab.c
|
||||
*.tab.h
|
||||
zconf.hash.c
|
||||
|
||||
#
|
||||
# configuration programs
|
||||
#
|
||||
conf
|
||||
mconf
|
||||
qconf
|
||||
gconf
|
||||
kxgettext
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
# Kernel configuration targets
|
||||
# These targets are used from top-level makefile
|
||||
|
||||
PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
|
||||
.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
|
||||
|
||||
xconfig: $(obj)/qconf
|
||||
$< Kconfig
|
||||
|
|
@ -28,10 +28,9 @@ update-po-config: $(obj)/kxgettext
|
|||
--add-comments --keyword=_ --keyword=N_ \
|
||||
--files-from=scripts/kconfig/POTFILES.in \
|
||||
--output scripts/kconfig/config.pot
|
||||
$(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch
|
||||
$(Q)for i in `ls arch/`; \
|
||||
do \
|
||||
scripts/kconfig/kxgettext arch/$$i/Kconfig \
|
||||
scripts/kconfig/kxgettext Kconfig \
|
||||
| msguniq -o scripts/kconfig/linux_$${i}.pot; \
|
||||
done
|
||||
$(Q)msgcat scripts/kconfig/config.pot \
|
||||
|
|
@ -39,10 +38,9 @@ update-po-config: $(obj)/kxgettext
|
|||
--output scripts/kconfig/linux_raw.pot
|
||||
$(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \
|
||||
--output scripts/kconfig/linux.pot
|
||||
$(Q)rm -f arch/um/Kconfig_arch
|
||||
$(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot
|
||||
|
||||
PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
|
||||
.PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig
|
||||
|
||||
randconfig: $(obj)/conf
|
||||
$< -r Kconfig
|
||||
|
|
@ -56,16 +54,32 @@ allnoconfig: $(obj)/conf
|
|||
allmodconfig: $(obj)/conf
|
||||
$< -m Kconfig
|
||||
|
||||
UNAME_RELEASE := $(shell uname -r)
|
||||
CLONECONFIG := $(firstword $(wildcard /proc/config.gz \
|
||||
/lib/modules/$(UNAME_RELEASE)/.config \
|
||||
/etc/kernel-config \
|
||||
/boot/config-$(UNAME_RELEASE)))
|
||||
cloneconfig: $(obj)/conf
|
||||
$(Q)case "$(CLONECONFIG)" in \
|
||||
'') echo -e "The configuration of the running" \
|
||||
"kernel could not be determined\n"; \
|
||||
false ;; \
|
||||
*.gz) gzip -cd $(CLONECONFIG) > .config.running ;; \
|
||||
*) cat $(CLONECONFIG) > .config.running ;; \
|
||||
esac && \
|
||||
echo -e "Cloning configuration file $(CLONECONFIG)\n"
|
||||
$(Q)$< -D .config.running Kconfig
|
||||
|
||||
defconfig: $(obj)/conf
|
||||
ifeq ($(KBUILD_DEFCONFIG),)
|
||||
$< -d Kconfig
|
||||
else
|
||||
@echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)'
|
||||
$(Q)$< -D arch/$(ARCH)/configs/$(KBUILD_DEFCONFIG) Kconfig
|
||||
$(Q)$< -D configs/$(KBUILD_DEFCONFIG) Kconfig
|
||||
endif
|
||||
|
||||
%_defconfig: $(obj)/conf
|
||||
$(Q)$< -D arch/$(ARCH)/configs/$@ Kconfig
|
||||
$(Q)$< -D configs/$@ Kconfig
|
||||
|
||||
# Help text used by make help
|
||||
help:
|
||||
|
|
@ -78,7 +92,7 @@ help:
|
|||
@echo ' defconfig - New config with default answer to all options'
|
||||
@echo ' allmodconfig - New config selecting modules when possible'
|
||||
@echo ' allyesconfig - New config where all options are accepted with yes'
|
||||
@echo ' allnoconfig - New config where all options are answered with no'
|
||||
@echo ' allnoconfig - New minimal config'
|
||||
|
||||
# ===========================================================================
|
||||
# Shared Makefile for the various kconfig executables:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
|
@ -64,6 +63,20 @@ static void check_stdin(void)
|
|||
}
|
||||
}
|
||||
|
||||
static char *fgets_check_stream(char *s, int size, FILE *stream)
|
||||
{
|
||||
char *ret = fgets(s, size, stream);
|
||||
|
||||
if (ret == NULL && feof(stream)) {
|
||||
printf(_("aborted!\n\n"));
|
||||
printf(_("Console input is closed. "));
|
||||
printf(_("Run 'make oldconfig' to update configuration.\n\n"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void conf_askvalue(struct symbol *sym, const char *def)
|
||||
{
|
||||
enum symbol_type type = sym_get_type(sym);
|
||||
|
|
@ -101,7 +114,7 @@ static void conf_askvalue(struct symbol *sym, const char *def)
|
|||
check_stdin();
|
||||
case ask_all:
|
||||
fflush(stdout);
|
||||
fgets(line, 128, stdin);
|
||||
fgets_check_stream(line, 128, stdin);
|
||||
return;
|
||||
case set_default:
|
||||
printf("%s\n", def);
|
||||
|
|
@ -315,7 +328,8 @@ static int conf_choice(struct menu *menu)
|
|||
printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
|
||||
def_sym = sym_get_choice_value(sym);
|
||||
cnt = def = 0;
|
||||
line[0] = 0;
|
||||
line[0] = '0';
|
||||
line[1] = 0;
|
||||
for (child = menu->list; child; child = child->next) {
|
||||
if (!menu_is_visible(child))
|
||||
continue;
|
||||
|
|
@ -356,7 +370,7 @@ static int conf_choice(struct menu *menu)
|
|||
check_stdin();
|
||||
case ask_all:
|
||||
fflush(stdout);
|
||||
fgets(line, 128, stdin);
|
||||
fgets_check_stream(line, 128, stdin);
|
||||
strip(line);
|
||||
if (line[0] == '?') {
|
||||
printf("\n%s\n", menu->sym->help ?
|
||||
|
|
@ -532,7 +546,7 @@ int main(int ac, char **av)
|
|||
break;
|
||||
case 'h':
|
||||
case '?':
|
||||
fprintf(stderr, "See README for usage info\n");
|
||||
printf("%s [-o|-s] config\n", av[0]);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ const char conf_defname[] = "arch/$ARCH/defconfig";
|
|||
|
||||
const char *conf_confnames[] = {
|
||||
".config",
|
||||
conf_defname,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
|
@ -321,7 +322,7 @@ int conf_read(const char *name)
|
|||
sym->flags |= e->right.sym->flags & SYMBOL_NEW;
|
||||
}
|
||||
|
||||
sym_change_count = conf_warnings || conf_unsaved;
|
||||
sym_change_count = conf_warnings && conf_unsaved;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -370,7 +371,6 @@ int conf_write(const char *name)
|
|||
out_h = fopen(".tmpconfig.h", "w");
|
||||
if (!out_h)
|
||||
return 1;
|
||||
file_write_dep(NULL);
|
||||
}
|
||||
sym = sym_lookup("KERNELVERSION", 0);
|
||||
sym_calc_value(sym);
|
||||
|
|
@ -509,6 +509,7 @@ int conf_write(const char *name)
|
|||
if (out_h) {
|
||||
fclose(out_h);
|
||||
rename(".tmpconfig.h", "include/linuxbios/autoconf.h");
|
||||
file_write_dep(NULL);
|
||||
}
|
||||
if (!name || basename != conf_def_filename) {
|
||||
if (!name)
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ void init_main_window(const gchar * glade_file)
|
|||
/*"style", PANGO_STYLE_OBLIQUE, */
|
||||
NULL);
|
||||
|
||||
sprintf(title, _("Linux Kernel v%s Configuration"),
|
||||
sprintf(title, _("LinuxBIOS v%s Configuration"),
|
||||
getenv("KERNELVERSION"));
|
||||
gtk_window_set_title(GTK_WINDOW(main_wnd), title);
|
||||
|
||||
|
|
@ -742,7 +742,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
|
|||
GtkWidget *dialog;
|
||||
const gchar *intro_text = _(
|
||||
"Welcome to gkc, the GTK+ graphical kernel configuration tool\n"
|
||||
"for Linux.\n"
|
||||
"for LinuxBIOS.\n"
|
||||
"For each option, a blank box indicates the feature is disabled, a\n"
|
||||
"check indicates it is enabled, and a dot indicates that it is to\n"
|
||||
"be compiled as a module. Clicking on the box will cycle through the three states.\n"
|
||||
|
|
|
|||
4
scripts/kconfig/lxdialog/.gitignore
vendored
4
scripts/kconfig/lxdialog/.gitignore
vendored
|
|
@ -1,4 +0,0 @@
|
|||
#
|
||||
# Generated files
|
||||
#
|
||||
lxdialog
|
||||
|
|
@ -7,10 +7,10 @@ check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh
|
|||
# we really need to do so. (Do not call gcc as part of make mrproper)
|
||||
HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
|
||||
HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
|
||||
|
||||
HOST_EXTRACFLAGS += -DLOCALE
|
||||
|
||||
HOST_EXTRACFLAGS += -DLOCALE
|
||||
|
||||
PHONY += dochecklxdialog
|
||||
.PHONY: dochecklxdialog
|
||||
$(obj)/dochecklxdialog:
|
||||
$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES)
|
||||
|
||||
|
|
|
|||
|
|
@ -196,8 +196,8 @@ int dialog_checklist(const char *title, const char *prompt, int height,
|
|||
|
||||
print_buttons(dialog, height, width, 0);
|
||||
|
||||
wnoutrefresh(dialog);
|
||||
wnoutrefresh(list);
|
||||
wnoutrefresh(dialog);
|
||||
doupdate();
|
||||
|
||||
while (key != ESC) {
|
||||
|
|
@ -225,11 +225,12 @@ int dialog_checklist(const char *title, const char *prompt, int height,
|
|||
}
|
||||
scroll--;
|
||||
print_item(list, items[scroll * 3 + 1], status[scroll], 0, TRUE);
|
||||
wnoutrefresh(list);
|
||||
|
||||
print_arrows(dialog, choice, item_no,
|
||||
scroll, box_y, box_x + check_x + 5, list_height);
|
||||
|
||||
wnoutrefresh(dialog);
|
||||
wrefresh(list);
|
||||
wrefresh(dialog);
|
||||
|
||||
continue; /* wait for another key press */
|
||||
} else
|
||||
|
|
@ -251,12 +252,12 @@ int dialog_checklist(const char *title, const char *prompt, int height,
|
|||
scroll++;
|
||||
print_item(list, items[(scroll + max_choice - 1) * 3 + 1],
|
||||
status[scroll + max_choice - 1], max_choice - 1, TRUE);
|
||||
wnoutrefresh(list);
|
||||
|
||||
print_arrows(dialog, choice, item_no,
|
||||
scroll, box_y, box_x + check_x + 5, list_height);
|
||||
|
||||
wnoutrefresh(dialog);
|
||||
wrefresh(list);
|
||||
wrefresh(dialog);
|
||||
|
||||
continue; /* wait for another key press */
|
||||
} else
|
||||
|
|
@ -270,8 +271,8 @@ int dialog_checklist(const char *title, const char *prompt, int height,
|
|||
choice = i;
|
||||
print_item(list, items[(scroll + choice) * 3 + 1],
|
||||
status[scroll + choice], choice, TRUE);
|
||||
wnoutrefresh(dialog);
|
||||
wrefresh(list);
|
||||
wnoutrefresh(list);
|
||||
wrefresh(dialog);
|
||||
}
|
||||
continue; /* wait for another key press */
|
||||
}
|
||||
|
|
@ -305,8 +306,8 @@ int dialog_checklist(const char *title, const char *prompt, int height,
|
|||
print_item(list, items[(scroll + i) * 3 + 1],
|
||||
status[scroll + i], i, i == choice);
|
||||
}
|
||||
wnoutrefresh(dialog);
|
||||
wrefresh(list);
|
||||
wnoutrefresh(list);
|
||||
wrefresh(dialog);
|
||||
|
||||
for (i = 0; i < item_no; i++)
|
||||
if (status[i])
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@
|
|||
|
||||
#include "dialog.h"
|
||||
|
||||
static int menu_width, item_x;
|
||||
#define ITEM_IDENT 1 /* Indent of menu entries. Fixed for all menus */
|
||||
static int menu_width;
|
||||
|
||||
/*
|
||||
* Print menu item
|
||||
|
|
@ -69,7 +70,7 @@ static void do_print_item(WINDOW * win, const char *item, int choice,
|
|||
int j;
|
||||
char *menu_item = malloc(menu_width + 1);
|
||||
|
||||
strncpy(menu_item, item, menu_width - item_x);
|
||||
strncpy(menu_item, item, menu_width - ITEM_IDENT);
|
||||
menu_item[menu_width] = 0;
|
||||
j = first_alpha(menu_item, "YyNnMmHh");
|
||||
|
||||
|
|
@ -86,13 +87,13 @@ static void do_print_item(WINDOW * win, const char *item, int choice,
|
|||
wclrtoeol(win);
|
||||
#endif
|
||||
wattrset(win, selected ? item_selected_attr : item_attr);
|
||||
mvwaddstr(win, choice, item_x, menu_item);
|
||||
mvwaddstr(win, choice, ITEM_IDENT, menu_item);
|
||||
if (hotkey) {
|
||||
wattrset(win, selected ? tag_key_selected_attr : tag_key_attr);
|
||||
mvwaddch(win, choice, item_x + j, menu_item[j]);
|
||||
mvwaddch(win, choice, ITEM_IDENT + j, menu_item[j]);
|
||||
}
|
||||
if (selected) {
|
||||
wmove(win, choice, item_x + 1);
|
||||
wmove(win, choice, ITEM_IDENT + 1);
|
||||
}
|
||||
free(menu_item);
|
||||
wrefresh(win);
|
||||
|
|
@ -226,8 +227,6 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
|
|||
draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2,
|
||||
menubox_border_attr, menubox_attr);
|
||||
|
||||
item_x = (menu_width - 70) / 2;
|
||||
|
||||
/* Set choice to default item */
|
||||
for (i = 0; i < item_no; i++)
|
||||
if (strcmp(current, items[i * 2]) == 0)
|
||||
|
|
@ -264,10 +263,10 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
|
|||
wnoutrefresh(menu);
|
||||
|
||||
print_arrows(dialog, item_no, scroll,
|
||||
box_y, box_x + item_x + 1, menu_height);
|
||||
box_y, box_x + ITEM_IDENT + 1, menu_height);
|
||||
|
||||
print_buttons(dialog, height, width, 0);
|
||||
wmove(menu, choice, item_x + 1);
|
||||
wmove(menu, choice, ITEM_IDENT + 1);
|
||||
wrefresh(menu);
|
||||
|
||||
while (key != ESC) {
|
||||
|
|
@ -350,7 +349,7 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
|
|||
print_item(scroll + choice, choice, TRUE);
|
||||
|
||||
print_arrows(dialog, item_no, scroll,
|
||||
box_y, box_x + item_x + 1, menu_height);
|
||||
box_y, box_x + ITEM_IDENT + 1, menu_height);
|
||||
|
||||
wnoutrefresh(dialog);
|
||||
wrefresh(menu);
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ static char menu_backtitle[128];
|
|||
static const char mconf_readme[] = N_(
|
||||
"Overview\n"
|
||||
"--------\n"
|
||||
"Some kernel features may be built directly into the kernel.\n"
|
||||
"Some firmware features may be built directly into the firmware.\n"
|
||||
"Some may be made into loadable runtime modules. Some features\n"
|
||||
"may be completely removed altogether. There are also certain\n"
|
||||
"kernel parameters which are not really features, but must be\n"
|
||||
"firmware parameters which are not really features, but must be\n"
|
||||
"entered in as decimal or hexadecimal numbers or possibly text.\n"
|
||||
"\n"
|
||||
"Menu items beginning with [*], <M> or [ ] represent features\n"
|
||||
|
|
@ -115,7 +115,7 @@ static const char mconf_readme[] = N_(
|
|||
"-----------------------------\n"
|
||||
"Menuconfig supports the use of alternate configuration files for\n"
|
||||
"those who, for various reasons, find it necessary to switch\n"
|
||||
"between different kernel configurations.\n"
|
||||
"between different firmware configurations.\n"
|
||||
"\n"
|
||||
"At the end of the main menu you will find two options. One is\n"
|
||||
"for saving the current configuration to a file of your choosing.\n"
|
||||
|
|
@ -148,7 +148,7 @@ static const char mconf_readme[] = N_(
|
|||
"\n"
|
||||
"Optional personality available\n"
|
||||
"------------------------------\n"
|
||||
"If you prefer to have all of the kernel options listed in a single\n"
|
||||
"If you prefer to have all of the firmware options listed in a single\n"
|
||||
"menu, rather than the default multimenu hierarchy, run the menuconfig\n"
|
||||
"with MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
|
||||
"\n"
|
||||
|
|
@ -186,18 +186,18 @@ setmod_text[] = N_(
|
|||
"This feature depends on another which has been configured as a module.\n"
|
||||
"As a result, this feature will be built as a module."),
|
||||
nohelp_text[] = N_(
|
||||
"There is no help available for this kernel option.\n"),
|
||||
"There is no help available for this firmware option.\n"),
|
||||
load_config_text[] = N_(
|
||||
"Enter the name of the configuration file you wish to load. "
|
||||
"Accept the name shown to restore the configuration you "
|
||||
"last retrieved. Leave blank to abort."),
|
||||
load_config_help[] = N_(
|
||||
"\n"
|
||||
"For various reasons, one may wish to keep several different kernel\n"
|
||||
"For various reasons, one may wish to keep several different firmware\n"
|
||||
"configurations available on a single machine.\n"
|
||||
"\n"
|
||||
"If you have saved a previous configuration in a file other than the\n"
|
||||
"kernel's default, entering the name of the file here will allow you\n"
|
||||
"firmware's default, entering the name of the file here will allow you\n"
|
||||
"to modify that configuration.\n"
|
||||
"\n"
|
||||
"If you are uncertain, then you have probably never used alternate\n"
|
||||
|
|
@ -207,7 +207,7 @@ save_config_text[] = N_(
|
|||
"as an alternate. Leave blank to abort."),
|
||||
save_config_help[] = N_(
|
||||
"\n"
|
||||
"For various reasons, one may wish to keep different kernel\n"
|
||||
"For various reasons, one may wish to keep different firmware\n"
|
||||
"configurations available on a single machine.\n"
|
||||
"\n"
|
||||
"Entering a file name here will allow you to later retrieve, modify\n"
|
||||
|
|
@ -1053,7 +1053,7 @@ int main(int ac, char **av)
|
|||
|
||||
sym = sym_lookup("KERNELVERSION", 0);
|
||||
sym_calc_value(sym);
|
||||
sprintf(menu_backtitle, _("Linux Kernel v%s Configuration"),
|
||||
sprintf(menu_backtitle, _("LinuxBIOS v%s Configuration"),
|
||||
sym_get_string_value(sym));
|
||||
|
||||
mode = getenv("MENUCONFIG_MODE");
|
||||
|
|
@ -1070,7 +1070,7 @@ int main(int ac, char **av)
|
|||
do {
|
||||
cprint_init();
|
||||
cprint("--yesno");
|
||||
cprint(_("Do you wish to save your new kernel configuration?"));
|
||||
cprint(_("Do you wish to save your new firmware configuration?"));
|
||||
cprint("5");
|
||||
cprint("60");
|
||||
stat = exec_conf();
|
||||
|
|
@ -1079,18 +1079,18 @@ int main(int ac, char **av)
|
|||
if (stat == 0) {
|
||||
if (conf_write(NULL)) {
|
||||
fprintf(stderr, _("\n\n"
|
||||
"Error during writing of the kernel configuration.\n"
|
||||
"Your kernel configuration changes were NOT saved."
|
||||
"Error during writing of the firmware configuration.\n"
|
||||
"Your firmware configuration changes were NOT saved."
|
||||
"\n\n"));
|
||||
return 1;
|
||||
}
|
||||
printf(_("\n\n"
|
||||
"*** End of Linux kernel configuration.\n"
|
||||
"*** Execute 'make' to build the kernel or try 'make help'."
|
||||
"*** End of LinuxBIOS configuration.\n"
|
||||
"*** Execute 'make' to build the firmware or try 'make help'."
|
||||
"\n\n"));
|
||||
} else {
|
||||
fprintf(stderr, _("\n\n"
|
||||
"Your kernel configuration changes were NOT saved."
|
||||
"Your firmware configuration changes were NOT saved."
|
||||
"\n\n"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ int file_write_dep(const char *name)
|
|||
else
|
||||
fprintf(out, "\t%s\n", file->name);
|
||||
}
|
||||
fprintf(out, "\n.config include/linuxbios/autoconf.h: $(deps_config)\n\n$(deps_config):\n");
|
||||
fprintf(out, "\n.config $(objtree)/include/linuxbios/autoconf.h: $(deps_config)\n\n$(deps_config):\n");
|
||||
fclose(out);
|
||||
rename("..config.tmp", name);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -1949,7 +1949,7 @@ void conf_parse(const char *name)
|
|||
sym_init();
|
||||
menu_init();
|
||||
modules_sym = sym_lookup("MODULES", 0);
|
||||
rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
|
||||
rootmenu.prompt = menu_add_prompt(P_MENU, "LinuxBIOS Configuration", NULL);
|
||||
|
||||
#if YYDEBUG
|
||||
if (getenv("ZCONF_DEBUG"))
|
||||
|
|
|
|||
|
|
@ -459,7 +459,7 @@ void conf_parse(const char *name)
|
|||
sym_init();
|
||||
menu_init();
|
||||
modules_sym = sym_lookup("MODULES", 0);
|
||||
rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
|
||||
rootmenu.prompt = menu_add_prompt(P_MENU, "LinuxBIOS Configuration", NULL);
|
||||
|
||||
#if YYDEBUG
|
||||
if (getenv("ZCONF_DEBUG"))
|
||||
|
|
|
|||
32
scripts/mkmakefile
Normal file
32
scripts/mkmakefile
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh
|
||||
# Generates a small Makefile used in the root of the output
|
||||
# directory, to allow make to be started from there.
|
||||
# The Makefile also allow for more convinient build of external modules
|
||||
|
||||
# Usage
|
||||
# $1 - Kernel src directory
|
||||
# $2 - Output directory
|
||||
# $3 - version
|
||||
# $4 - patchlevel
|
||||
|
||||
|
||||
cat << EOF
|
||||
# Automatically generated by $(basename $0): don't edit
|
||||
|
||||
VERSION = $3
|
||||
PATCHLEVEL = $4
|
||||
|
||||
KERNELSRC := $1
|
||||
KERNELOUTPUT := $2
|
||||
export ARCH := $ARCH
|
||||
|
||||
MAKEFLAGS += --no-print-directory
|
||||
|
||||
all:
|
||||
\$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT)
|
||||
|
||||
%::
|
||||
\$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$@
|
||||
|
||||
EOF
|
||||
|
||||
7
util/Makefile
Normal file
7
util/Makefile
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
###
|
||||
# util contains sources for various helper programs used throughout
|
||||
# the firmware for the build process.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Let clean descend into subdirs
|
||||
subdir- += dtc lar
|
||||
Loading…
Add table
Add a link
Reference in a new issue