Compare commits

..

11 Commits

Author SHA1 Message Date
Vladimir Serbinenko
dfabe9ce4a WIP: Disable hardlink test.
It doesn't wotk on termux.
2017-05-03 12:50:09 +02:00
Vladimir Serbinenko
ccaf9c7bcc WIP: disable m4_syscmd check in gnulib.
m4_syscmd uses /bin/sh which isn't available on termux.
2017-05-03 12:50:09 +02:00
Vladimir Serbinenko
a827807a13 Fix shebang for termux.
Termux doesn't have a /bin/sh. So we needto use $SHELL.
Keep /bin/sh as much as possible.
2017-05-03 12:49:31 +02:00
Vladimir Serbinenko
1073ddb120 Add termux path to dict. 2017-05-03 12:48:00 +02:00
Vladimir Serbinenko
4341f82af0 po: Use @SHELL@ rather than /bin/sh.
/bin/sh might not exist.
2017-05-03 12:46:48 +02:00
Vladimir Serbinenko
c2ea443446 Use $(SHELL) rather than /bin/sh.
/bin/sh doesn't exist under termux.
2017-05-03 12:46:38 +02:00
Vladimir Serbinenko
608bec5112 Support lseek64.
Android doesn't have 64-bit off_t, so use off64_t instead.
2017-05-03 12:24:43 +02:00
Vladimir Serbinenko
6dec3a26b3 Don't retrieve fstime when it's not useful. 2017-05-03 12:23:15 +02:00
Vladimir Serbinenko
b43b8cacc8 support busybox date.
Busybox date doesn't understand weekdays in -d input,
so strip them beforehand.
2017-05-03 12:22:05 +02:00
Vladimir Serbinenko
37865c2c4a fs-tester: make sh-compatible 2017-05-03 12:19:44 +02:00
Vladimir Serbinenko
5a0c548ba3 Remove bashisms from tests.
Those tests don't actually need bash. Just use common shebang.
2017-05-03 12:10:36 +02:00
14 changed files with 41 additions and 147 deletions

View File

@@ -41,7 +41,7 @@ CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx
CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) $(TARGET_INCREMENTAL_LINK)
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)

View File

@@ -903,25 +903,6 @@ if test x"$target_cpu" = xsparc64 ; then
TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_mno_relax"
fi
AC_CACHE_CHECK([for incremental link options], grub_cv_target_cc_incremental_link, [
grub_cv_target_cc_incremental_link=no
for cand in "-Wl,-r,-d" "-static -Wl,-r,-d"; do
#AC_LINK_IFELSE doesn't handle non-executable output correctly
echo > conftest_inclink.c
if $TARGET_CC -o /dev/null $TARGET_CFLAGS $TARGET_CPPFLAGS $TARGET_LDFLAGS -nostdlib -Werror $cand conftest_inclink.c >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
grub_cv_target_cc_incremental_link="$cand"
break
fi
done
])
if test x"$grub_cv_target_cc_incremental_link" = xno ; then
AC_MSG_ERROR([could not find incremental link options])
fi
TARGET_INCREMENTAL_LINK="$grub_cv_target_cc_incremental_link"
AC_SUBST(TARGET_INCREMENTAL_LINK)
# By default, GCC 4.4 generates .eh_frame sections containing unwind
# information in some cases where it previously did not. GRUB doesn't need
# these and they just use up vital space. Restore the old compiler
@@ -1235,6 +1216,7 @@ CFLAGS="$TARGET_CFLAGS"
grub_CHECK_PIE
grub_CHECK_NO_PIE
grub_CHECK_NO_PIE_ONEWORD
grub_CHECK_LINK_PIE
[# Need that, because some distributions ship compilers that include
# `-fPIE' or '-fpie' and '-pie' in the default specs.
if [ x"$pie_possible" = xyes ]; then

View File

@@ -49,20 +49,20 @@ kernel = {
nostrip = emu;
emu_ldflags = '$(TARGET_INCREMENTAL_LINK)';
i386_efi_ldflags = '$(TARGET_INCREMENTAL_LINK)';
emu_ldflags = '-Wl,-r,-d';
i386_efi_ldflags = '-Wl,-r,-d';
i386_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
x86_64_efi_ldflags = '$(TARGET_INCREMENTAL_LINK)';
x86_64_efi_ldflags = '-Wl,-r,-d';
x86_64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
ia64_efi_cflags = '-fno-builtin -fpic -minline-int-divide-max-throughput';
ia64_efi_ldflags = '$(TARGET_INCREMENTAL_LINK)';
ia64_efi_ldflags = '-Wl,-r,-d';
ia64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
arm_efi_ldflags = '$(TARGET_INCREMENTAL_LINK)';
arm_efi_ldflags = '-Wl,-r,-d';
arm_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
arm64_efi_ldflags = '$(TARGET_INCREMENTAL_LINK)';
arm64_efi_ldflags = '-Wl,-r,-d';
arm64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version -R .eh_frame';
i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
@@ -90,7 +90,7 @@ kernel = {
i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
emu_cflags = '$(CFLAGS_GNULIB)';
emu_cppflags = '$(CPPFLAGS_GNULIB)';
arm_uboot_ldflags = '$(TARGET_INCREMENTAL_LINK)';
arm_uboot_ldflags = '-Wl,-r,-d';
arm_uboot_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
i386_pc_startup = kern/i386/pc/startup.S;
@@ -1961,11 +1961,6 @@ module = {
common = tests/example_functional_test.c;
};
module = {
name = strtoull_test;
common = tests/strtoull_test.c;
};
module = {
name = setjmp_test;
common = tests/setjmp_test.c;

View File

@@ -79,9 +79,9 @@ else
for dep in $deps; do echo "char moddep_$dep[] __attribute__ ((section(\"_moddeps, _moddeps\"))) = \"$dep\";" >>$t2; done
if test -n "$deps"; then
@TARGET_CC@ @TARGET_LDFLAGS@ @TARGET_INCREMENTAL_LINK@ -ffreestanding -nostdlib -o $tmpfile2 $t1 $t2 $tmpfile
@TARGET_CC@ @TARGET_LDFLAGS@ -ffreestanding -nostdlib -o $tmpfile2 $t1 $t2 $tmpfile -Wl,-r,-d
else
@TARGET_CC@ @TARGET_LDFLAGS@ @TARGET_INCREMENTAL_LINK@ -ffreestanding -nostdlib -o $tmpfile2 $t1 $tmpfile
@TARGET_CC@ @TARGET_LDFLAGS@ -ffreestanding -nostdlib -o $tmpfile2 $t1 $tmpfile -Wl,-r,-d
fi
rm -f $t1 $t2 $tmpfile
mv $tmpfile2 $tmpfile

View File

@@ -391,13 +391,12 @@ grub_strtoull (const char *str, char **end, int base)
unsigned long digit;
digit = grub_tolower (*str) - '0';
if (digit >= 'a' - '0')
digit += '0' - 'a' + 10;
else if (digit > 9)
break;
if (digit >= (unsigned long) base)
break;
if (digit > 9)
{
digit += '0' - 'a' + 10;
if (digit >= (unsigned long) base)
break;
}
found = 1;

View File

@@ -19,7 +19,6 @@ grub_target_cflags='@TARGET_CFLAGS@'
grub_target_cppflags='@TARGET_CPPFLAGS@'
grub_target_ccasflags='@TARGET_CCASFLAGS@'
grub_target_ldflags='@TARGET_LDFLAGS@'
grub_target_incremental_ldflags='@TARGET_INCREMENTAL_LINK@'
grub_cflags='@CFLAGS@'
grub_cppflags='@CPPFLAGS@'
grub_ccasflags='@CCASFLAGS@'

View File

@@ -111,8 +111,8 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
}
grub_err_t
grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
grub_uint16_t *vlantag)
grub_net_arp_receive (struct grub_net_buff *nb,
struct grub_net_card *card)
{
struct arppkt *arp_packet = (struct arppkt *) nb->data;
grub_net_network_level_address_t sender_addr, target_addr;
@@ -138,14 +138,6 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
{
/* Verify vlantag id */
if (inf->card == card && inf->vlantag != *vlantag)
{
grub_dprintf ("net", "invalid vlantag! %x != %x\n",
inf->vlantag, *vlantag);
break;
}
/* Am I the protocol address target? */
if (grub_net_addr_cmp (&inf->address, &target_addr) == 0
&& arp_packet->op == grub_cpu_to_be16_compile_time (ARP_REQUEST))

View File

@@ -146,18 +146,18 @@ enum
};
static int
grub_ieee1275_parse_bootargs (const char *devpath, char *bootpath,
grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath,
char **device, struct grub_net_card **card)
{
char *args;
char *comma_char = 0;
char *equal_char = 0;
grub_size_t field_counter = 0;
grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask;
grub_net_link_level_address_t hw_addr;
grub_net_interface_flags_t flags = 0;
struct grub_net_network_level_interface *inter = NULL;
grub_uint16_t vlantag = 0;
hw_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
@@ -175,11 +175,6 @@ grub_ieee1275_parse_bootargs (const char *devpath, char *bootpath,
*equal_char = 0;
grub_env_set_net_property ((*card)->name, args, equal_char + 1,
grub_strlen(equal_char + 1));
if ((grub_strcmp (args, "vtag") == 0) &&
(grub_strlen (equal_char + 1) == 8))
vlantag = grub_strtoul (equal_char + 1 + 4, 0, 16);
*equal_char = '=';
}
else
@@ -218,10 +213,8 @@ grub_ieee1275_parse_bootargs (const char *devpath, char *bootpath,
hw_addr.mac, sizeof(hw_addr.mac), 0);
inter = grub_net_add_addr ((*card)->name, *card, &client_addr, &hw_addr,
flags);
inter->vlantag = vlantag;
grub_net_add_ipv4_local (inter,
__builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4)));
}
if (gateway_addr.ipv4 != 0)
@@ -274,7 +267,7 @@ grub_ieee1275_net_config_real (const char *devpath, char **device, char **path,
}
grub_free (canon);
grub_ieee1275_parse_bootargs (devpath, bootpath, device, &card);
grub_ieee1275_parse_bootpath (devpath, bootpath, device, &card);
for (i = 0; i < ARRAY_SIZE (bootp_response_properties); i++)
if (grub_ieee1275_get_property_length (grub_ieee1275_chosen,

View File

@@ -18,7 +18,6 @@
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/env.h>
#include <grub/net/ethernet.h>
#include <grub/net/ip.h>
#include <grub/net/arp.h>
@@ -57,17 +56,10 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
{
struct etherhdr *eth;
grub_err_t err;
grub_uint8_t etherhdr_size;
grub_uint16_t vlantag_id = VLANTAG_IDENTIFIER;
etherhdr_size = sizeof (*eth);
COMPILE_TIME_ASSERT (sizeof (*eth) + 4 < GRUB_NET_MAX_LINK_HEADER_SIZE);
COMPILE_TIME_ASSERT (sizeof (*eth) < GRUB_NET_MAX_LINK_HEADER_SIZE);
/* Increase ethernet header in case of vlantag */
if (inf->vlantag != 0)
etherhdr_size += 4;
err = grub_netbuff_push (nb, etherhdr_size);
err = grub_netbuff_push (nb, sizeof (*eth));
if (err)
return err;
eth = (struct etherhdr *) nb->data;
@@ -84,19 +76,6 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
return err;
inf->card->opened = 1;
}
/* Check and add a vlan-tag if needed. */
if (inf->vlantag != 0)
{
/* Move eth type to the right */
grub_memcpy ((char *) nb->data + etherhdr_size - 2,
(char *) nb->data + etherhdr_size - 6, 2);
/* Add the tag in the middle */
grub_memcpy ((char *) nb->data + etherhdr_size - 6, &vlantag_id, 2);
grub_memcpy ((char *) nb->data + etherhdr_size - 4, (char *) &(inf->vlantag), 2);
}
return inf->card->driver->send (inf->card, nb);
}
@@ -111,25 +90,10 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
grub_net_link_level_address_t hwaddress;
grub_net_link_level_address_t src_hwaddress;
grub_err_t err;
grub_uint8_t etherhdr_size = sizeof (*eth);
grub_uint16_t vlantag = 0;
/* Check if a vlan-tag is present. If so, the ethernet header is 4 bytes */
/* longer than the original one. The vlantag id is extracted and the header */
/* is reseted to the original size. */
if (grub_get_unaligned16 (nb->data + etherhdr_size - 2) == VLANTAG_IDENTIFIER)
{
vlantag = grub_get_unaligned16 (nb->data + etherhdr_size);
etherhdr_size += 4;
/* Move eth type to the original position */
grub_memcpy((char *) nb->data + etherhdr_size - 6,
(char *) nb->data + etherhdr_size - 2, 2);
}
eth = (struct etherhdr *) nb->data;
type = grub_be_to_cpu16 (eth->type);
err = grub_netbuff_pull (nb, etherhdr_size);
err = grub_netbuff_pull (nb, sizeof (*eth));
if (err)
return err;
@@ -157,14 +121,13 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
{
/* ARP packet. */
case GRUB_NET_ETHERTYPE_ARP:
grub_net_arp_receive (nb, card, &vlantag);
grub_net_arp_receive (nb, card);
grub_netbuff_free (nb);
return GRUB_ERR_NONE;
/* IP packet. */
case GRUB_NET_ETHERTYPE_IP:
case GRUB_NET_ETHERTYPE_IP6:
return grub_net_recv_ip_packets (nb, card, &hwaddress, &src_hwaddress,
&vlantag);
return grub_net_recv_ip_packets (nb, card, &hwaddress, &src_hwaddress);
}
grub_netbuff_free (nb);
return GRUB_ERR_NONE;

View File

@@ -228,13 +228,12 @@ handle_dgram (struct grub_net_buff *nb,
grub_net_ip_protocol_t proto,
const grub_net_network_level_address_t *source,
const grub_net_network_level_address_t *dest,
grub_uint16_t *vlantag,
grub_uint8_t ttl)
{
struct grub_net_network_level_interface *inf = NULL;
grub_err_t err;
int multicast = 0;
/* DHCP needs special treatment since we don't know IP yet. */
{
struct udphdr *udph;
@@ -294,15 +293,6 @@ handle_dgram (struct grub_net_buff *nb,
&& grub_net_addr_cmp (&inf->address, dest) == 0
&& grub_net_hwaddr_cmp (&inf->hwaddress, hwaddress) == 0)
break;
/* Verify vlantag id */
if (inf->card == card && inf->vlantag != *vlantag)
{
grub_dprintf ("net", "invalid vlantag! %x != %x\n",
inf->vlantag, *vlantag);
break;
}
/* Solicited node multicast. */
if (inf->card == card
&& inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6
@@ -393,8 +383,7 @@ static grub_err_t
grub_net_recv_ip4_packets (struct grub_net_buff *nb,
struct grub_net_card *card,
const grub_net_link_level_address_t *hwaddress,
const grub_net_link_level_address_t *src_hwaddress,
grub_uint16_t *vlantag)
const grub_net_link_level_address_t *src_hwaddress)
{
struct iphdr *iph = (struct iphdr *) nb->data;
grub_err_t err;
@@ -469,7 +458,7 @@ grub_net_recv_ip4_packets (struct grub_net_buff *nb,
dest.ipv4 = iph->dest;
return handle_dgram (nb, card, src_hwaddress, hwaddress, iph->protocol,
&source, &dest, vlantag, iph->ttl);
&source, &dest, iph->ttl);
}
for (prev = &reassembles, rsm = *prev; rsm; prev = &rsm->next, rsm = *prev)
@@ -605,7 +594,7 @@ grub_net_recv_ip4_packets (struct grub_net_buff *nb,
dest.ipv4 = dst;
return handle_dgram (ret, card, src_hwaddress,
hwaddress, proto, &source, &dest, vlantag,
hwaddress, proto, &source, &dest,
ttl);
}
}
@@ -663,8 +652,7 @@ static grub_err_t
grub_net_recv_ip6_packets (struct grub_net_buff *nb,
struct grub_net_card *card,
const grub_net_link_level_address_t *hwaddress,
const grub_net_link_level_address_t *src_hwaddress,
grub_uint16_t *vlantag)
const grub_net_link_level_address_t *src_hwaddress)
{
struct ip6hdr *iph = (struct ip6hdr *) nb->data;
grub_err_t err;
@@ -715,24 +703,21 @@ grub_net_recv_ip6_packets (struct grub_net_buff *nb,
grub_memcpy (dest.ipv6, &iph->dest, sizeof (dest.ipv6));
return handle_dgram (nb, card, src_hwaddress, hwaddress, iph->protocol,
&source, &dest, vlantag, iph->ttl);
&source, &dest, iph->ttl);
}
grub_err_t
grub_net_recv_ip_packets (struct grub_net_buff *nb,
struct grub_net_card *card,
const grub_net_link_level_address_t *hwaddress,
const grub_net_link_level_address_t *src_hwaddress,
grub_uint16_t *vlantag)
const grub_net_link_level_address_t *src_hwaddress)
{
struct iphdr *iph = (struct iphdr *) nb->data;
if ((iph->verhdrlen >> 4) == 4)
return grub_net_recv_ip4_packets (nb, card, hwaddress, src_hwaddress,
vlantag);
return grub_net_recv_ip4_packets (nb, card, hwaddress, src_hwaddress);
if ((iph->verhdrlen >> 4) == 6)
return grub_net_recv_ip6_packets (nb, card, hwaddress, src_hwaddress,
vlantag);
return grub_net_recv_ip6_packets (nb, card, hwaddress, src_hwaddress);
grub_dprintf ("net", "Bad IP version: %d\n", (iph->verhdrlen >> 4));
grub_netbuff_free (nb);
return GRUB_ERR_NONE;

View File

@@ -26,23 +26,14 @@ GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_functional_test (grub_extcmd_context_t ctxt __attribute__ ((unused)),
int argc,
char **args)
int argc __attribute__ ((unused)),
char **args __attribute__ ((unused)))
{
grub_test_t test;
int ok = 1;
int i;
FOR_LIST_ELEMENTS (test, grub_test_list)
{
if (argc != 0)
{
for (i = 0; i < argc; i++)
if (grub_strcmp(args[i], test->name) == 0)
break;
if (i == argc)
continue;
}
grub_errno = 0;
ok = ok && !grub_test_run (test);
grub_errno = 0;

View File

@@ -291,7 +291,6 @@ struct grub_net_network_level_interface
grub_net_interface_flags_t flags;
struct grub_net_bootp_packet *dhcp_ack;
grub_size_t dhcp_acklen;
grub_uint16_t vlantag;
void *data;
};
@@ -562,6 +561,4 @@ extern char *grub_net_default_server;
#define GRUB_NET_INTERVAL 400
#define GRUB_NET_INTERVAL_ADDITION 20
#define VLANTAG_IDENTIFIER 0x8100
#endif /* ! GRUB_NET_HEADER */

View File

@@ -22,11 +22,10 @@
#include <grub/net.h>
extern grub_err_t grub_net_arp_receive (struct grub_net_buff *nb,
struct grub_net_card *card,
grub_uint16_t *vlantag);
struct grub_net_card *card);
grub_err_t
grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
const grub_net_network_level_address_t *proto_addr);
const grub_net_network_level_address_t *proto_addr);
#endif

View File

@@ -48,8 +48,7 @@ grub_err_t
grub_net_recv_ip_packets (struct grub_net_buff *nb,
struct grub_net_card *card,
const grub_net_link_level_address_t *hwaddress,
const grub_net_link_level_address_t *src_hwaddress,
grub_uint16_t *vlantag);
const grub_net_link_level_address_t *src_hwaddress);
grub_err_t
grub_net_send_ip_packet (struct grub_net_network_level_interface *inf,